LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-17-2018, 05:47 AM   #1
seddik
Member
 
Registered: Mar 2018
Location: france
Distribution: CENTOS,,DEBIAN,,UBUNTU,,ARCHLINUX,,RHEL
Posts: 33

Rep: Reputation: Disabled
[nagios] error NRPE: Unable to read output


Hi team

I have nagios server installed on linux server (centos 6) , and all communications with nrpe clients are done .
To monitor free memory usage of (RAM),I created script perl to do this .
You can see below the result of script's execution

Code:
bash-4.1# ./check_mem -f -w 20 -c 10
CRITICAL - 9.7% (183684 kB) free!|TOTAL=1902800KB;;;; USED=1719116KB;1522240;1712520;; FREE=183684KB;;;; CACHES=458376KB;;;;
Note that the configuration on server and client is :

==> Nagios_server
commands.cfg

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -u -c $ARG1$
}

service.cfg

define service{
use generic-service
host_name XXXXXXX
service_description Free Memory
check_command check_nrpe!check_mem
}

==> Nrpe client

command[check_mem]=/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10


Problem : when it's executed remotly i got this error (its the same on web interface and CLI ):
Code:
NRPE: Unable to read output
Normally the nagios server know how to execute the check remotly and configuration semms correct .

Thank you in advance

Best Regards

Seddik Alaoui

Last edited by seddik; 07-17-2018 at 03:11 PM.
 
Old 07-18-2018, 12:27 AM   #2
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,768

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
Can you switch to the user that runs nrpe and manually run the command
Code:
/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10
?
Anything from nrpe in /var/log/messages?

Last edited by MadeInGermany; 07-18-2018 at 12:32 AM.
 
Old 07-18-2018, 04:15 AM   #3
seddik
Member
 
Registered: Mar 2018
Location: france
Distribution: CENTOS,,DEBIAN,,UBUNTU,,ARCHLINUX,,RHEL
Posts: 33

Original Poster
Rep: Reputation: Disabled
I have run the command on clients with user nagios and the result semms good , but it doesn't store anything on file log .

Here i post the content of configurations file

==> nrpe.cfg (client_server)

The nrpe.cfg is on directory /etc/nagios , and the owner is nagios .I think thats correct .
All plugins on clients have the same owner , it's nagios user
Note that nrpe has run with nrpe user
Code:
nrpe      3305  0.0  0.0  41496  1344 ?        Ss   Jul17   0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
==> Nagios server
Also the current configurations files of daemon are owned by nagios user.


Thanks in advance
Attached Files
File Type: txt nrpe.txt (13.2 KB, 242 views)
 
Old 07-18-2018, 06:02 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,768

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
Do other nrpe commands work, like check_total (instead of check_mem)?
 
Old 07-18-2018, 06:12 AM   #5
seddik
Member
 
Registered: Mar 2018
Location: france
Distribution: CENTOS,,DEBIAN,,UBUNTU,,ARCHLINUX,,RHEL
Posts: 33

Original Poster
Rep: Reputation: Disabled
Yes , it worked successfully and you can see that result from nagios server

Code:
/usr/local/nagios/libexec/check_nrpe -H 10.114.19.191 -c check_http
HTTP OK: HTTP/1.1 200 OK - 252 bytes in 0.002 second response time |time=0.001569s;;;0.000000 size=252B;;;0

Last edited by seddik; 07-18-2018 at 06:14 AM.
 
Old 07-18-2018, 10:24 AM   #6
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,768

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
You can trace what the nrpe runs
Code:
strace -f -s 128 -e execve -p `pgrep -ox nrpe`
And see how your check runs.
 
2 members found this post helpful.
Old 07-19-2018, 03:57 AM   #7
seddik
Member
 
Registered: Mar 2018
Location: france
Distribution: CENTOS,,DEBIAN,,UBUNTU,,ARCHLINUX,,RHEL
Posts: 33

Original Poster
Rep: Reputation: Disabled
You can see below the result of command from client

Code:
[pid  8502] +++ exited with 0 +++
[pid  3305] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8502, si_status=0, si_utime=0, si_stime=0} ---
Process 8504 attached
Process 8505 attached
[pid  8505] execve("/bin/sh", ["sh", "-c", "/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10"], [/* 8 vars */]) = 0
[pid  8505] execve("/usr/lib64/nagios/plugins/check_mem", ["/usr/lib64/nagios/plugins/check_mem", "-f", "-w", "20", "-c", "10"], [/* 11 vars */]) = -1 EACCES (Permission denied)
[pid  8505] +++ exited with 126 +++
[pid  8504] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8505, si_status=126, si_utime=0, si_stime=0} ---
[pid  8504] +++ exited with 126 +++
[pid  8503] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=8504, si_status=126, si_utime=0, si_stime=0} ---
[pid  8503] +++ exited with 0 +++
 
Old 07-19-2018, 10:33 AM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,768

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
Quote:
[pid 8505] execve("/usr/lib64/nagios/plugins/check_mem", ["/usr/lib64/nagios/plugins/check_mem", "-f", "-w", "20", "-c", "10"], [/* 11 vars */]) = -1 EACCES (Permission denied)
Permission denied? There is your problem!
Check permissions with
Code:
ls -ld /usr/lib64/nagios/plugins/check_mem /usr/lib64/nagios/plugins /usr/lib64/nagios
Did you really successfully run this as nrpe user?
 
Old 07-19-2018, 11:09 AM   #9
seddik
Member
 
Registered: Mar 2018
Location: france
Distribution: CENTOS,,DEBIAN,,UBUNTU,,ARCHLINUX,,RHEL
Posts: 33

Original Poster
Rep: Reputation: Disabled
Thanks for repling MadeInGermany ,,

I made a mistake that the DIRECTORY plogins was owned by user nagios not nrpe who is run the check
However i have just switch the owner to nrpe user , and it's work .


THank you so much for your advices

Best regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Cannot open log file '/usr/local/nagios/var/archives/nagios hhm Linux - Server 10 09-27-2014 08:46 AM
nagios not working (http://localhost/nagios or http://ip/nagios) 404 error connect2janu Linux - Server 1 11-18-2012 02:06 AM
Nagios Error. Shahnawaz Uqaili Linux - Newbie 22 05-25-2011 09:27 AM
Nagios Error!!! anishkumarv Linux - Server 3 04-19-2011 04:45 AM
nagios error Rahul Kolan Linux - Software 1 11-13-2009 03:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration