From OpenNMS
Contents |
Introduction
This page explains the contents of the notificationCommands.xml file, found under opennms/etc folder.
This is just a stub for now.
XML Elements
Argument
streamed attribute dictates whether the the substitution text and/or switch text will be placed in the command line, or simply be placed in the input stream when the command start running.
Placing boilerplate arguments
<argument streamed="false">
<substitution>-D</substitution>
</argument>
Placing dynamic values
<argument streamed="false">
<switch>-tm</switch>
</argument>
Note that when you combine the two (substitution and switch) each is written as a separate argument in the command line. For example:
<argument streamed="false">
<substitution>-Dnodeid=</substitution>
<switch>-nodeid</switch>
</argument>
Translates to:
-Dnodeid= 8
and not:
-Dnodeid=8
This kind of prevents passing properties to an Ant script
The following are valid properties (from http://permalink.gmane.org/gmane.network.opennms.general/36040) /*Some paramter identification strings*/
public static final String PARAM_TYPE = "-t";
public static final String PARAM_DESTINATION = "-d";
public static final String PARAM_TEXT_MSG = "-tm";
public static final String PARAM_NUM_MSG = "-nm";
public static final String PARAM_RESPONSE = "-r";
public static final String PARAM_NODE = "-nodeid";
public static final String PARAM_INTERFACE = "-interface";
public static final String PARAM_SERVICE = "-service";
public static final String PARAM_SUBJECT = "-subject";
public static final String PARAM_EMAIL = "-email";
public static final String PARAM_PAGER_EMAIL "-pemail";
public static final String PARAM_TEXT_PAGER_PIN = "-tp";
public static final String PARAM_NUM_PAGER_PIN = "-np";
In the list above, the following parameters come from the user configuration: destination, -d; email, -email; pager email, -pemail; xmpp address, -xmpp; text pager pin, -tp; num pager pin, -np. All other switches (-t, -tm, -nm, -r, -nodeid, -interface, -service, -subject) seem to come from the notifications.xml configuration and/or the event itself.
Extended dynamic values
As per Notification_Configuration_How-To, you can pass arbitrary parameters from the notification to the notificationCommand via the <parameter> tag, which can then be used as required.
Example
Here's a good example I found explaining how to build a notification command element.






