As I mentioned in another post, I have an app that sends out traps, but all of them use the some oid.
They all have something in the "Ent Value 0" field. It is always in the same format, with the "oid=date, time, SEVERITY, type, random text".
I'd like to modify a script to translate the severity into ok, warning or critical and then pass on the remaining text to NagiosXI. Which script should I add that logic to?
Thanks
More SNMP Questions
More SNMP Questions
Last edited by BanditBBS on Mon Dec 17, 2012 4:30 pm, edited 1 time in total.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: More SNMP Questions
If you are using SNMPTT the /etc/snmp/snmptt.conf should have your trap info and passes it to /usr/local/bin/snmptraphandling.py
I would think any additional logic could be placed in /usr/local/bin/snmptraphandling.py
I would think any additional logic could be placed in /usr/local/bin/snmptraphandling.py
Re: More SNMP Questions
Ok, so I added this to snmptt.conf file:
And this now appears in my snmptt.log:
As stated, every trap will be .1.3.6.1.4.1.7061.0.0. The severity will be in the data (i.e. OFF NORMAL), any idea how I can handle that and tell snmptt.conf the proper severity or the snmptraphandling.py script how to handle that and assign the proper severity? I'm lost here 
Thanks
Code: Select all
EVENT sitescanalert .1.3.6.1.4.1.7061.0.0 "Status Events" Normal
FORMAT $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "$*"
SDESC
A sitescan notification signifies
that there has been a change in the state of
a sitescan monitored device.
Variables:
EDESC
Code: Select all
Mon Dec 17 11:43:01 2012 .1.3.6.1.4.1.7061.0.0 Normal "Status Events" wdcae-pssw01v - Dec 17, 2012 11:42:16 AM,OFF NORMAL,Universal,High Capacity is in alarm 0.0.Thanks
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: More SNMP Questions
Ok, I think I figured out how to handle this mess!
I made a copy of the snmptraphandling.py script and named it snmptraphandlingss.py. I modified the snmptt.conf file to call that script when dealing with the particular OID.
Now I just need to learn python and modify the script to split the variable using "," and set severity=3rd field.
Anyone familiar with python enough to write the couple lines?
I made a copy of the snmptraphandling.py script and named it snmptraphandlingss.py. I modified the snmptt.conf file to call that script when dealing with the particular OID.
Now I just need to learn python and modify the script to split the variable using "," and set severity=3rd field.
Anyone familiar with python enough to write the couple lines?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: More SNMP Questions
In the py script there is this secton that sets the severity to whatever was passed from snmptt;
Well, I'm wanting to do something like this, but just can't figure out the proper syntax or if I can even do it in the script where I am trying to:
I've never messed with python, am trying to google, but coming up stumped on exact syntax.
Code: Select all
try:
severity = sys.argv[3]
except:
printusageCode: Select all
try:
splitstring = sys.argv[3].split(',')
severity = splitstring[3]
except:
printusage2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: More SNMP Questions
Just FYI for anyone else ever doing this kind of stuff. I got it working!!
I did just change that section of code and also added to the If Else statements concerning the severity section. Working great and I can now properly alert from a system that sends everything as one OID.
I did just change that section of code and also added to the If Else statements concerning the severity section. Working great and I can now properly alert from a system that sends everything as one OID.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: More SNMP Questions
I was going to say you could just point the trap to your own handler using perl or whatever, process the parameters, then call the 'real' handler and pass the modified parameters to it. But since you've got it working it's probably not worth the trouble this time.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: More SNMP Questions
Thanks for posting your answer! Glad it's 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.