add hostgroups to service SNMP traps

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
peter.zanetti
Posts: 90
Joined: Wed Oct 01, 2014 8:34 am

add hostgroups to service SNMP traps

Post by peter.zanetti »

Is there a way to add the hostgroups a host is in to a service alert SNMP trap?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: add hostgroups to service SNMP traps

Post by avandemore »

I'm afraid I'm not sure I understand your question. Are you saying you want a single SNMP trap to be distributed to the same service among a hostgroup?

Have you looked at this?

https://assets.nagios.com/downloads/nag ... ricks.html
Previous Nagios employee
peter.zanetti
Posts: 90
Joined: Wed Oct 01, 2014 8:34 am

Re: add hostgroups to service SNMP traps

Post by peter.zanetti »

Sorry for the poor wording.

The way we are currently monitoring these devices we were monitoring just the host up/down and when a host went down it would send an SNMP trap out to create a ticket on that device. In that SNMP trap we have the hostgroups that host is in, in the trap itself.

We are now getting ready to implement service alerts on these hosts as well. However, during our testing we are not getting the hostgroups to come across in our SNMP traps. Is there a way to modify the trap sender on the back end to include hostgroups?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: add hostgroups to service SNMP traps

Post by avandemore »

You could modify the snmptt.conf entry for the OID in and around the line beginning with:

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py
/etc/snmp/snmptt.ini provides configuration and debugging settings to work out how the data looks on the way out.
/etc/snmp/snmptt.conf provides the OID's and their actions.
/usr/local/bin/snmptraphandling.py is the script which actually submits the result to Nagios.
Previous Nagios employee
peter.zanetti
Posts: 90
Joined: Wed Oct 01, 2014 8:34 am

Re: add hostgroups to service SNMP traps

Post by peter.zanetti »

I'm not seeing these files in /etc/snmp

the files I'm seeing are: snmpd.conf snmpd.conf.rpmnew snmptrapd.conf
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: add hostgroups to service SNMP traps

Post by tgriep »

I am guessing that you are using the SNMP Trap Sender component in Nagios XI and you want it to include the Hostgroup a Host is in in the data that is sent to your ticketing system, correct?
If so, the SNMP Component does not have the capability to do that.
If that is not what you are looking for, let us know.
Be sure to check out our Knowledgebase for helpful articles and solutions!
peter.zanetti
Posts: 90
Joined: Wed Oct 01, 2014 8:34 am

Re: add hostgroups to service SNMP traps

Post by peter.zanetti »

That's correct. We are using the SNMP Trap Sender component. Right now we only have it set up to send traps on hard state DOWN hosts. In order to get the hostgroups to come across in these traps we modified the xi_host_event_handler command adding

Code: Select all

--hostgroupnames="$HOSTGROUPNAMES$"
to the end of the command.

We are now wanting to do the same but with hard state DOWN services. I made the same change to the xi_service_event_handler command but after sending a test SNMP trap we saw that change did nothing to bring the host groups over to our ticketing tool in the trap.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: add hostgroups to service SNMP traps

Post by tgriep »

That Macro should be available for Service Notifications but try using the $HOSTGROUPNAME$ macro for a quick test and see if that one works for the xi_service_event_handler.
Be sure to check out our Knowledgebase for helpful articles and solutions!
peter.zanetti
Posts: 90
Joined: Wed Oct 01, 2014 8:34 am

Re: add hostgroups to service SNMP traps

Post by peter.zanetti »

We tested that earlier this week and it didn't work as we expected it to.

EDIT: Just tested it again with hostgroupname and hostgroupsnames, neither of which worked.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: add hostgroups to service SNMP traps

Post by tgriep »

Well, worth a try. I don't think the SNMP Trap sender is using the hostgroupsname / s when sending service traps could be the reason it is not working.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked