Example Notification from a Command Line Program

Here is a simple example of a command line notifier. This notifier does the following:

  1. Calls a python script located in the Intermapper Settings\Tools folder.
  2. Passes the script two parameters:
    - The notification message, using the ${MESSAGE} macro.
    - A filename for a log file
  3. The script opens the specified file, (also located in the Tools folder) and appends the message text to it.

Log.py Script

Place this script in the Tools folder in a text file named 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

Configure a new notifier as follows:

  1. Create a new notifier.
  2. Set the Type to Command Line.
  3. Enter this text in the Command 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 to the log file.