Hardware configuration for SMS sending
About the GSM device
A special GSM device is used to send SMS through a serial port (USB). You may use either another similar GSM model, or a cell phone with USB or serial connection. The device used here is a MTX 65 v3. It is a very small and GNU/Linux compatible device, which has different optional components such as an external GSM antenna for greater signal coverage.
Device installation
The first step is to install the hardware device. This device consists of the following parts:
- Standard USB cable, with a small connector and a lock.
- Power supply. In this example it is the European 220 volts, if you live in America (except Chile) make sure that the power supply is for 110 or 120 volts.
- SIM card.
- Pandora FMS SMS gateway device.
Procedure:
- Open Pandora FMS SMS gateway device.
- Place the SIM card inside.
- Connect to the network at the socket labeled power, insert the USB cable into the SMS gateway device.
- Connect the other end to Pandora FMS server using a standard USB port.
- When you connect the device to the server, wait a few seconds and launch the dmesg command from the command line. You should see something similar to this screen:
- This means that the device has been recognized by the kernel and is ready to accept commands on a device such as
/dev/ttyACM0
.
If there is a problem, check all the steps and make sure that:
- The device is connected and the cable is flashing green.
- The device is connected to the USB port, on both sides of the cable, one side with the SMS device and the other with Pandora FMS host server.
- The device has a SIM card inside, and the SIM card is properly inserted.
Configuring SMSTools to use the new device
This device is managed by a software package called SMSTools. You may install SMSTools using the package provided by your chosen GNU/Linux distribution or use the RPM package (Red Hat Package Manager or RPM Package Manager ) provided by PFMS.
RPM-based systems
To use the RPM provided by PFMS just install it with the following command:
rpm -i smstools*.rpm
Configurar SMStools
Edit with the user root, or equivalent, the base configuration file with a text editor (Vi is used here):
vi /etc/smsd.conf
The following contents have to be added (if the output or result of the dmesg command differs from ttyACMO
, use the device tty
detected by your system):
# Example smsd.conf. Read the manual for a description devices = GSM1 logfile = /var/log/smsd.log loglevel = 10 [GSM1] device = /dev/ttyACM0 incoming = no pin =
On the last line, enter the PIN assigned to the SIM used.
Then smstools must be started manually:
/usr/bin/smstools start
You may now send a test SMS with a user other than root (34
is the international code for Spain, fill in the asterisks with the test phone number):
sendsms 34******** "Pandora FMS rocks"
After a minute of waiting, monitor the logs to make sure that everything is correct. The SMS should be received within a few seconds. Depending on the network, the first SMS may be checked every 10 to 20 seconds, the next SMS should be almost immediate. SMSTools uses a queue to send messages, so you may send as many messages as needed, and they will be broadcasted when the cell phone network can handle them.
To see logs:
cat /var/log/smsd.log
Finally, some tasks to secure this operation for the future:
- Set
1
for loglevel in/etc/smsd.conf
to avoid an excessively large and unnecessary log file. - Make sure smsd is configured to start automatically when the system reboots (this implies a link from
/etc/init.d/sms
to/etc/rc2.d/S90sms
or/etc/rc.d/rc2.d/S90sms
). If you installed it from a package, it probably already exists on the system, it will be a matter of checking it.
Configure the Alert in Pandora FMS
For more information see “Alert system in Pandora FMS”.
- First the alert command must be created:
- And then create the alert action:
The action is associated to a module using a previous alert template. In this case, the alert template will be triggered when the module status is CRITICAL.