You can of course use your SMS Gateway to send alarms from Centreon via SMS.

For this purpose, you first need the script sendsms.pl. Download it and place it on your Centreon server in the /usr/local/bin/ directory.
The script requires the following Perl modules:

  • LWP::UserAgent
  • URI::Escape
  • Text::Icon

In the next step commands must now be configured for the SMS configuration in Centreon. Corresponding contacts must also be created.

Example: Definition for text message notifications

Navigate in the Centreon web interface: Configuration - Commands - Notifications
Add a command notify-host-by-sms:

/usr/local/bin/sendsms.pl $CONTACTPAGER$ "$NOTIFICATIONTYPE$ - Host $HOSTALIAS$ is $HOSTSTATE$ since $SHORTDATETIME$ info: $HOSTOUTPUT$"


Add a further command notify-service-by-sms:

/usr/local/bin/sendsms.pl $CONTACTPAGER$ "$NOTIFICATIONTYPE$ - $SERVICEDESC$ on $HOSTNAME$ state: $SERVICESTATE$ since $SHORTDATETIME$ info: $SERVICEOUTPUT$"


 

Example: Creating a contact for SMS notifications

Navigate in the Centreon web interface: Configuration - Users
Add a contact:


HTTPS

The script sendsms sends the alarm to the SMS Gateway. As standard this communication takes place without encryption.
You can alter this behaviour in line 43 by converting the request to HTTPS:

my $response = $lwp->get('https://'.$smsgw_host.':'.$smsgw_sendsms_port.$smsgw_sendsms_path.'?username='.$smsgw_username.'&password='.$smsgw_password.'&to='.$recipient.'&text='.$message);


If the SSL certificate set up in the SMS Gateway is a self-signed certificate, an error message may occur: Can't connect to ... (certificate verify failed)
In this case, add the following code in line 35:

$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;