Hello guys. After 10 years of windows I've come back to configure some linux servers.
I've installed Nagios 4 on a server, nagios-nrpe-service on another server and used check_ps.sh from https://exchange.nagios.org/directory/P ... sh/details.
The check_ps.sh is using ps aux to get data about a running service. Because %CPU is not the actual %CPU I've changed ps aux to top -bcn 1.
The problem is that running the service locally gives an output, but when running from the nagios server gives an error that the service is not running, and the output is empty.
If instead of using top -bcn 1 I use top -bn 1 the output is received on the nagios server. I need top -bcn 1 because I need to identify a service command, not only the service.
Top output is not send to check_nrpe
Re: Top output is not send to check_nrpe
Can you post the modified script, and the full input / output you're seeing with the various results? I'll try to replicate this on my end and help find a solution.
Also, for reference, would a ps -ef work as well? This will give you the corresponding command running.
Also, for reference, would a ps -ef work as well? This will give you the corresponding command running.
Former Nagios Employee
Re: Top output is not send to check_nrpe
I've modified this line: tmp_output=`ps aux | grep "$process" | grep -v $0` with tmp_output=`top -bcn 1 | grep "$process" | grep -v $0`.
If I have a process like: php runPhp test1 and input the test1 string I'll get an empty output on nagios server.
If I input only php it will work.
If I change the line to tmp_output=`top -bn 1 | grep "$process" | grep -v $0` it will work for input like php, but I need to monitor a specific php child.
If I have a process like: php runPhp test1 and input the test1 string I'll get an empty output on nagios server.
If I input only php it will work.
If I change the line to tmp_output=`top -bn 1 | grep "$process" | grep -v $0` it will work for input like php, but I need to monitor a specific php child.
Last edited by tmcdonald on Thu Mar 31, 2016 12:16 pm, edited 1 time in total.
Reason: Please use [icode] tags for inline code
Reason: Please use [icode] tags for inline code
Re: Top output is not send to check_nrpe
When you are running this on the remote server, what user are you logged in as? If you are running it as root, you might see different output.DanielRo wrote:The problem is that running the service locally gives an output, but when running from the nagios server gives an error that the service is not running, and the output is empty.
Also, can you please post the full command you are using to test this from the Nagios server? There might be issues with the way you are having it run remotely.
Former Nagios employee