Categories
Asterisk Support Knowledge Base

Nagios check_asterisk change for Asterisk 13

We noticed to day after a Asterisk server upgrade the Nagios check_asterisk plugin we use was reporting a”unknown”

It seems there is a minor change in response to the status request.

It was:

[root@elastix24 ~]# ./check_asterisk -h 127.0.0.1 -m mgr -u user -p secret  -vvvv
Running in Manager mode
Connecting to 127.0.0.1:5038
Connected to 127.0.0.1:5038
Asterisk Call Manager/1.1
Action: Login
Username: user
Secret: secret

Response: Success
Message: Authentication accepted
Action: Status

Response: Success
Message: Channel status will follow

Event: StatusComplete
OK  (idle) 

Its now with ami 2.7

[root@aubpbx1 ~]# ./check_asterisk -h 127.0.0.1 -m mgr -u user -p secret -vvvv
Running in Manager mode
Connecting to 127.0.0.1:5038
Connected to 127.0.0.1:5038
Asterisk Call Manager/2.7.0
Action: Login
Username: user
Secret: secret

Response: Success
Message: Authentication accepted

Action: Status
Response: Success

EventList: start
Message: Channel status will follow

Event: StatusComplete
OK  (idle)

So the plugin code need a small change to reflect this

diff check_asterisk check_asterisk_old 
162,163c162,163
< &unknown("Unknown answer $response (wanted Message: something)") unless ($message =~ m/^EventList:\s+(.*)$/i);
< &unknown("didn't understand message $message") unless ($1 =~ m/start/i);
---
> &unknown("Unknown answer $response (wanted Message: something)") unless ($message =~ m/^Message:\s+(.*)$/i);
> &unknown("didn't understand message $message") unless ($1 =~ m/Channel status will follow/i);

Once this is made seems to be reporting OK.