SMS send with Gammu and USB Modem

Hello all

We have since a few weeks Checkmk (Raw Edition 2.1.0p19 on Ubuntu 22.04 LTS) and want to replace our existing Nagios3.

In Nagios3 we have SMS sending via Gammu and a USB modem (Huawei Surfstick E303).

Sending SMS works via console (echo “Hello recipient :)” | gammu sendsms TEXT 004179xxxyyzz).

Haven’t found any instructions/scripts on how exactly I teach checkmk to send SMS.

In Nagios we use this command:

# 'notify-host-by-gsm' command definition
define command{
	command_name notify-host-by-gsm
	command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$: Host - $HOSTNAME$ is $HOSTSTATE$ / Info: $HOSTOUTPUT$ / Date/Time: $LONGDATETIME$" | gammu sendsms TEXT $_CONTACTGSM$
	}

# 'notify-service-by-gsm' command definition
define command{
	command_name notify-service-by-gsm
	command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ / Info: $SERVICEOUTPUT$ / Date/Time: $LONGDATETIME$" | gammu sendsms TEXT $_CONTACTGSM$
	}

Will this easy work with Gammu or do you use another tool for sending SMS with a SIM Card in an USB Modem?

I created a new user attribute, because i used already Contactpager. The new attribute is called mobilephone. How can I use this?

Thanks for your help :sos: :slight_smile:
Florian

You would need to create your own notification plugin.

An example is the sms plugin which uses smssend to generate the SMS.

Put your own notification plugin in $OMD_ROOT/local/share/check_mk/notifications. After that you can select it in the dropdown of the notification rule.

If it is working build an extension package and publish it to the Exchange: https://exchange.chekcmk.com/

2 Likes

Thanks for you reply. I will check this.

I created a new user attribute, because i used already Contactpager. The new attribute is called mobilephone. Do you know how I can use this?

The attribute gets “translated” into a new env variable for the notification plugin script.

Use “env | sort > /tmp/notification.env” in your script to see them all.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.