Goals and Symptoms
Summary
Using DOS batch files it is possible to send a page or email to a specified list of people that depends on which site initiated the alarm.
For example, you may have two ION meters at two different stations; StationA and StationB. If an alarm happens at StationA you want to notify PersonA. Similarly for StationB you wish to notify PersonB. Each person has an email address (persona@someplace.com) and pager address (persona.page@someplace.com).
Causes and Fixes
Commissioning Procedure
- Construct the pager and email DOS batch files (Details below)
- Construct the alarmsrv.cmd file (Details below)
- Start AlarmServer with the alarmsrv.cmd file
- Test your alarms
Add the alarmsrv.cmd file into the Windows startup folder for the user who operates the ION Enterprise system. Alternatively, set up a Windows scheduled task to launch the alarmsrv.cmd file when the machine boots.
Please read the help for configuring Alarm Server before proceeding.
Contents of alarmsrv.cmd
The purpose of this DOS command file is to launch AlarmSrv with all of the necessary parameters. This includes the modem type, the serial communications port, the baud rate, followed by a list of programs to run when an alarm is received. Each program in this list needs to be enclosed in double quotes. Also note that the command is using DOS variables (e.g. %g, %M etc) and these need to be "escaped" so that they are correctly passed onto the command. This is why there are two % signs.
The four programs that AlarmSrv will run when it receives and alarm from a meter are as follows:
- "D:\IONEnterprise\pager.bat %%g %%M %%n"
This sends the email and page. We are passing in the site name, message from the meter, and the meter name. - "conman -p900 %%g"
This instructs ION Enterprise to connect with the meter to download logs, events and waveforms. - "net send IONServer %%t %%M Please check the meter: %%n"
This sends a network message, using NET SEND. The message is sent to a machine named IONServer. Substitute a machine name that suits. The message includes the local time, the message from the meter, and the meter name.
All of the following text is placed into a file called alarmsrv.cmd. All of the following is placed on one line.
- D:\IONEnterprise\system\bin\alarmsrv.exe -m"USRobotics Faxmodem V.90 56k" -cCOM2 -b9600 -D "D:\IONEnterprise\emailpage.bat %%g %%M %%n" "conman -p900 %%g" "net send PQMETER %%t %%M Please check the meter: %%n"
Contents of emailpage.bat
The purpose of this DOS command file is to send the an email and a page to the appropriate person. It expects three command line arguments; the site name, the meters message and the meter name.
- echooff
rem Change to the drive where ION Enterprise is installed.
rem Must do this in case DOS environment opens in another drive.
d:
rem Change to the directory where ION Enterprise is installed
cd \dev
rem ****************************************************************rem Routine to create message text file
rem ***************************************************************
rem Create the message in the file call body.txt
rem The echo command is followed by some text, a single > and then
rem the file name. The single > directs the text output of the
rem echo command into the file. It also creates this file.
echo Alert Incident date and time: > body.txt
rem Push the date and time into the file. Use >> to append to file.
date /t >> body.txt
time /t >> body.txt
rem Add an empty line into the file
echo. >> body.txt
rem Add the three command line arguments to the message.
rem WARNING. This sample does not contain any error detection.
rem Production system should check for existence of these parameters.
echo Site: %1 >> body.txt
echo Condition: %2 >> body.txt
echo Node: %3 >> body.txt
echo. >> body.txt
rem **************************************************************
rem Send out messages to specific pager based on a site name
rem ****************************************************************
rem Blat available from http://www.blat.net/194/
rem The following assumes you have installed blat.
if %1==StationA goto sendStationA
goto end2
:sendStationA
blat body.txt -to personA@someplace.com,personA.page@someplace.com -subject "Meter Alert!" -f senders.email.address@someplace.com
:end2
if %1==StationB goto sendStationB
goto end1
blat body.txt -to personB@someplace.com,personB.page@someplace.com -subject "Meter Alert!" -f senders.email.address@someplace.com
:sendStationB
:end1