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:

import sys
# 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:

  1. Create a new notifier.
  2. Set the Type to Command Line.
  3. Enter the following text in the Command text box:

    ${PYTHON} log.py "${MESSAGE}" test.log

  4. Edit the message and schedule as needed.
  5. Click Test Notifier Configuration.
  6. 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.