October 15, 2021

SIGNL4, automated alerting with free mobile app

I'm involved in several projects where you, as quick as possible, want to get an alert if anything fails. After a lot of Googling I found SIGNL4.

They have several ways to create an alert, can involve a team, have a nice app and is free, up to 5 users, if you use the "STARTER" option.

In this post, as an example, I will show how I detect if my AIS receiver/dispatcher stops receiving AIS targets, sent to Vesselfinder, and how an alert is forwarded to the SIGNL4 app.

I'm using NodeRed on a Raspberry Pi to realize the function

NodeRed logic
I created a rough flow which is quite simple 
  • The inject node creates a transaction every second with "payload = "clock"". 
  • The dispatcher sends the NMEA 0183 messages out as UDP at port 5697 and they are received at the UDP in node.
  • Both data is feed into the function node with the JS code as below.
  • If the set "timeoutTime" is reached a message is sent to SIGNL4, an alert is created and the team are notified via the SIGNL4 app.
Function node code

let timeoutTime = 3600 // Max seconds before a missing AIS message is reported
if (msg.payload == "clock"){ // "clock" transaction => add to timeoutTimer
timeoutTimerValue = flow.get('timeoutTimer') + 1;
flow.set('timeoutTimer', timeoutTimerValue)
// Show timeoutTimerValue
node.status({fill:"green",shape:"dot",text:"Timeout timer " + timeoutTimerValue});
// Save the longest time between AIS messages
timeoutTimerMaxValue = flow.get('timeoutTimerMax');
if (timeoutTimerValue > timeoutTimerMaxValue){
flow.set('timeoutTimerMax', timeoutTimerValue);
}
// No AIS message received within "timeoutTime" => Send Signl4 msg
if (timeoutTimerValue >= timeoutTime){
flow.set('timeoutTimer', 0);
msg.payload = {
'Subject': 'No AIS info received in one hour',
'X-S4-Service': "IT"
};
return msg;
}
else {
return null;
}
} else { // AIS transaction => reset timeoutTimer
flow.set('timeoutTimer', 0);
return null;
}
return msg;

Quick explanation
The "clock" transaction is adding to the "timeoutTimer" and if a NMEA AIS transaction is received the "timeoutTimer" is reset to "0", zero.

If no NMEA AIS transaction is received within the stipulated "timeoutTime" a message is sent to SIGNAL4.

To get an idea of how often a AIS message is received i store the max value, between received AIS messages, in "timeoutTimerMax".

Flow

Conclusion
The SIGNAL4 solution is a very nice way to handle deviations and I use it for example  detecting;
  • The weather station stops reporting
  • High wind speed
  • Time for Kite surfing ? Average wind have been over 7 m/s for 30 minutes.
  • Internet speed alert
  • Checking servers with "ping"
  • and so on....

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !