# Nagios check\_asterisk\_channels monitoring plugin

**URL:** <https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972>\
**Category:** Asterisk Support\
**Created:** [July 27, 2012, 7:34pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972 "2012-07-27T19:34:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [July 27, 2012, 7:34pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/1 "2012-07-27T19:34:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [July 28, 2012, 9:01am UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/2 "2012-07-28T09:01:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ianplain](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ianplain/32/1776_2.png) [@ianplain](https://community.asterisk.org/u/ianplain)\
**Post date:** [July 30, 2012, 10:53pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/3 "2012-07-30T22:53:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kamranferoz](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kamranferoz](https://community.asterisk.org/u/kamranferoz)\
**Post date:** [December 1, 2021, 10:46am UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/4 "2021-12-01T10:46:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sedwards](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sedwards](https://community.asterisk.org/u/sedwards)\
**Post date:** [December 1, 2021, 4:33pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/5 "2021-12-01T16:33:19Z")

</div>

> [@kamranferoz](#):
>
> chmod 777 asterisk.ctl

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](https://support.digium.com/s/article/How-to-use-an-Asterisk-callfile), cough. (Reported 6 months ago, never touched. [Case: 00887344](https://support.digium.com/community/s/case/5002E00001nqg8fQAA/error-on-web-page))

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [December 1, 2021, 4:39pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/6 "2021-12-01T16:39:26Z")

</div>

> [@sedwards](#):
>
> Think of the impact of ‘!rm --farce --recursive /’ on your continued employment.

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.

---

<div class="post-metadata">

**Author:** ![sedwards](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sedwards](https://community.asterisk.org/u/sedwards)\
**Post date:** [December 1, 2021, 5:51pm UTC](https://community.asterisk.org/t/nagios-check-asterisk-channels-monitoring-plugin/39972/7 "2021-12-01T17:51:49Z")

</div>

> [@david551](#):
>
> I’m pretty sure that the ! is processed locally in rasterisk (aserisk -r) and not forwarded to the daemon.

Confirmed.

```auto
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

```
