Asterisk application state tracking

Librenms is successfully monitoring Asterisk statistics via SNMP extend. I’m trying to set an alert based on whether the service is running or not. I’ve tried app_state but it always reports OK even when the service isn’t running.

Any suggestions very much appreciated!

Many thanks.

I think all of the applications support the application_metrics table, you could query data there to alert on.

Also, random tip, whether or not you understand code, often looking at the source code will give you a lot of insights.

Thank you @murrant. Unfortunately I can’t see anything in there for Asterisk that I can look at for service state. Is there something I can add to the SNMP extension and then the NMS application to support this?

If there is no metric for “service state” how would you expect it to be reported anywhere?

Couldn’t you just validate the metrics against some numbers you expect?

‘calls’ => $asterisk[‘Calls’],
‘channels’ => $asterisk[‘Channels’],
‘sipeers’ => $asterisk[‘SipPeers’],
‘sipmononline’ => $asterisk[‘SipMonOnline’],
‘sipmonoffline’ => $asterisk[‘SipMonOffline’],
‘sipunmononline’ => $asterisk[‘SipUnMonOnline’],
‘sipunmonoffline’ => $asterisk[‘SipUnMonOffline’]

It’s more the poller I’m interested in. I’d like to know if the SNMP extend request doesn’t report back correctly etc.

Currently, if I stop Asterisk, I get this in the SNMP response: “Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)” but LibreNMS keeps the previous values for all the items you listed and so I can’t check for sipeeps = 0 or similar.