Hi all,
I have added a switch port monitoring to nagios as shown below and it is working fine:
define service{
use generic-service
host_name XX.XX.XX.XX
service_description Port 1 Link Status
check_command check_snmp!-C <my community> -o ifOperStatus.1 -r 1 -m RFC1213-MIB
}
The status information is showing:
SNMP OK - 1 - means the switch port is UP
SNMP OK - 2 - means the switch port is down
I would like to change the status information from "SNMP OK - 1" to UP and "SNMP OK - 2" to DOWN.
Please suggest the solution.
Thanks in advance
Regards
KP
Custom nagios status information
Re: Custom nagios status information
From: http://nagiosplugins.org/man/check_snmp
So you may want to try:
Code: Select all
--invert-search
Invert search result (CRITICAL if found)Code: Select all
define service{
use generic-service
host_name XX.XX.XX.XX
service_description Port 1 Link Status
check_command check_snmp!-C <my community> -o ifOperStatus.1 -r 2 --invert-search -m RFC1213-MIB
}Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
kalyan1709
- Posts: 43
- Joined: Tue Oct 16, 2012 12:45 am
Re: Custom nagios status information
Hi abrist,
Thanks for the reply. I followed your post and below is the output:
[root@Nagios ~]# /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 -m RFC1213-MIB -H 172.16.7.11
SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
[root@Nagios ~]# /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 1 -m RFC1213-MIB -H 172.16.7.11
SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
Actually the port 12002 is down. But I am getting out put as "SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2". I need the info "Down" here.
snmpwalk out put: IF-MIB::ifOperStatus.12002 = INTEGER: down(2)
Thanks & Regards
Kalyan Pasupuleti
Thanks for the reply. I followed your post and below is the output:
[root@Nagios ~]# /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 -m RFC1213-MIB -H 172.16.7.11
SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
[root@Nagios ~]# /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 1 -m RFC1213-MIB -H 172.16.7.11
SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
Actually the port 12002 is down. But I am getting out put as "SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2". I need the info "Down" here.
snmpwalk out put: IF-MIB::ifOperStatus.12002 = INTEGER: down(2)
Thanks & Regards
Kalyan Pasupuleti
Re: Custom nagios status information
Hi kalyan1709,
I think abrist means to run:
With the "--invert-search" added in there.
Kind Regards,
Gary Shwergill
I think abrist means to run:
Code: Select all
/usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 --invert-search -m RFC1213-MIB -H 172.16.7.11Kind Regards,
Gary Shwergill
-
kalyan1709
- Posts: 43
- Joined: Tue Oct 16, 2012 12:45 am
Re: Custom nagios status information
Hi Gary,
Sorry, I have pasted the wrong line. But still it is giving the same out put "SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
" even after executing the below command:
/usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 --invert-search -m RFC1213-MIB -H 172.16.7.11
Thanks & Regards
Kalyan Pasupuleti
Sorry, I have pasted the wrong line. But still it is giving the same out put "SNMP OK - 2 | RFC1213-MIB::ifOperStatus.12002=2
" even after executing the below command:
/usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 --invert-search -m RFC1213-MIB -H 172.16.7.11
Thanks & Regards
Kalyan Pasupuleti
Re: Custom nagios status information
Do you get the same behavior if you try a string match instead of a regex?
Code: Select all
/usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -s " 2 " --invert-search -m RFC1213-MIB -H 172.16.7.1Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
kalyan1709
- Posts: 43
- Joined: Tue Oct 16, 2012 12:45 am
Re: Custom nagios status information
Thanks all.
Finally I it worked for me by using /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 --invert-search -m RFC1213-MIB -H 172.16.7.1
Thanks & Regards
Kalyan Pasupuleti
Finally I it worked for me by using /usr/local/src/nagios/libexec/check_snmp -C mycommunity -o ifOperStatus.12002 -r 2 --invert-search -m RFC1213-MIB -H 172.16.7.1
Thanks & Regards
Kalyan Pasupuleti
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Custom nagios status information
Thanks for letting us know its working!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.