Twitter

PowerTXT alerts via Twilio and Node Red into Zabbix (Part 2)

Created on Sunday, 15 July 2018 14:47 | Written by Richard Gate | Hits: 155

The project (see here) has moved on from a proof of concept to live now. The original Node.Red flow has been updated to delete the original Twilio message after having passed it on to Zabbix. A new flow has been added to accept requests from Zabbix to send PowerTXT commands via Twilio and a small flow has been created to allow Zabbix to check that Node.Red is up and running ok.

The original inbound SMS Node.Red flow now has the extra steps (at the bottom) which check if the message was sent to Zabbix ok and if so builds the command to send via the Twilio API to delete the original message from Twilio.

A new Node.Red flow has been added to accept requests from Zabbix and then send PowerTXT commands. In Zabbix, the requests are created by a Zabbix script that uses wget to send the request, which includes the Zabbix hostname (in the for sms_44nnnnnnnnn where nnnnnnnnn is the mobile number without the leading zero) and a command to perform (register, on, off or query). The flow verifies the request has originated from localhost and checks that the hostname and command parameters have been supplied. The symbolic command names are then translated into PowerTXT commands (e.g. #07# for query) and passed into a step that builds the request for Twilio. The request is sent and the reply from Twilio examined to see if the message was sent or not, the result of this test is used to pass a status back to the Zabbix script that originally requested the message be sent.

Finally a short Node.Red flow was added to that Zabbix can send a web request that is replied to with "OK" so Zabbix can check that Node.Red is running ok. This flow also checked that request originated from localhost.