Is your IoT node running?

If you test a new IoT node (or a Linux device in general) it is important to get some information whether the node runs stable or have problems.

The command uptime returns the time elapsed since last boot and some other information.

root@Omega-B2BB:/home# uptime
 23:34:53 up 4 days, 13:56, load average: 0.00, 0.00, 0.00

The uptime command gives a one line display of the following information.

  • The current time (23:34:53)
  • How long the system has been running (up 4 days)
  • The system load averages for the past 1, 5, and 15 minutes (0.00, 0.00, 0.00)

Here the Omega2+ has not a lot to do.

It’s not allways possible to contact that node directly for monitoring. To send the uptime result as a message is a good way to get this info.

My preferred way is to use Pushover messages but I had problem with sending the data by cURL. I have to wait for an answer from Onion’s community because this worked with an older firmware version.

But, to get this info yet I use Twitter direct messages. IFTTT acts as a gateway to twitter.ifttt

 

I use the Maker event to trigger sending a direct message to myself.

The configuration is quite simple. The event is named Uptime, what else?

After that we can specify the message content. I will send only one value with the complete uptime message inside.

To send the message from Omega2+ (or any other Linux device) I use a POST web request sent by cURL. The complete Shell script monitoring_update.sh looks as follows:

#!/bin/sh

uptime > UPT
MSG=`cat UPT`
echo -n Uptime:
echo "$MSG"

# Send data as Twitter direct message via IFTTT
curl --data "value1=$MSG" \
  https://maker.ifttt.com/trigger/Uptime/with/key/dy0QeH-N3Ezfa4Ilst-r4F

 

You can find the script at Github.

I placed the script in a crontab for calling it each hour. There is a second script which calls weather data each 15 minutes.

root@Omega-B2BB:/home# crontab -l
#
0 */1 * * * /home/monitoring_uptime.sh
*/15 * * * * /home/weather.sh
#

You can see the direct messages sent from my Omega2+ on my mobile phone.

tweet

 

 

Is your IoT node running?

2 thoughts on “Is your IoT node running?

Leave a comment