Page 1 of 1
SNMP Trap Sender modification to send Service Groups...
Posted: Mon Nov 14, 2016 2:44 pm
by JakeHatMacys
As titled, I'd like to know if there's a general modification we can make to our Service MIB (without breaking anything) to send Service groups in the SNMP traps for services. Right now we're not seeing them.
The purpose of this is key off of it to identify cleanly what que to send our tickets to.
Has this been done or looked at prior and can anyone aid us in doing this?
Thanks.
Re: SNMP Trap Sender modification to send Service Groups...
Posted: Mon Nov 14, 2016 5:03 pm
by ssax
*** Note: This will get reverted if you upgrade and will need to be reimplemented.
*** Make sure that you have known-good backups/vm snapshots before making any modifications.
You can edit this file:
Code: Select all
/usr/local/nagiosxi/html/includes/components/snmptrapsender/snmptrapsender.inc.php
Around line
434 change this line from:
Code: Select all
$trap_command = "/usr/bin/snmptrap -v 2c -c $community $tcp$address$port '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s \"%host%\" nSvcDesc s \"%service%\" nSvcStateID i %servicestateid% nSvcOutput s \"%serviceoutput%\"";
To:
Code: Select all
$trap_command = "/usr/bin/snmptrap -v 2c -c $community $tcp$address$port '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s \"%host%\" nSvcDesc s \"%service%\" nSvcStateID i %servicestateid% nSvcOutput s \"%serviceoutput%\" nSvcGroupName s \"%servicegroupname%\"";
Then go to Configure > Core Config Manager > Commands
- Edit the
xi_service_event_handler command
- Add this to the end of it:
Code: Select all
--servicegroupname='$SERVICEGROUPNAME$'
So it looks something like this:
Code: Select all
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_event.php --handler-type=service --host="$HOSTNAME$" --service="$SERVICEDESC$" --hostaddress="$HOSTADDRESS$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --servicedowntime=$SERVICEDOWNTIME$ --servicegroupname='$SERVICEGROUPNAME$'
That should do it, worked for me, let us know the results.
Thank you
Re: SNMP Trap Sender modification to send Service Groups...
Posted: Wed Nov 16, 2016 2:43 pm
by JakeHatMacys
Worked like a charm at first glance.
I'll let you know if our server configuration explodes. But until then thanks a ton!!!
Re: SNMP Trap Sender modification to send Service Groups...
Posted: Wed Nov 16, 2016 4:13 pm
by ssax
No problem, glad we could help.