Junos OS

Expand all | Collapse all

event-options/policy using a command with double quotes

Jump to Best Answer
  • 1.  event-options/policy using a command with double quotes

    Posted 07-03-2019 06:23

    I am setting up an event-option with JunOS v15.1, but I am having trouble with the commands to execute.  The command I wish to execute is 'request snmp spoof-trap jnxEventTrap variable-bindings "jnxEventTrapDescr = Daily-Freshness-Check"', but I cannot get the quotes within the quoted command.  This is the best I can get it to accept, but it does not generate a trap.  If I remove the variable-bindings, it works fine.

    policy freshness-trap {
        events freshness-check;
        then {
            execute-commands {
                commands {
                    "request snmp spoof-trap jnxEventTrap variable-bindings 'jnxEventTrapDescr = Daily-Freshness-Check'";
                }
            }
        }   
    }

     

    Is it possible to include the double quotes within the double quotes?



  • 2.  RE: event-options/policy using a command with double quotes
    Best Answer

     
    Posted 07-03-2019 07:48

    Try this

     

     "request snmp spoof-trap jnxEventTrap variable-bindings \"jnxEventTrapDescr = Daily-Freshness-Check\""

     

     

    Here's a few working examples for event-option to execute pfe/re shell commands. Should be supported:

     

    set event-options policy test then execute-commands commands "start shell sh command \"/sbin/sh /var/home/labroot/cmd.sh\" | no-more"

     

    set event-options policy high-cpu then execute-commands commands "request pfe execute target tnp tnp-name fpc1.pic0  command \"show usp jexec event\""

     

    set event-options policy log-on-snmp-trap-link-down then execute-commands commands "request pfe execute command 'show  syslog  messages ' target fpc0 | no-more"



  • 3.  RE: event-options/policy using a command with double quotes

    Posted 07-03-2019 09:07

    That worked perfectly - Thanks!