Hi Team,
We have a requirement to monitor the process remotely with out NRPE agent and linux monitoring wizard, We can do with the command 'ssh username@ipaddress ps -ef|grep -i process name | wc -l.
It results 1 or 2 as output but is there any way we can achieve in nagios nagios if it returns 1 the critcal status should come up along with the output.
Remote process check on linux server
Re: Remote process check on linux server
A 1 in Nagios is always going to be a warning, a 2 will always be critical, and 0 is always OK. There is no way to change this in nagios itself. You would have to write a wrapper script that would called your ssh check, then set its own exit code based on the ssh exit code.kgopiramesh wrote:It results 1 or 2 as output but is there any way we can achieve in nagios nagios if it returns 1 the critcal status should come up along with the output.
Former Nagios employee
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Remote process check on linux server
checy_by_ssh is a great script for executing commands on remote hosts. It is included in the Nagios Plugins http://www.nagios.org/download/plugins.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Remote process check on linux server
I agree with Box293, you can grab any custom plugins you may need, or those from the nagios plugins package, place them on the remote server and then call them using check_by_ssh.
http://assets.nagios.com/downloads/nagi ... ng_SSH.pdf
This eliminates the need to install a agent on the remote host for actively checking it.
http://assets.nagios.com/downloads/nagi ... ng_SSH.pdf
This eliminates the need to install a agent on the remote host for actively checking it.
-
kgopiramesh
Re: Remote process check on linux server
Thank you so much for your replies.
I have achieved it with the help of the below script
Process_Count=`ssh username@servername ps -ef | grep -i $1 | grep -v grep | wc -l`
if [ $Process_Count -ge 1 ]
then
echo "the process is running on the server"
exit 0
else
echo "the process is not running on the server"
exit 2
fi
I have achieved it with the help of the below script
Process_Count=`ssh username@servername ps -ef | grep -i $1 | grep -v grep | wc -l`
if [ $Process_Count -ge 1 ]
then
echo "the process is running on the server"
exit 0
else
echo "the process is not running on the server"
exit 2
fi
Re: Remote process check on linux server
Good to see it is working! I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee