check_snmp_environment.pl: check did not exit properly
Posted: Thu May 14, 2015 12:29 pm
I really like the plugin check_snmp_environment.pl! I am able to execute the plugin from the command line but have not been able to make it work in Nagios. All the comments I see on the Nagios plugins page are positive so I must be doing something simply wrong in my scripts.
I am running Nagios 3.5.0 on OpenSUSE 12.1.
I successfully executed the plugin from the command line targeting a variety of Cisco platforms. Here is the command line for 10.231.135.131.
./check_snmp_environment.pl –H 10.231.135.131 -2 –T cisco –C s2436608
Linux returns:
1 Fan OK, 1 ps OK: OK
This is how the plugin is translated in commands.cfg.
# 'check_snmp_environment' command definition
define command {
command_name check_cisco_env
command_line $USER1$/check_snmp_environment.pl -H $HOSTADDRESS$ $ARG1$
}
Here is the rest of the configuration information.
define servicegroup {
servicegroup_name MPI
alias Mail Processing Infrastructure
members 10.231.135.131, PING, 10.231.135.132, PING
}
define hostgroup {
hostgroup_name MPI_CORE_C2960G-24TC-L
alias MPI_CORE_C2960G-24TC-L
}
define host {
use generic-switch
host_name 10.231.135.131
address 10.231.135.131
alias SAJSCAMSW01
icon_image_alt SAJSCAMSW01
icon_image switch_core_mpi.png
statusmap_image switch_core_mpi.png
hostgroups MPI_CORE_C2960G-24TC-L
}
define host {
use generic-switch
host_name 10.231.135.132
address 10.231.135.132
alias SAJSCAMSW02
icon_image_alt SAJSCAMSW02
icon_image switch_core_mpi.png
statusmap_image switch_core_mpi.png
hostgroups MPI_CORE_C2960G-24TC-L
parents 10.231.135.131
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description PING
check_command check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A30 - Power Supply
check_command check_snmp!-P 2c -C s2436608 -o SNMPv2-SMI::enterprises.9.9.13.1.5.1.3.1003 -c1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A20 - Fan
check_command check_snmp!-P 2c -C s2436608 -o SNMPv2-SMI::enterprises.9.9.13.1.4.1.3.1004 -c1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A45 - Environment Status
check_command check_cisco_env!-2 -T cisco -C s2436608
}
I left the services that check specific OIDs for fan and power; these are working. However I want to get check_snmp_environment.pl working as I have to check environmental status on a large number of diverse Cisco platforms and this plugin would save me a lot of time and effort.
I appreciate any help anyone is able to provide.
Thanks,
Richard Opie, Equipment Specialist
US Postal Service
I am running Nagios 3.5.0 on OpenSUSE 12.1.
I successfully executed the plugin from the command line targeting a variety of Cisco platforms. Here is the command line for 10.231.135.131.
./check_snmp_environment.pl –H 10.231.135.131 -2 –T cisco –C s2436608
Linux returns:
1 Fan OK, 1 ps OK: OK
This is how the plugin is translated in commands.cfg.
# 'check_snmp_environment' command definition
define command {
command_name check_cisco_env
command_line $USER1$/check_snmp_environment.pl -H $HOSTADDRESS$ $ARG1$
}
Here is the rest of the configuration information.
define servicegroup {
servicegroup_name MPI
alias Mail Processing Infrastructure
members 10.231.135.131, PING, 10.231.135.132, PING
}
define hostgroup {
hostgroup_name MPI_CORE_C2960G-24TC-L
alias MPI_CORE_C2960G-24TC-L
}
define host {
use generic-switch
host_name 10.231.135.131
address 10.231.135.131
alias SAJSCAMSW01
icon_image_alt SAJSCAMSW01
icon_image switch_core_mpi.png
statusmap_image switch_core_mpi.png
hostgroups MPI_CORE_C2960G-24TC-L
}
define host {
use generic-switch
host_name 10.231.135.132
address 10.231.135.132
alias SAJSCAMSW02
icon_image_alt SAJSCAMSW02
icon_image switch_core_mpi.png
statusmap_image switch_core_mpi.png
hostgroups MPI_CORE_C2960G-24TC-L
parents 10.231.135.131
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description PING
check_command check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A30 - Power Supply
check_command check_snmp!-P 2c -C s2436608 -o SNMPv2-SMI::enterprises.9.9.13.1.5.1.3.1003 -c1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A20 - Fan
check_command check_snmp!-P 2c -C s2436608 -o SNMPv2-SMI::enterprises.9.9.13.1.4.1.3.1004 -c1
}
define service {
use local-service
hostgroup_name MPI_CORE_C2960G-24TC-L
service_description A45 - Environment Status
check_command check_cisco_env!-2 -T cisco -C s2436608
}
I left the services that check specific OIDs for fan and power; these are working. However I want to get check_snmp_environment.pl working as I have to check environmental status on a large number of diverse Cisco platforms and this plugin would save me a lot of time and effort.
I appreciate any help anyone is able to provide.
Thanks,
Richard Opie, Equipment Specialist
US Postal Service