SNMP value question

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

SNMP value question

Postby and1100 » Fri Apr 05, 2013 4:18 pm

Hello,

I am trying to tweak my switch port SNMP in Nagios. I would like a port that is 'Not connected' or 'Not Present' in Nagios to not send out any critical alerts or warning (basically to show OK), but I would like it to do so for a 'down' port. Here is an example of how it works currently. Eth7= connected and up. Eth8= connected and DOWN. Eth9= not connected.

Eth 7
OK 04-05-2013 17:08:18 0d 3h 34m 43s 1/3 SNMP OK - up(1)

Eth 8
CRITICAL 04-05-2013 17:08:52 0d 0h 48m 9s 3/3 SNMP CRITICAL - *down(2)*

Eth 9
CRITICAL 04-05-2013 14:42:23 0d 3h 34m 38s 3/3 SNMP CRITICAL - *notPresent(6)*

Here is my current SNMP check command for Nagios:

check_snmp!-H 10.1.1.1 -P 2c -C secret -o ifOperStatus.9 -r 1 (repeated for the other ports)

I've tried a few different options with no luck. I'm sure it's a simple parameter I am missing or not understanding...

Thank you for taking the time to read this.
and1100
 
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: SNMP value question

Postby jsmurphy » Sun Apr 07, 2013 6:32 pm

For port 9 change your command from:
check_snmp!-H 10.1.1.1 -P 2c -C secret -o ifOperStatus.9 -r 1

to:
check_snmp!-H 10.1.1.1 -P 2c -C secret -o ifOperStatus.9 -r 6

The -r is a regex pattern match, it's not up so there's no "1" to match on interface 9, but notPresent is 6... so you can match that number instead. If you want to make it more generic for the sake of manageability you could probably also change it to -r 1|6 (1 or 6)
User avatar
jsmurphy
 
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: SNMP value question

Postby abrist » Tue Apr 09, 2013 12:25 pm

@and1100 - How did jsmurphy's suggestion work out for you?
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP value question

Postby and1100 » Tue Apr 09, 2013 1:37 pm

Apologies, I was out and did not get a chance to test.

I will give this a shot very soon and see how it works out!

Thank you very much for the response and your information.
and1100
 
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: SNMP value question

Postby abrist » Tue Apr 09, 2013 1:40 pm

No problem, let us know!
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP value question

Postby and1100 » Tue Apr 09, 2013 2:00 pm

I was able to test the command using -r 6 and it works as expected for 'NotPresent' ports. I tried to incorporate both values to report back as OK using this syntax:

[root@vmnagios libexec]# ./check_snmp -H 1.1.1.1 -P 2c -C secret -o ifOperStatus.19 -r 1|6
-bash: 6: command not found

but it does not recognize -r 1|6.

Did I incorrectly input the parameters?

Thanks!
and1100
 
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: SNMP value question

Postby abrist » Tue Apr 09, 2013 2:07 pm

You may have to wrap the regex in quotes as it is a special char in bash for piping output to another command.
Code: Select all
-r '1|6'
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP value question

Postby and1100 » Tue Apr 09, 2013 2:36 pm

Awesome! That works!

Thanks a lot!
and1100
 
Posts: 93
Joined: Mon Mar 25, 2013 8:37 am

Re: SNMP value question

Postby abrist » Tue Apr 09, 2013 2:39 pm

!??!!?! Great! . . . locking thread.
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.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm


Return to Community Support

Who is online

Users browsing this forum: Google [Bot], s.dawes@sjp.co.uk, wjenkin2 and 39 guests