Logically, this article is a continuation of the article "Example of Monitoring a Server Room on a Basis of OpenNMS and NetPing Devices". Within this article, a feature of configuring SMS notifications from OpenNMS using NetPing SMS (SMS gateway for OpenNMS) will be regarded.
When network engineers and administrators work, they often need to receive notifications in any time seven days a week. What communication means can be more suitable for this than SMS? Using external SMS services critically depends on the Internet connection, but what to do if there is a need to receive notifications about Internet connection failure? USB GSM modems could solve this issue but their operation stability and often level of support are not the best. There are very few modems that can boast working 24/7 without external maintenance (manual checking, scripts or other means). In addition, it must be connected to a server or a PC for operation. In turn, this server or PC will work as an SMS gateway, which is not the simplest and not the most reliable scheme. A proper solution in this situation would be the use of NetPing SMS. It is a standalone device that is connected to the Ethernet network and working as an SMS gateway for any monitoring system, service, or any other system. In addition, it has no disadvantages described above because it works independently as it does not need an Internet connection and a computer for the operation, and the 24/7 operation is implied.
This article suggests that you have already installed and configured the OpenNMS monitoring system and it works correctly. A configuring process of Open NMS monitoring system has been described before.
Configuring NetPing SMS Gateway for the Operation with the Monitoring System OpenNMS
The first and the most important step of the configuration is a network configuration and access restriction configuration, which is also minimally sufficient. To do this, go to the page "SETUP" (1) of a web-interface:
- IP address of a device - 192.168.0.218 (according to a network configuration);
- Subnet mask - 255.255.255.0 (according to a network configuration);
- Gateway - 192.168.0.1 (according to a network configuration, but not obligatory when OpenNMS and NetPing SMS are in the same subnet, in this case, they do not need a gateway);
- DNS server - 184.108.40.206 (DNS is not needed for this solution as soon as a device will not address external services);
- HTTP server port - 80 (on default, the script uses URL-encoded commands in this solution when it addresses a web server of a device);
- SNMP agent port - 161 (on default)
Access Restriction (3):
- Username - visor (on default, the script will address a device using a pair login/password of a web interface);
- Password - ping (on default, the script will address a device using a pair login/password of a web interface);
- Community read and write - SWITCH (on default, it is irrelevant for this solution);
- IP access filter and IP access subnet - 192.168.0.49, 255.255.255.255 (it is highly recommended to configure it for specific needs with the aim to restrict access of the third-party individuals to sending SMS notifications);
More detailed information about a basic configuration is given in the official documentation.
In addition, for proper operation of a built-in GSM modem for sending SMS notifications, make sure that the antenna is plugged to NetPing SMS and a signal strength is acceptable (a signal strength 50% and lower is highly undesirable). TO check the signal strength, there is a need to go to the page "GSM SETUP" (1), click the button "Request Status" (2) in the section "GSM Status", and in some time, a current signal strength will appear (3).
Adding a Notification Method Using NetPing SMS Gateway to the OpenNMS Monitoring System
To configure SMS notifications from OpenNMS through the NetPing SMS gateway, the first thing to do is to indicate how the monitoring system will communicate with the gateway. To do this, there is a need to add a notification method, using which OpenNMS will call an independent script and send parameters to it. Let's start with the script:
Create a file in the location that is convenient for you, for example:
Make it executable:
chmod +x /etc/opennms/scripts/sendsms.sh
And insert the next content:
curl --user visor:ping --data "[$1] $2" http://192.168.0.218/sendsms.cgi?utf8
And, let's install a package that is necessary for the operation:
apt-get install curl
Then, there is a need to add a notification method. To do this, add the next section in the end of the file /etc/opennms/notificationCommands.xml:
And, let's associate this command with a delivery way. To do this, add the next section to the file /etc/opennms/destinationPaths.xml:
More information about configuring notifications for OpenNMS is described in the official documentation. At this point, the work in the console is over, and it is possible to switch to a web interface.
Examples of Configuring Notifications on Certain Events in OpenNMS Using NetPing SMS Gateway
To configure SMS notifications for certain events, there is a need to go to the administering interface of OpenNMS. To do this, go to Configure OpenNMS (1) → Configure Notifications (2):
Then to Configure Event Notifications:
And see the next view:
Example 1. SMS notification on receiving SNMP TRAP notification about changing a logic level of an IO line on the example of UniPing server solution v3/SMS
To add a new notification about the event, click "Add New Event Notification":
Then, there is a need to choose the event.
For your conveniency, let's use the search option (1). Among the events that are found, select the incoming SNMP TRAP on IO line (2) and move next (3).
The next configuration menu item offers to set a node (host) filter for processing events. Within this article, we will not discuss this, and leave this on default (process from everything) and move next. If there is a need to do a fine tuning, it is better to address the official documentation.
Now we see main notification parameters as follows:
- Enter a notification name - npIoTrap notification;
- Its description - Io Trap from NetPing;
- Notification path that was added by us before, in the console - SMS-Admin;
- Specify the notification text (supports inserting values from the event that triggered this notification);
- Memo on possible values;
- Finish - complete configuration.
Then, we get back to the list of all notifications. Our newly created one is among them too.
Example 2. SMS notification on the unavailability of any service of any node
In the default notification list, there is already a notification on the event "nodeLostService", therefore there is no need to create a new one. Let's edit the existing one. To do this, click "Edit".
We will see steps for choosing the event and a filter, we skip the step, leaving everything as it is, and go to the notification parameters at once. Select a notification path "SMS-Admin" (1) - and complete the configuration (2).
At this point, SMS notificaitons are configured. When specified events take place (in addition, restoring the service operation from the example № 2), we will receive the notifications of the next view:
NetPing SMS is not the only device that can work as an SMS gateway for the monitoring systems. Using UniPing server solution v4/SMS and NetPing 8/PWR-220 v4/SMS, it is also possible to send notifications using external scripts. More information about this can be read in the documentation for UniPing server solution v4/SMS and NetPing 8/PWR-220 v4/SMS.
For a full-fledged monitoring of crucial systems, it is vitally important to use all available notification methods for accidents. SMS notifications are one of the priorities because they are not dependent on the infrastructure status of the enterprise, and mobile phones have become an integral part of the daily life long ago, and are at hand even during off hours, which allows receiving notifications instantly and act correspondingly.