Page 1 of 2

NRPE: Unable to read output

Posted: Wed May 29, 2019 9:14 am
by olegus
Hello
trying to view sip registration status
I use plugin check_asterisk_sip_peers
Nagios server command line: /usr/lib/nagios/plugins/check_nrpe -H 192.168.111.220 -p 5666 -c check_asterisk_sip_peers
Exit: NRPE: Unable to read output

Remote servercommand line (local) : /usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
Exit:
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
OK: [email protected] (not active)

I'm not sure that the conclusion should be exactly that, but that is - that is. then I will understand
but I already broke my whole head up with the output on the server of Nagios

HELP!!))

Re: NRPE: Unable to read output

Posted: Wed May 29, 2019 4:41 pm
by scottwilkerson
can you execute this on the remote server?

Code: Select all

su nagios
/usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
did you get the plugin from here
https://exchange.nagios.org/directory/P ... rs/details

If so did you do this
This plugin calls the asterisk executable directly, so make sure that the user
executing this script has appropriate permissions! Usually the asterisk binary
can only be run by the asterisk user or root. To grant the nagios user
permissions to execute the script, try something like the following in your
/etc/sudoers file:
nagios ALL=(ALL) NOPASSWD: /path/to/plugins/directory/check_asterisk_peers
What does your command line in the nrpe.cfg look like? Is it prefixed with sudo?

Re: NRPE: Unable to read output

Posted: Thu May 30, 2019 3:04 am
by olegus
scottwilkerson wrote:can you execute this on the remote server?

Code: Select all

su nagios
/usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
"[root@freepbx home]# su nrpe
This account is currently not available."
user nrpe

did you get the plugin from here
https://exchange.nagios.org/directory/P ... rs/details

If so did you do this
This plugin calls the asterisk executable directly, so make sure that the user
executing this script has appropriate permissions! Usually the asterisk binary
can only be run by the asterisk user or root. To grant the nagios user
permissions to execute the script, try something like the following in your
/etc/sudoers file:
nagios ALL=(ALL) NOPASSWD: /path/to/plugins/directory/check_asterisk_peers
What does your command line in the nrpe.cfg look like? Is it prefixed with sudo?
#command[check_sip]=/usr/lib64/nagios/plugins/check_sip $ARG1$
command[check_asterisk_sip_peers]=sudo /usr/lib64/nagios/plugins/check_asterisk_sip_peers.sh $ARG1$
#command[check_asterisk_version]=/usr/lib64/nagios/plugins/nagisk.pl -c version

Re: NRPE: Unable to read output

Posted: Thu May 30, 2019 7:03 am
by scottwilkerson
Can you answer the rest of the questions?

Re: NRPE: Unable to read output

Posted: Fri May 31, 2019 1:43 am
by olegus
answered, but apparently the message did not pass.
I'll repeat now

Re: NRPE: Unable to read output

Posted: Fri May 31, 2019 1:51 am
by olegus
scottwilkerson wrote:can you execute this on the remote server?

Code: Select all

su nagios
/usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
for some reason(user nrpe)
[root@freepbx home]# su nrpe
This account is currently not available.

did you get the plugin from here
https://exchange.nagios.org/directory/P ... rs/details

If so did you do this
This plugin calls the asterisk executable directly, so make sure that the user
executing this script has appropriate permissions! Usually the asterisk binary
can only be run by the asterisk user or root. To grant the nagios user
permissions to execute the script, try something like the following in your
/etc/sudoers file:
nagios ALL=(ALL) NOPASSWD: /path/to/plugins/directory/check_asterisk_peers
file path in sudoers registered
User_Alias NRPE = nagios,nagcmd
Cmnd_Alias NRPECOMMANDS = /sbin/service
Default:NRPE !requiretty
NRPE ALL=(ALL) NOPASSWD: NRPECOMMANDS
nrpe ALL=(ALL)NOPASSWD: /usr/lib64/nagios/plugins/check_asterisk_peers

What does your command line in the nrpe.cfg look like? Is it prefixed with sudo?
#command[check_sip]=/usr/lib64/nagios/plugins/check_sip $ARG1$
command[check_asterisk_sip_peers]=sudo /usr/lib64/nagios/plugins/check_asterisk_sip_peers.sh $ARG1$
#command[check_asterisk_version]=/usr/lib64/nagios/plugins/nagisk.pl -c version

Re: NRPE: Unable to read output

Posted: Fri May 31, 2019 6:40 am
by scottwilkerson
Your command in nrpe is

Code: Select all

/usr/lib64/nagios/plugins/check_asterisk_sip_peers.sh
but in sudoers is

Code: Select all

nrpe ALL=(ALL)NOPASSWD: /usr/lib64/nagios/plugins/check_asterisk_peers
change this to

Code: Select all

nrpe ALL=(ALL)NOPASSWD: /usr/lib64/nagios/plugins/check_asterisk_sip_peers.sh

Re: NRPE: Unable to read output

Posted: Fri May 31, 2019 9:05 am
by olegus
change

root@icingadeb:/home/adman# /usr/lib/nagios/plugins/check_nrpe -H 192.168.111.34 -c check_asterisk_sip_peers
connect to address 192.168.111.34 port 5666: Connection refused
connect to host 192.168.111.34 port 5666: Connection refused

lokal

[root@freepbx ~]# /usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
OK: [email protected] (not active)

Re: NRPE: Unable to read output

Posted: Fri May 31, 2019 10:37 am
by scottwilkerson
olegus wrote:root@icingadeb:/home/adman# /usr/lib/nagios/plugins/check_nrpe -H 192.168.111.34 -c check_asterisk_sip_peers
connect to address 192.168.111.34 port 5666: Connection refused
connect to host 192.168.111.34 port 5666: Connection refused
this looks like NRPE might not be running on the client
olegus wrote:[root@freepbx ~]# /usr/lib64/nagios/plugins/check_asterisk_sip_peers -r [email protected] --verify-registrations
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
cat: sip_general_additional.conf: No such file or directory
cat: sip_general_custom.conf: No such file or directory
cat: sip_nat.conf: No such file or directory
cat: sip_registrations_custom.conf: No such file or directory
cat: sip_registrations.conf: No such file or directory
cat: sip_custom.conf: No such file or directory
cat: sip_additional.conf: No such file or directory
cat: sip_custom_post.conf: No such file or directory
OK: [email protected] (not active)
I am not familiar with the plugin so you may want to reach out to the author (listed at the top of the plugin) but I did look at the code and it is trying to bring in config files from

Code: Select all

/etc/asterisk/sip.conf
What is in that file? Does it have correct paths to these sip_* files? Because the error implies it cannot find them....

Code: Select all

cat /etc/asterisk/sip.conf

Re: NRPE: Unable to read output

Posted: Fri Jun 14, 2019 2:53 am
by olegus
I apologize for such a long response
contacted the developer, he does not remember anything about this plugin

found the file /etc/asterisk/@sip.conf.
fixed in the plugin code by adding @

cat: /etc/asterisk/@sip.conf: No such file or directory
cat: /etc/asterisk/@sip.conf: No such file or directory
OK: [email protected] (not active)

added file permission
the picture is the same