Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

Send message to CLI from event script

‎12-29-2014 09:29 AM

Hi Everyone,

 

Working on my first script which changes some configuration. I would like send a message some how to all the users logged into the box informing them that the script is running. I have tried adding this to the event policy, tried doing it in the script to no avail.

 

From my research I can't seem to find a way of acheiving this as there is no RPC for request message. Does anyone have any ideas??

 

Regards

Andy

1 REPLY 1
Highlighted
Junos Automation (Scripting)

Re: Send message to CLI from event script

‎12-31-2014 09:13 AM

This looks like an interesting issue, as I've not found a work-around to address this.

 

As you've noticed there isn't any specific RPC to handle this, and from my own quick checks I've not had any success with the command rpc either.

 

var $local = jcs:open();
var $command = {
  <command> 'request message all message "This is a test!"';
}
var $results = jcs:execute( $local , $command );

 Performing the RPC directly via netconf produces the same results and no message is being broadcast.

 

<rpc><command>request message all message "this is a test"</command></rpc>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/12.1X46/junos">
<cli>
<stdin-line>this is a test</stdin-line>
</cli>
<run-command>
<command>/usr/bin/wall</command>
</run-command>
</rpc-reply>
]]>]]>

 So, it does look that this approach isn't going to work unless of course someone has another approach.

 

Regards.

Feedback