Need some help with an Snmp Entry.

This forum is intended for the discussion of Nagios Core development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagios-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Need some help with an Snmp Entry.

Postby skyerjoe » Tue Mar 29, 2016 4:37 am

Hello Guys,

I need some help with an trap value.

We use an snmp trap from an ow-server to give alarm when our air condense water reach a limit.

it looks like this:

EVENT wateralertOWSERVER .1.3.6.1.4.1.31440.0.6 "Status Events" Testing
FORMAT Water Status $+1
EXEC /usr/local/nagios/libexec/submit_check_result ow-server "Water Alert level 1" 0 "Water status is ok"
MATCH $+1:(31440.2.2.1.1.4:1)
SDESC
ow-server alert
EDESC


The entry was created a long time ago and i cannot verify exactly what these line do:

MATCH $+1:(31440.2.2.1.1.4:1)

I even tried to resaerch the value on the snmptt Homepage. But i haven't found an value which belongs to the Match Variable §+1

Does anybody know which effect these line of code has ?


Thanks in advance for help

regards skyerjoe
Nagios Core 3.5.1

Checkmk 1.2.4p5
skyerjoe
 
Posts: 56
Joined: Thu Mar 22, 2012 2:57 am

Re: Need some help with an Snmp Entry.

Postby ssax » Tue Mar 29, 2016 4:48 pm

It does variable substitution:

$+n - Expand variable-binding n (1-n) in the format of variable name:value (see Note 2,3,5)


variable substitutions: $vn (variable name), $+n(variable name:value), $-n (variable name (type):value), $+* (same as $+n but wildcard), and $-* (same as $-n but wildcard). Translation of the variable name using the MIB requires the UCD-SNMP / Net-SNMP Perl module.


Note (2):

If translate_integers is enabled in the snmptt.ini file, SNMPTT will attempt to convert integer values received in traps into text by performing a lookup in the MIB file.

You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file.

For this feature to work, you must ensure UCD-SNMP / Net-SNMP is configured correctly with all the required MIBS. If the option is enabled, but the value can not be found, the integer value will be used. If the MIB files are present, but translations do not occur, ensure UCD-SNMP / Net-SNMP is correctly configured to process all the required mibs. This is configured in the UCD-SNMP / Net-SNMP snmp.conf file. Alternatively, you can try setting the mibs_enviroment variable in snmptt.ini to ALL (no quotes) to force all MIBS to be initialized at SNMPTT startup.

If translate_integers is enabled while using stand-alone mode, it may take longer to process each trap due to the initialization of the MIB files.

Note (3):

$vn, $+n and $-n variable names and variable type are translated into the text name by performing a lookup in the MIB file. You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file. If net_snmp_perl_enable is not enabled, the $vn variable will be replaced with the text 'variablen' where n is the variable number (1+).

For the name translation to work, you must ensure UCD-SNMP / Net-SNMP is configured correctly with all the required MIBS. If the option is enabled and the correct name is not returned, ensure UCD-SNMP / Net-SNMP is correctly configured to process all the required mibs. This is configured in the UCD-SNMP / Net-SNMP snmp.conf file. Alternatively, you can try setting the mibs_enviroment variable in snmptt.ini to ALL (no quotes) to force all MIBS to be initialized at SNMPTT startup.

Note (5):

If translate_oids is enabled in the snmptt.ini file, SNMPTT will attempt to convert any numeric OIDs found inside the variables passed inside the trap to symbolic form. You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file. If net_snmp_perl_enable is not enabled, it will default to using the numeric OID.

Net-SNMP 5.0.9 and earlier does not support including the module name (eg: IF-MIB::) when translating an OID and most of the 5.0.x versions do not properly tranlsate numeric OIDs to long symbolic names. A patch is available for 5.0.8+ that is inlcuded in Net-SNMP 5.1.1 and higher. The patch is available from the Net-SNMP patch page.


Taken from here:

http://snmptt.sourceforge.net/docs/snmptt.shtml
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
ssax
Dreams In Code
 
Posts: 2973
Joined: Wed Feb 11, 2015 12:54 pm

Re: Need some help with an Snmp Entry.

Postby Box293 » Tue Mar 29, 2016 5:49 pm

To expand on what @ssax has said ...

http://snmptt.sourceforge.net/docs/snmptt.shtml#SNMPTT.CONF-MATCH


Code: Select all
EVENT wateralertOWSERVER .1.3.6.1.4.1.31440.0.6 "Status Events" Testing


This EVENT string defines is the OID that triggers SNMPTT to action this trap and execute the EXEC line.

However the MATCH statement is additional criteria that MUST be met before the EXEC line is executed.

$+* - Expand all variable-bindings in the format of variable name:value (see Note 2,3,5)
$+n(variable name:value)


Code: Select all
MATCH $+1:(31440.2.2.1.1.4:1)


There are two values separated by a :

Code: Select all
$+1
(31440.2.2.1.1.4:1)


$+1 will be the name and value of the variable that has come in the trap.

The number in the brackets ... the brackets represent a regular expression.

So if $+1 = 31440.2.2.1.1.4:6 then the trap wouldn't match because it doesn't match 31440.2.2.1.1.4:1 and hence the EXEC would not be executed and Nagios would not be notified.

SNMPTT is extremely powerful :D
User avatar
Box293
Too Basu
 
Posts: 4735
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia

Re: Need some help with an Snmp Entry.

Postby skyerjoe » Tue Apr 05, 2016 9:17 am

Hey guys,

Thanks for helping

Really helpful explanations

One more questions i have to ask

I just want to test some snmptt entries against ...

So I use the ireasoninig browser for it but i'm not sure in which way i have to set the values in the interface for an proper test.

Here is an picture from it:
trapsender.jpg
Trap-Test



Is this correct or does it not fit the Trap definition which i've described before.

regards skyerjoe
Nagios Core 3.5.1

Checkmk 1.2.4p5
skyerjoe
 
Posts: 56
Joined: Thu Mar 22, 2012 2:57 am

Re: Need some help with an Snmp Entry.

Postby tgriep » Tue Apr 05, 2016 3:34 pm

Take a look in the /var/log/snmptt/snmpttunknown.log file to see if the OID that you sent earlier is in there.
Try sending this OID to see if the Nagios system receives the trap.
Code: Select all
.1.3.6.1.4.1.31440.2.2.1.1.4
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 6086
Joined: Thu Oct 30, 2014 9:02 am

Re: Need some help with an Snmp Entry.

Postby Box293 » Tue Apr 05, 2016 6:42 pm

Your screenshot shows SNMPv1 traps.

Try sending v2c traps, it's a little less complicated.
User avatar
Box293
Too Basu
 
Posts: 4735
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia

Re: Need some help with an Snmp Entry.

Postby skyerjoe » Wed Apr 06, 2016 3:05 am

Thanks Guys

I'll try


regards john
Nagios Core 3.5.1

Checkmk 1.2.4p5
skyerjoe
 
Posts: 56
Joined: Thu Mar 22, 2012 2:57 am

Re: Need some help with an Snmp Entry.

Postby rkennedy » Wed Apr 06, 2016 1:22 pm

skyerjoe wrote:Thanks Guys

I'll try


regards john


Sounds good, let us know if you need any further assistance.
rkennedy
 
Posts: 6562
Joined: Mon Oct 05, 2015 11:45 am

Re: Need some help with an Snmp Entry.

Postby skyerjoe » Thu Apr 07, 2016 3:22 am

Hello again

I tried to reproduce an trap from my ow-server but i cannot reach the finish line atm I'm struggle with the definition and the trap ...

I use the advise to explore the logs from snmptt:

Here is my log which our ow server produce:

Code: Select all
Wed Apr  6 14:24:53 2016: Unknown trap (.1.3.6.1.4.1.31440.0.6) received from xxx.16.9.117 at:
Value 0: xxx.16.9.117
Value 1: xxx.16.9.117
Value 2: 458:20:54:30.15
Value 3: .1.3.6.1.4.1.31440.0.6
Value 4: xxx.16.9.117
Value 5: public
Value 6: .1.3.6.1.4.1.31440
Value 7:
Value 8:
Value 9:
Value 10:
Ent Value 0: .1.3.6.1.4.1.31440.2.2.1.1.5=2



Here is my trap which should reproduced the original one:

Code: Select all
Wed Apr  6 16:22:42 2016: Unknown trap (.1.3.6.1.4.1.31440.0.6) received from test-pc.local.1 at:
Value 0: test-pc.local.1
Value 1: xxx.16.9.138
Value 2: 0:0:00:00.00
Value 3: .1.3.6.1.4.1.31440.0.6
Value 4: xxx.16.9.138
Value 5:
Value 6:
Value 7:
Value 8:
Value 9:
Value 10:
Ent Value 0: .1.3.6.1.4.1.31440.2.2.1.1.5=2



And this is the Trap Definition which i want to trigger


Code: Select all
EVENT wateralertOWSERVER .1.3.6.1.4.1.31440.0.6 "Status Events" Testing
FORMAT Water Status $+1
EXEC /usr/local/nagios/libexec/submit_check_result ow-server  "Water Alert level 2" 2 "Water status is critical"
#MATCH $+1:(31440.2.2.1.1.5:2)
MATCH $x:.1.3.6.1.4.1.31440.2.2.1.1.5:2
SDESC
ow-server alert
EDESC


I'm not sure which i have to reproduce it

May trap sender looks like this:

test-trap-2.jpg


regards skyerjoe
Nagios Core 3.5.1

Checkmk 1.2.4p5
skyerjoe
 
Posts: 56
Joined: Thu Mar 22, 2012 2:57 am

Re: Need some help with an Snmp Entry.

Postby tgriep » Thu Apr 07, 2016 4:45 pm

When you edited the snmptt.conf file, did you restart the snmptt daemon?
You need to do that every time you do any changes to that file.
How about you start out simple and comment out the MATCH for that OID and see if the system receives the trap.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 6086
Joined: Thu Oct 30, 2014 9:02 am

Next

Return to Nagios Core Development

Who is online

Users browsing this forum: Fess [Nagios Bot] and 6 guests