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.
SNMP Trap Sender modification to send Service Groups...
-
JakeHatMacys
- Posts: 281
- Joined: Thu Sep 25, 2014 3:21 pm
Re: SNMP Trap Sender modification to send Service Groups...
*** 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:
Around line 434 change this line from:
To:
Then go to Configure > Core Config Manager > Commands
- Edit the xi_service_event_handler command
- Add this to the end of it:
So it looks something like this:
That should do it, worked for me, let us know the results.
Thank you
*** 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.phpCode: 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%\"";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%\"";- Edit the xi_service_event_handler command
- Add this to the end of it:
Code: Select all
--servicegroupname='$SERVICEGROUPNAME$'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$'Thank you
-
JakeHatMacys
- Posts: 281
- Joined: Thu Sep 25, 2014 3:21 pm
Re: SNMP Trap Sender modification to send Service Groups...
Worked like a charm at first glance.
I'll let you know if our server configuration explodes. But until then thanks a ton!!!
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...
No problem, glad we could help.