Nagios check_asterisk_channels monitoring plugin

i have installed nagioscore 3.2.3 and and i have installed nrpe addon on the asterisk server. i have downloaded the check_asterisk_channels . and did the rest of the things how we used to monitor the remote host.

Now the issue on remote host i am not able the run the pluggin in nagios user. saying error like

[nagios@centos6 ~]$ /usr/local/nagios/libexec/check_asterisk_channels
CRITICAL: Unable to connect to remote asterisk (does /var/run/asterisk/asteriskctl exist?)

but the file is there . if i run in root the check_asterisk_channels is working fine . Not able to run on nagios users.
give the some solutions those who got the solution.
my download plugin uder /usr/local/nagios/libexec/check_asterisk_channels
thanks for those who give solution to this issue

The general forum is not a support forum.

I would be surprised if anyone here was using that plugin.

However the diagnostic suggests that you are having permissions problems with “asterisk -r”. I’ve never run asterisk -r as any other user than the main Asterisk server, but, to be honest, I think it could be a security issue if it actually worked.

If it is supposed to work, I would look at directory permissions and SELinux settings.

Hi

Looking at the plugin its a bit of a nasty way of doing this, Much better to use on that connects to Asterisk via the manager interface and gets this information than one doing “asterisk -rx”

also if the box is remote npre over the internet is a little bit insecure.

I got the same issue with Nagios. The message says as “Unable to connect to asterisk.ctl, the file doesn’t exist”. After locating the file in the system (asterisk.ctl), follow the following steps and it worked;

chmod 777 asterisk.ctl
asterisk -rvvv
dialplan reload
SIP reload

This is like giving your parents access to your house by removing the front door.

Anybody ‘walking by’ can issue commands to Asterisk, including executing a shell as the user executing Asterisk (frequently root). Think of the impact of ‘!rm --farce --recursive /’ on your continued employment.

You may say ‘but nobody has access to the box but me’ but that may change in the future.

Anytime you see “777” think “I don’t understand Unix ownership and permissions sufficiently.” – Cough, How to use an Asterisk callfile, cough. (Reported 6 months ago, never touched. Case: 00887344)

Although it definitely irritates me when people use chmod 777 as the panacea for all protection issues, I’m pretty sure that the ! is processed locally in rasterisk (aserisk -r) and not forwarded to the daemon.

Incidentally, some programs will refuse to use files with excessive permissions or files in directories with excessive permissions, so chmod 777 can actually break things.

Confirmed.

pbx10:newline:09:44:42> !
root@pbx10:/home/sedwards# echo $$
5135
root@pbx10:/home/sedwards# ps -f -q 5135
UID        PID  PPID  C STIME TTY          TIME CMD
root      5135  5134  0 09:44 pts/0    00:00:00 /bin/bash
root@pbx10:/home/sedwards# ps -f -q 5131
UID        PID  PPID  C STIME TTY          TIME CMD
root      5131  5130  0 09:44 pts/0    00:00:00 rasterisk asterisk -d -d -d -d -d -d -r -v -v -v -v -v -v