I'm trying to monitor a specific script that runs on my box with snmp. The script runs multiple times with multiple paramaters like so

/usr/bin/perl /opt/data/script.pl -m test

or

/usr/bin/perl /opt/data/script.pl -d

I've tried utlizing the --string paramater with check_snmp but I haven't had any luck.

./check_snmp -H server01 -C public --string="/usr/bin/perl /opt/data/script.pl -m test"

This is what the script looks like when I do a snmpwalk:

HOST-RESOURCES-MIB::hrSWRunParameters.675 = STRING: "/opt/data/script.pl -m test"

Obviously I can't monitor the OID since it's specific to the PID. So basically -o HOST-RESOURCES-MIB::hrSWRunParameters.675 = PID of 675

link|improve this question

75% accept rate
Are you trying to check that the script is still in the process table or are you trying to check the output of that script? – Rob Olmos Nov 19 '10 at 23:01
1  
Also, why SNMP? There are a number of ways of monitoring a remote system with nagios, and snmp is one of the most difficult to configure. As @Rob asked, what exactly are you trying to monitor? Give us more information and we can give you better answers. – larsks Nov 20 '10 at 1:47
@Rob Olmos I'm trying to check if the process is still running so yes I would like to see if the script is still in the process table. – hfranco Nov 20 '10 at 5:42
@lansks I don't think SNMP is difficult to configure. A lot of devices use SNMP which make it incredibly easy to monitor like routers, switches, printers, servers, and etc. – hfranco Nov 20 '10 at 5:44
/opt/data/script.pl is on the system you are monitoring? – JakeRobinson Apr 13 '11 at 18:51
feedback

1 Answer

We use check_snmp_process.pl, which does the job nicely for us.

define command {
        command_name    check_at_least_one_proc
        command_line    $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C your-community-here -n $ARG1$ -c 0
}
define command {
        command_name    check_only_one_proc
        command_line    $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C your-community-here -n $ARG1$ -c 0,2
}
define command {
        command_name    check_proc_range
        command_line    $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C your-community-here -n $ARG1$ -c $ARG2$,$ARG3 -w $ARG2$,$ARG3$
}

define service {
        use                             generic-service
        hostgroup_name                  snmpenabled
        service_description             NTP
        check_command                   check_at_least_one_proc!ntpd
}
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.