Example Notification From a Command Line Program
The following is a simple example of a command line notifier. This notifier does the following:
- Calls a Python script located in the Intermapper Settings\Tools folder.
-
Passes the following script parameters:
- The notification message, using the ${MESSAGE} macro.
- A log file filename.
- The script opens the specified file (also located in the Tools folder) and appends the message text to it.
Log.py Script
Place the following script in the Tools folder in a text file called log.py:
# options are: message logfile
if __name__ == '__main__':
f = open(sys.argv[2], 'a+')
f.write(sys.argv[1]+'\n')
f.close()
Configuring the Command Line Notifier
To configure a new notifier:
- Create a new notifier.
- Set the Type to Command Line.
-
Enter the following text in the Command text box:
${PYTHON} log.py "${MESSAGE}" test.log
- Edit the message and schedule as needed.
- Click Test Notifier Configuration.
- Attach the notifier to one or more devices as described in Attaching_A_Notifier.htm.
When the notifier runs, a file named test.log is created in the Tools folder. Message text is appended to the log file.