Notifications Telegram: Pandora FMS
This post is also available in : Spanish
Notifications via Telegram: Pandora FMS’ integration
What could be faster than an instant message, from one of the most popular messaging services of the moment? The service is Telegram, and the present article is about its incorporation into the alert system of Pandora FMS.
In situations where we need to know as soon as possible whether there’s a problem, such as in manufacturing or production, security, or where strategic resources are concerned, the integration of Telegram with Pandora FMS is a godsend, responding as it does at the speed required to allow us to take the necessary action and supplying information regarding the location in our network, and the cause, of the incident. All thanks to Pandora FMS’s system of alerts and macros.
Likewise, being an instant messaging service means technicians, managers and backup support staff can be relied upon to have exactly the information they need about when and where the incident is taking place, even without access to a PC or email.
Let me walk you through configuring a monitoring system in order to send alerts via Telegram the moment a problem is detected. Easily done, thanks to the practicality of command lines available for Telegram and telegram-cli and to Pandora FMS’s flexible alert system.
Firstly, the necessary prerequisites are:
- Pandora FMS running on Linux (in this case, using CentOS, recommended by the manufacturer).
- Telegram-cli installed on the system Linux CentOS.
- A Telegram account to send the alert messages.
Install Telegram’s management interface using the telegram-cli command line:
Open the Telegram account from where you’re going to send the alert messages.
Execute telegram-cli and enter the complete number (including the dialing code, e.g. +1 for United States). Once you’re in, execute help to get a global view of the options and to start using them.
What you’re interested in this time is sending messages by phone, via a single command, with everything integrating nicely into Pandora FMS. Launch the following call:
telegram-cli –W –e “msg Contactname Body message”
As you can see, the format consists of a call to the Telegram utility, with the arguments -W -e and between double quotation marks, msg plus the name of the contact or group to whom you wish to send the message (substitute underscores for the spaces in the example message), and the body of the message or plain text that you wish to send. In the following example, the following is an example of a generic message to a group, Operators chat (sic):
telegram-cli –W –e “msg Operators_chat Alert fired on your systems.”
Check that the message has been sent and then go to Pandora FMS and configure the alert you’re going to use to inform about incidents.
If you have any questions about Pandora FMS’s alert system, take a look at the official documentation:https://pandorafms.com/manual/en/documentation/04_using/01_alerts
Firstly, add the corresponding command in the section Alerts-> Commands focusing especially on son Command, 1 field description, 1 field values, 2 field description, 2 field values. The first two fields are substituted for specific information from Action.
Now configure the action, which uses the Telegram command message you already wrote, and specify the default addressee plus the message content. You want your message to be of use to the addressee in solving the incident, and you can achieve this by using Pandora FMS’s incorporated macro system.
Knowing how Pandora FMS’s alerts system and scalability options work means you can create different actions in order to send messages to different addresses, groups or individuals depending on the specific situation. In other words, you’d create a message similar to the one above, using the same command -> Telegram message, but modifying the content in the Telegram contact field and creating a new alert you can associate this new action in function of the number of times you have an alert and thereby create an automated scaled system.
Now all you have to do is associate the new action with the duo template-module. The template is the component where you specify the alert trigger conditions and the module the diagnostic you alert in case of a fail.
If you’ve configured everything correctly, alerts are triggered and the corresponding message sent to the designated Telegram user or group (in this case, Operators chat)
If you’re using scalability for alerts, the action can vary in function of how many times the alert situation is consecutively repeated.
The command line tool telegram-cli offers many other possibilities, so, now you know how to integrate it with Pandora FMS, the only limits are your needs and your imagination.
You can directly download the Telegram-cli from Pandora FMS library here.
El equipo de redacción de Pandora FMS está formado por un conjunto de escritores y profesionales de las TI con una cosa en común: su pasión por la monitorización de sistemas informáticos.
Pandora FMS’s editorial team is made up of a group of writers and IT professionals with one thing in common: their passion for computer system monitoring.