Using EEM to telnet to switches and execute commands

Can EEM telnet to other switches.
It doesn't seem to work and when you run debug it drops out at the password for telnet.
I have tried using the "pattern" option to put the telnet password in.  but can't get it to work
All I won't to be able to do is automatically run a few commands on other switches from the core.
Any ideas

I can assure you EEM on IOS can initiate telnet session without a hitch, but on IOX, still struggling to find out the workaroud.
proc remote_cmd_telnet { remote_host username password prompt_expect clist } {
    # this function will carry out each command contained in the clist on remote host.
    if { [catch {cli_open} result] } {
             PUTS $result
             return 1
        } else {
             array set cliarr $result
    #Login to remote router
    if { [catch {cli_write $cliarr(fd) "telnet  $remote_host" } result] } {
         PUTS $result
         return 1
    PUTS $result
#   if { [catch {cli_read_pattern $cliarr(fd) "Username:"} result] } {
#        PUTS error "Failed to read response: '$result'"
#       return 1    
#   PUTS $result
    if { [catch {cli_write $cliarr(fd) $username } result] } {
         PUTS $result
         return 1
    PUTS $result
    if { [catch {cli_read_pattern $cliarr(fd) "Password:"} result] } {
        PUTS error "Failed to read response: '$result'"
        return 1    
    PUTS $result
    if { [catch {cli_write $cliarr(fd) $password } result] } {
         PUTS $result
         return 1
    PUTS $result
    if { [catch {cli_read_pattern $cliarr(fd) "#"} result] } {

Similar Messages

  • How to shut no shut interface of switch using(EEM) Script for 3560 switch

    Dear community experts,
    I'm new for creating scripting for EEM and below is my situation, need your support.
    Present I'm using 3560 switch, one of  the switch port(FA0/1) has added  Cisco Access point(PoE), actually what happening daily this Access point getting struct when I'M doing the switch port (FA0/1) shut  then no shut it is working fine .
    So my question is i need script, that should continuously ping the IP off the Access point if the IP will drop 4 packets the switch do shut  and then no shut for that I need the script, Please help me.
    if it is not possible please provide the batch file, which will ping the particular IP if 4 packet drops it will telnet the switch and go to the interface do shut no shut 
    Note: 
    instead of mentioned 3560, I mentioned 2960 now corrected it  please provide the script.

    This should work:
    ip sla 1
     icmp-echo 10.10.10.1
     frequency 15
    ip sla schedule 1 life forever start now
    ip sla enable reaction-alerts
    ip sla reaction-configuration 1 react timeout action-type trapOnly threshold-type consecutive 4
    event manager applet reset-ap
     event ipsla operation-id 1 reaction-type timeout
     action 1.0 cli command "enable"
     action 2.0 cli command "config t"
     action 3.0 cli command "int fa0/1"
     action 4.0 cli command "shut"
     action 5.0 cli command "no shut"
     action 6.0 cli command "end"

  • How can I use JTA in my business logic and execute process with PAPI?

    HI All,
    How can I use JTA in my business logic and execute process with PAPI?
    When my business logic has exception, the process will rollback.
    or the process has some exceptions, my business logic also will rollback.
    I don't know how to do it.
    Does anyone know how to do it?

    Thank you for your reply, Daniel.
    But I think I did not express my mind clearly.
    There is a scene that I have 2 Application Server.
    My business code is deployed in one Server.
    The BPM is deployed in another Server.
    I want to execute Task use PAPI.(ProcessServiceSession.runActivity)
    In my business code, I will do something before execute Task.
    I need my business logic and Task in same transaction.
    To ensure them "all-or-nothing" .
    As you say, if The transactions are managed by Oracle BPM.
    then can I retrieve OBPM transcaction in my business code?

  • Can I use EEM to upload long scripts and run them?`

    I asked this question here, on ServerFault, and they guided me to here.
    The issue is basic. If I need to run hundreds of al/ag/ng/no commands on a Cisco ASA programmatically, I need to do it via a SSH shell, with the restriction that the ASA will not take a command size greater than 1024 bytes. I take my batch, and find the number of whole lines, as long as they are under 1,000 characters, and send commands like this-effectively "chunking" the batch into smaller pieces. This takes forever.
    I am not talking about a replacement config, frequently run commands, or rebooting the AS in any way. I am just talking about making 'hot' modifications remotely via computer program.
    I don't know if EEM is the way, but if it can do the following (exactly, or functionally), it is of great interest:
    1. A remote client creates a batch file-nothing more than a sequence of commands for the CLI.
    2. That batch file makes it's way to the ASA (any number of ways).
    3. The commands in the batch are run, in order, as if typed in on the command line.
    4. I imagine some sort of feedback would be nice, or even a signal that it is done, etc.
    What are your thoughts?
    Thank you!
    P.S. I am not debating whether it is a good idea or not (unless you have a better way). I am merely asking how it can be done, and if EEM isn't the key, than what else might be?

    The ASA doesn't really support EEM.  Yes, there is a now a feature called EEM in 9.2, but it is quite limited compared to IOS.  In IOS, what you want would be possible, but on the ASA, you'll need to do all of your CLI commands off box using something like Expect.  I'm not sure how you're automating this now, but perhaps you are already using Expect.  That would be what I'd likely do in this situation.

  • I am using opensuse 11.3, I download and execute firefox from sh file. But it cannot find libflashplayer.so. All my other browsers have flash player (usr/lib/browser-plugins/libflashplayer.so). But firefox cannot see that file. What must I do?

    That's all no much details.

    Try to place a symlink to the Flash plugin in /usr/lib/mozilla/plugins
    See also:
    *http://kb.mozillazine.org/Determining_plugin_directory_on_Linux

  • Using the " character in a to be executed command (EMM)

    Hi,
    I ran against a small challange building a feature in a EMM based menu.
    I would like to have an user to change the number dialed in a chat-script but the chat-script command uses the character " in it's command.
    The same character " is also used to mark the beginning and the end in the <IOSExecCommand> and the <IOSConfigCommand>.
    When executing the feature it give's an error message back stating: EMM TCL Error: extra characters after close-quot.
    Which is not weird because there are a lot of " in the command line and normally you can put multiple command-lines in a single ExecCommand - or ConfigCommand line to mark the beginning and the end of a single command-line.
    According to TCL language script you could write the character " as \" or \\" but neither one of them does the trick to make it work.
    The ConfigCommand I want to execute looks like this:
    <IOSConfigCommand>"no chat-script internet " "chat-script internet "" "ATDT*98*2#" TIMEOUT 60 CONNECT"</IOSConfigCommand>
    Does anyone have an idea how to solve this?
    I'm kind of stuck with it.
    Kind regards,
    Jorn van Riel

    Instead of using IOSConfigCommand, use EmbeddedTCL instead.  For example:
          ios_config "no chat-script internet" {chat-script internet "" "ATDT*98*2#" TIMEOUT 60 CONNECT} 

  • Get system variable and execute a Java Script

    I'm not sure it is the appropriate forum to ask this
    question. I'm using Captivate 2 without LMS.
    I need to execute a java script that take read a system
    variable (eg. USERNAME) and opens an URL using the USERNAMe as
    parameter. The idea here is to update a database opening a specific
    URL for a specific USERNAME.
    Any one has an example to do something similar ?

    Hello All,
    Could anyone please help me with some examples or
    tutorials how I can create Java Applet to run telnet
    to UNIX and execute a shell script?
    Presumably you don't need to write the telnet code yourself (like for a class.)
    If so then you can use this...
    http://jakarta.apache.org/commons/net/
    There might be some other dependencies from other commons stuff that you will need to resolve to run it.
    Once you have that, presumably you are not telnetting back to the source of the applet. If so you will need to deal with security for the applet. Usually that means that you must sign the applet. Otherwise you will have to modify the policy file on each client machine that will run the applet.

  • What can I do to insatall and execute reflink (OVM 2.2.2)

    Hi, all.
    The below link is describing how to execute reflink command on OVM 2.2.2
    https://blogs.oracle.com/wim/entry/oracle_vm_22_and_the_power_of_1
    But it isn't how to install reflink.
    What can I prepare to insatall and execute command "reflink" on OVM 2.2.2 ?
    Thank you.

    Yeonki wrote:
    What can I prepare to insatall and execute command "reflink" on OVM 2.2.2 ?I'll check with Wim to see where he got reflink from for Oracle VM 2.2.2 -- It's installed and used on Oracle VM 3.0 to do instant cloning of templates and VMs, as well as hot cloning of running VMs.

  • Emctl istop and stop commands

    Hi all
    I was recently having an issue with OEM in that even though I was logged in as SYS user I was unable to do certain things in EM without getting various errors. One of our devs then said to do an a emctl istop dbconsole and the start the service (i am using windows) using emctl start dbconsole.
    This seemed to fix the problem. I have not read anywhere about the i commands can someone explain to me why this worked?
    Thanks

    Excuse me? I do search, I spend nearly %80 of my time searching at the moment, sometimes people don't understand something which is why they use forums for a different perspective on things.
    asam! - Thanks for the reply, but restarting using just the standard emctl start and stop commands didn't fix the issue, it was only when using the istop and then a net service start that the service came back up.
    Edited by: Kwisatz78 on Jul 7, 2011 5:40 AM

  • Conflict using simultaneously IVI Switch and Switch Executive ?

    Hi,
    I use IVI Switch and Switch Executive libraries in an Labwindows CVI project, and I meet some problems :
    I call SE lib for InitSession/CloseSession/FindRoute and Connect/Disconnect (apply to any switch devices in the SE configuration).
    I call IVI Switch lib for SelfTest and Reset (apply to a single device).
    But when I do an IVI Switch Reset then a Switch Executive Connect or Disconnect, an error occurs : Switch Executive seems to ignore what IVI Switch operations do to the device ?
    Also, can you tell me if :
    niSE_OpenSession performs a self test for the devices in the config ? A reset ?
    niSE_CloseSession performs a reset for the devices in the config ?
    Thanks.

    Hello,
    the niSE session talks to underlying IVI drivers using the IVI Switch session underneath, so any additional opening of IVI Switch session to the same device will cause the two driver sessions (that keep the information about the state of the hardware connections) to be either one or both out of synch with the actual hardware state). Because of the architecture of the underlying IVI drivers, niSE session cannot know if and what someone did to the instrument using IVI Switch session.
    Therefore, it is not adviseable to use IVI Switch session while having another session open to the same device. If you need to use the invasive operations - which is anything that changes the state of the device, such as Reset and possibly self-test (self-test may be implemented as an operation that cycles relays and it may not but you can't be sure), you must make sure that one session is open and closed before another type of session is open.
    The ni Switch Executive Open Session calls IviSwtch_init (with ID Query and Reset set to true) and CloseSession closes the IVI Switch sessions with the call to Close. The niSE session does not make calls to either reset or self-test explicitly.
    Always attempt to perform all the operations on the same piece of hardware using the same API. If you need to reset switches, use the niSE_DisconnectAll function. If you need to perform the self-test operation, open a session to IVI Switch and perform the self-test, and then close it before opening the session to niSE virtual device.
    There is also a back-door possibility that you can obtain the IVI Switch session that has been open for the constituent devices by niSE, but you must make sure that whatever you do with that session leaves the state of the switch intact when you get back to making calls to the niSE session. If unsure, you can always call niSE_DisconnectAll() as the first thing coming back to the niSE session to ensure that the state stored in niSE session matches the state on the actual hardware.
    Again, it is best not to use both sessions, but rather pick one and try to perform all operations with it before switching to another type of session.
    Srdan Zirojevic

  • Telneting to a remote host and executing unix shell script

    I am using VPN.I want to telnet to a remote server and execute some script there and show it the output in my front end..is it easily possible thru java..i know it can be easily done thru Python...can anyone let me knw if this can ve achieved properly thru java..thnx plz let me knw ASAP.

    Yes surely I have wriiten the code..
    I have first used a Socket to connect to teh host at port 23.
    Then i am using outstream to give the user and passwd .. but in my Inputstream i am getting some vague outputs (some symbols..$,%,etc..) This is the code for ur reference....
    import java.net.*;
    import java.io.*;
    class Telclient {
    public static void main(String args[]) {
    int c;
    try{
    Socket s=new Socket("abc.net",23);
    InputStream in=s.getInputStream();
    OutputStream out=out.getoutputStream();
    String str="user" + "\n" + "password" + "\n";
    byte buf[]=str.getBytes();
    out.write(buf);
    while((c=in.read()) != -1) {
    System.out.println((char)c);
    s.close();
    Please help with teh code , bcoz its not really working..Need urgent helpI also used TelnetClient from jakarta , but failing to understand
    how to use those classes to use..can anyone show me an example...

  • HT5012 I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

    I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • I want to switch stores from Japan to USA. I used to have an iTunes card, and there's 15 YEN left in my account, how can I get rid of that so I can start purchasing in the US store using my new credit card?

    I want to switch stores from Japan to USA. I used to have an iTunes card, and there's 15 YEN left in my account, how can I get rid of that so I can start purchasing in the US store using my new credit card?

    I can't seem to find an app that costs my available balance. iTunes said I need to spend it ALL before I can change stores. This means I cannot totally change stores.... Hopeless.

  • How do I use switch and case statements to fill more than one other field?

    Hi all,
    I'm new to the community.
    I'm trying to make an existing form more user friendly for my coworkers. I want to use a switch and case approach in a drop-down list field so that the selection fills two seperate other fields with different info related to the selection.
    I can already do this with one field, but if I add a second target field under an existing case the text doesn't appear there when I make the selection from the dropdown.
    Basically, I'm asking if I can do this:
    switch 
    (sNewSel){
       case "1": // Selection 1    Row2.Field1
    = "text for field 1";
        Row1.Field2 = "text for field 2"; 
        break;
    etc.
    It works if the "row1.field2" option isn't there, but not when it is present.
    Any takers?

    I'm not sure if I will be able to send you the form. There may be too much to redact.
    Would this last bit of code in the cell affect anything?
    if 
    (bEnableTextField)
    {Row2.Field1.access
    = "open"; // enable field
    Row2.Field1.caption.font.fill.color.value= "0,0,0"; // set caption to black
    That is, do I also need to repeat the same thing for the second target cell (Row1.Field2)?
    What would be possible hang ups that would prevent it from working correctly?
    Dave
    By the way, I'm not sure if my other attachment posted. I am trying again.

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

Maybe you are looking for