AN33: M1 – Closing a remote relay contact upon NMS alarm

Poseidon, in conjunction with the M1 a.k.a. Monitor one software, can be used to close a relay contact if a preset value (temperature, humidity, etc.) is exceeded. This AN describes one of the possible methods.

The M1 (Monitor one) monitoring system by FineConnection is designed for monitoring network and networking infrastructure status. Products in the Poseidon family are fully integrated with Monitor one.

In environment monitoring applications, one may need to close a contact (sound a siren, turn on a warning light, etc.) whenever one of the monitored values exceeds a defined threshold.

Monitor one allows to run an external program or batch file upon alarm. In the following example, this feature is used to run the switch_on.cmd script whenever an alarm occurs. The script checks the alarm state message for a given string ("Contact" in this example), and if it is found, invokes the PosDamIO utility to close the contact remotely via the network.

Download

Download the executable files used in this example:

 

Set-up procedure

1) Configuring Monitor one

First, it is necessary to create a "Shooter" in Monitor one that acts as the alarm trigger.

To create a "Shooter", follow these steps:

  • Right-click the icon of the desired Poseidon device.
  • In the pop-up menu, select "Define Shooter (manually)".
  • In the MIB browser, find and right-click the value you are interested in (in this example, it is the temperature represented by sensValue in the sensEntry tree), and select "Inspect".

  • Then, create a Shooter by right-clicking the "Shooters" area on the right-hand side and selecting "Add a Shooter".

  • Set the Shooter type to Threshold (the value in parentheses corresponds to the update interval in seconds), name the Shooter (e.g. Contact) and click "Save" to store it.

  • Select the new Shooter by clicking its icon, right-click "SensValue" in the right-hand MIB browser window and select "Add to the selected Shooter".

  • The "Instance" parameter is the last number in the SNMP address of the variable.
    Poseidon uses ".1" for the first sensor, ".3" for the third sensor.
  • A threshold value and an operator need to be specified for the monitored sensor (keep in mind that for a Poseidon, the sensValue variable contains the temperature in °C multiplied by 10).
  • After saving the Shooter by clicking the "Add/Modify" button, the MIB browser window may be closed.

2) Creating a script

Now, let us write a simple script that finds the device causing the alarm and closes the contact when appropriate.

Monitor one can pass several parameters to the script. In this case, we are interested in the IP address of the alarmed Poseidon device as well as in the error message text. The error message contains the name of the Shooter causing the alarm. We will use this name to filter the request.

The script can look like this:

@echo off
set IP=%1
set MESSAGE=%2
echo %MESSAGE% | find /C "Contact"
echo %ERRORLEVEL%
if %ERRORLEVEL% EQU 0 posdamio.exe -o 1=ON %IP%
goto eof
:eof

Save the script with a .cmd extension. The PosDamIO.exe file must reside in the same directory as the script; otherwise, the script will not work.

If you used a different Shooter name, replace the "Contact" string in the script with that name. For more information, see AN29: PosDamIO – Controlling outputs from the command line. The script can be modified to filter the alarms according to device name, or to close other contacts upon alarm from other Shooters.

3) Activating the Shooter in Monitor one

The last task is to enable script execution and start the Shooter for the given device.

  • Monitor one alarm behavior is configured in the Option -> Global Configuration menu. In the dialog, select the "Alerting" tab and check the "Execute a program or a script" box.

  • Click the "Customize" link. In the next dialog, select the script file (switch_on.cmd) and check the "4 IP address" and "5 Event Message" boxes.
  • Close the dialogs and return to the network map.

  • Left-click the Poseidon icon, switch to the "Background Shooters" tab, select and right-click the newly created Shooter, and select the "Start this Shooter..." option.

Conclusion:

Test the setup by creating an alarm situation on the configured sensor. After a short while, Poseidon will activate the output. The closing of the contact is indicated by an audible click and a LED lighting up (Poseidon 3268).

The script is called in every alarm situation. However, if the alarm description does not contain "Contact", the PosDamIO utility is not invoked and outputs remain unaffected.
The versatility of the solution can be enhanced with a suitable modification of the script, e.g. by controlling more contacts. However, such modifications are outside of the scope of this Application Note, which only suggests a way of approaching such tasks.

Note:

Besides the alarm start condition, Monitor one can react to an alarm end condition, too. This can be useful to reopen the closed contact.

  • The most important step is to configure Monitor One to inform about alarm end. This option is available in the Option -> Global Configuration menu. In the dialog, select the "Alerting" tab and check the "Enable Reverse alerting" box.
  • Then, the script needs to be modified accordingly. There are many ways of doing that, for instance the following one. Source file: Switch_on_adv.cmd.

    @echo off
    set IP=%1
    set MESSAGE=%2
    echo %MESSAGE% | find /C "normal"
    if %ERRORLEVEL% EQU 0 (call :SetOFF) else (call :SetON)
    goto eof
    :SetON
    echo %MESSAGE% | find /C "Contact"
    if %ERRORLEVEL% EQU 0 posdamio.exe -o 1=ON %IP%
    goto eof
    :SetOFF
    echo %MESSAGE% | find /C "Contact"
    if %ERRORLEVEL% EQU 0 posdamio.exe -o 1=OFF %IP%
    goto eof
    :eof

  •  

     Related products and links