Page 1 of 1

SMS Server Tools 3 via cellular (USB)-dongle

Posted: Sat Mar 16, 2019 11:17 am
by donald24
When I installed my Nemslinux on the Raspi3, I had one main goal as a target: Monitoring my internet-connection, and sending SMS if it breaks down, obviously as it's the only communication back left in my home.
I thought about a separate UMTS/LTE-connection that the usb-dongle could also provide, but that would need a corresponding hosted monitoring service plus UMTS data - that surely will cost extra money, that I was not willing to pay.

The SMS-Server-Tools 3 are easy to install on NEMSlinux, a bit more difficult was it to configure the smstools to communicate with the dongle and to fiddle with the ttyusb0-comport always changing its ID on reboot, causing loss of communication. That was done by mapping the device-id to a symlink.

You will have to give the nagios-user permissions to create files under /var/spool/sms inherited, I just chose 777 for easygoing..

Then you would add two misccommand in nconf:

notify-host-by-sms

/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:$LONGDATETIME$\n" | /usr/local/bin/sendsms $CONTACTPAGER$ "** $NOTIFICATIONTYPE$ Host Alert:$HOSTNAME$ is $HOSTSTATE$ **"

notify-service-by-sms

/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:$LONGDATETIME$\n" | /usr/local/bin/sendsms $CONTACTPAGER$ "** $NOTIFICATIONTYPE$ Service Alert:$SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ **"

and then configuring your contact with the new notify-command and adding a phone-nr in the format +49170123465

That's it, I still have to find out, how  I check for a failed internet connection, I think about pinging three individual internet-ip-adresses, and when ALL three fail, trigger a "Internet-down-SMS". (if interconnecting switch not down, if router not down, if DSL-Modem not down, keeping a proper parenting dependency. Still have to properly implement that, but it's cool not to be dependant on a running internet line for that monitoring-notifications to work.

It would also be a good idea to put this into the standard NEMSlinux wouldn't it?

RE: SMS Server Tools 3 via cellular (USB)-dongle

Posted: Mon Mar 18, 2019 2:04 pm
by Robbie Ferguson
Agreed. I'd love to include support for this out of the box.

Can you share a link to a compatible dongle for me to have a look?

Thanks!

RE: SMS Server Tools 3 via cellular (USB)-dongle

Posted: Mon Mar 18, 2019 4:44 pm
by donald24
Oh, there a serveral sites discussing implementation of various hardware running with the smsservertools, their forum is a good source.
For my part I found out that Huaweii-dongles work well, that also counts thousand of their provider-branded models out there. 

There are also pure serial-based solutions you can buy, they have their own documented setup for the tools - but I don't like old serial stuff...

The dongle I use is a branded T-Mobile Huawei E3276.

You will need to configure this file with smstoolsservice:

Code: Select all

#
# /etc/smsd.conf
#
# Description: Main configuration file for the smsd
#

devices = GSM1
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/smstools/smsd.log
infofile = /var/run/smstools/smsd.working
pidfile = /var/run/smstools/smsd.pid
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent
stats = /var/log/smstools/smsd_stats
loglevel = 7


#[provider]

[GSM1]
device = /dev/tmobile_dongle
incoming = yes
outgoing = yes
memory_start = 1
sending_disabled = no


That "/dev/tmobile_dongle" is the symlink I've created, for making reboots possible without losing connection to the dongle (following the link in my OT)

It's a bit tricky to setup, and hard to automate for plugnplay, but having an SMS-gateway running on nagios is a great feature. You can also let incoming sms be parsed and execute scripts to powercycle the modem or router, possibilities are endless.


Cheers!