Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The script action lets you execute a program of your choice, and optionally captures and saves that program's output with the event. As usual, the section script of conf/EventActions.nmis contains the required configuration directives:

...

Wiki Markup
{

...


   "script" :

...

 {
      "traceroute_node" :

...

 {
         "exec" : "/bin/traceroute",

...


         "arguments" : "--max-hops=20 node.host",

...


         "output" : "save"

...

      },

...


      },
      "future_proof" :

...

 {
         "max_tries" : 2,

...


         "output" : "save",

...


         "stderr" : "save",

...


         "exitcode" : "save",

...


         "exec" :

...

 [
            "/usr/local/bin/someprogram",

...


            "--first-fixed-arg",

...


            "no substitution happens here"

...

         ],

...


         ],
         "arguments" :

...

 [
            "event.node",

...


            "event.event",

...


            "--extra",

...


            "event.details"

...

         ]

      },

...


         ]
      },
      "ping_node" :

...

 {
         "output" : "save",

...


         "exec" : "/bin/ping",

...


         "arguments" : "-c 5 node.host"

...

      }

   }

}

...


      }
   }
}

The path to the program file must be given in the exec option. Arguments can be passed to the program; simply add them to the arguments option. Any tokens of the form event.name or node.name will be replaced by the named event or node property, respectively. If the option output is set to save, then the output of the program execution is captured and saved with the event in question; otherwise the output is discarded.

...