1

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

5
  • 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
    Commented Nov 19, 2010 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
    Commented Nov 20, 2010 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
    Commented Nov 20, 2010 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
    Commented Nov 20, 2010 at 5:44
  • /opt/data/script.pl is on the system you are monitoring? Commented Apr 13, 2011 at 18:51

1 Answer 1

1

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
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .