Page 1 of 1

Monitoring PS Command Result

Posted: Tue Jun 09, 2015 5:02 am
by abdelhafeth.mzahem
Dears


We have a linux server, and Server admin request that the result of the ps command must be as shown below:

ps -ef |grep HLR_SH | grep -v "grep HLR_SH" | grep -v "HLR_SH.ini"

the expected result is :

eppix 30392 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH1.ini
eppix 30393 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH2.ini
eppix 30394 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH3.ini
eppix 30395 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH4.ini
eppix 30396 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH5.ini

If one of the above processes is missing we need to receive a notification (MaP is missing )

what is the best practice to achieve it ?

Re: Monitoring PS Command Result

Posted: Tue Jun 09, 2015 9:07 am
by tmcdonald
I would write a plugin that grabs the output and does a line count on it. Plugins follow a pretty simple set of requirements:

https://nagios-plugins.org/doc/guidelines.html

They can be written in just about any language. Once you have that built, look into something like NRPE to run it on a remote machine:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Monitoring PS Command Result

Posted: Wed Jun 10, 2015 2:31 am
by abdelhafeth.mzahem
thank you for reply,


IF I want to monitor it as process what process name I must use ? as I use all possible but not work


eppix 30392 1 0 11:39 ? 00:00:00 /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH1.ini

what condition must be in process to be monitored by check_snmp_process ?

Re: Monitoring PS Command Result

Posted: Wed Jun 10, 2015 10:32 am
by ssax
You should be able to do it with this command:

Code: Select all

./check_snmp_process.pl -H 192.168.4.124 -C public -n "/MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH[0-9].ini" -w 4 -c 4 -A "/MaP/config/HLR_SH[0-9].ini"

Re: Monitoring PS Command Result

Posted: Thu Jun 11, 2015 1:36 am
by abdelhafeth.mzahem
Hi,

Thank you for reply; that's exactly what we want. How to monitor it using check_snmp_process commands .

I tried the command but not work.


[root@nms libexec]# ./check_snmp_process.pl -H 10.100.1.94 -C jawwal-snmp -n "/MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH[0-9].ini" -w 0 -c 0 -A "/MaP/config/HLR_SH[0-9].ini"
Unknown option: A
No process matching /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH[0-9].ini found : CRITICAL
[root@nms libexec]# ./check_snmp_process.pl -H 10.100.1.94 -C jawwal-snmp -n "/MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH1.ini" -w 0 -c 0 -A "/MaP/config/HLR_SH1.ini"
Unknown option: A
No process matching /MaP/bin/ericsson_cai_telnet_sh /MaP/config/HLR_SH1.ini found : CRITICAL

Re: Monitoring PS Command Result

Posted: Thu Jun 11, 2015 9:02 am
by ssax
What version of check_snmp_process.pl are you using?

Code: Select all

./check_snmp_process.pl -V
Also, you might need to put quotes around your snmp community because of the - in it.

Re: Monitoring PS Command Result

Posted: Thu Jun 11, 2015 10:31 pm
by abdelhafeth.mzahem
check_snmp_process version : 1.4

Re: Monitoring PS Command Result

Posted: Thu Jun 11, 2015 11:51 pm
by Box293
Please check your support ticket, I have given you an answer this way.

FYI the -A argument is not in the v1.4 of the plugin, please download the latest version:

http://nagios.proy.org/snmp_process.html