NRPE: Unable to read output

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

NRPE: Unable to read output

Post 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!!))
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

Re: NRPE: Unable to read output

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output

Post by scottwilkerson »

Can you answer the rest of the questions?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

Re: NRPE: Unable to read output

Post by olegus »

answered, but apparently the message did not pass.
I'll repeat now
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

Re: NRPE: Unable to read output

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

Re: NRPE: Unable to read output

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
olegus
Posts: 9
Joined: Tue Feb 05, 2019 3:05 am

Re: NRPE: Unable to read output

Post 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
Locked