1
0
-1

Hello, I'm having trouble running a command using the opconfig-cli.pl script. I'm my event actions I have the following script:

"bounceport": { "exec" : "/usr/local/omk/bin/opconfig-cli.pl", "output" : "save", "arguments" : "act=test_connect debug=9 node=node.name command=\":global portName event.element; system script run op_script_port_bounce\"" }

With a policy that triggers this event if an interface goes down and does not resolve after some time. The problem is when I test the script using a test event to trigger it, the output of the command is not the entire command that I have in the line above. Here is the debug I see in the event:

[2022-04-27 23:57:28.59353] [208950] [debug] get_session returned status 'Success' and message ''

[2022-04-27 23:57:28.59379] [208950] [debug] now running command "":global"


However, if I cd into /usr/local/omk/bin and run the same command with the same parameters above I get the following debug message:

[2022-04-28 00:04:51.04617] [212031] [debug] get_session returned status 'Success' and message ''

[2022-04-28 00:04:51.04644] [212031] [debug] now running command ":global portName sfp-sfpplus8; system script run op_script_port_bounce;"


In the debug it now shows the full command and runs the script successfully, am I missing something in the syntax? I have tried messing with it for a while but I cannot get it to read the command fully.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      So I created a bash script that runs the cli tool:


      #!/bin/bash
      echo $1
      echo $2
      /usr/local/omk/bin/opconfig-cli.pl act=test_connect node=$1 command=$2


      running the command this way results in the same issue as running the command via the event handler where only the first word is being sent. It looks like running the tool directly sends the full command but when running the tool indirectly it is only reading the first word for some reason. Anyone experience this? 

        CommentAdd your comment...