Re: add hostgroups to service SNMP traps
Posted: Wed Feb 22, 2017 3:10 pm
If I recreated how our host groups are set up but as service groups and then tried to add a servicegroupname /s to that command, do you think that would work?
Support for Nagios products and services
https://support.nagios.com/forum/
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::nHostEvent nHostname s \"%host%\" nHostStateID i %hoststateid% nHostOutput s \"%hostoutput%\"";Code: Select all
$trap_command = "/usr/bin/snmptrap -v 2c -c $community $tcp$address$port '' NAGIOS-NOTIFY-MIB::nHostEvent nHostname s \"%host%\" nHostStateID i %hoststateid% nHostOutput s \"%hostoutput%\" nHostHostgroupnames s \"%hostgroupnames%\"";
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%\"";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%\" nSvcHostgroupnames s \"%hostgroupnames%\"";
Code: Select all
/usr/local/nagiosxi/html/includes/components/snmptrapsender/mibsCode: Select all
/usr/share/snmp/mibs/
Code: Select all
HostEventEntry ::= SEQUENCE {
nHostEventIndex Integer32,
nHostname OCTET STRING,
nHostAlias OCTET STRING,
nHostStateID HostStateID,
nHostStateType HostStateType,
nHostAttempt Integer32,
nHostDurationSec Integer32,
nHostGroupName OCTET STRING,
nHostLastCheck Integer32,
nHostLastChange Integer32,
nHostLastUp Integer32,
nHostLastDown Integer32,
nHostLastUnreachable Integer32,
nHostOutput OCTET STRING,
nHostPerfData OCTET STRING
}Code: Select all
HostEventEntry ::= SEQUENCE {
nHostEventIndex Integer32,
nHostname OCTET STRING,
nHostAlias OCTET STRING,
nHostStateID HostStateID,
nHostStateType HostStateType,
nHostAttempt Integer32,
nHostDurationSec Integer32,
nHostGroupName OCTET STRING,
nHostLastCheck Integer32,
nHostLastChange Integer32,
nHostLastUp Integer32,
nHostLastDown Integer32,
nHostLastUnreachable Integer32,
nHostOutput OCTET STRING,
nHostPerfData OCTET STRING
nHostHostgroupnames OCTET STRING
}Code: Select all
nHostHostgroupnames OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"This object contains The Hostgroups the Host is in."
::= { nagiosHostEventEntry 16 }Code: Select all
::= { nagiosHostEventEntry 15 }Code: Select all
SvcEventEntry ::= SEQUENCE {
nSvcEventIndex Integer32,
nSvcHostname OCTET STRING,
nSvcHostAlias OCTET STRING,
nSvcHostStateID HostStateID,
nSvcHostStateType HostStateType,
nSvcDesc OCTET STRING,
nSvcStateID ServiceStateID,
nSvcAttempt Integer32,
nSvcDurationSec Integer32,
nSvcGroupName OCTET STRING,
nSvcLastCheck Integer32,
nSvcLastChange Integer32,
nSvcLastOK Integer32,
nSvcLastWarn Integer32,
nSvcLastCrit Integer32,
nSvcLastUnkn Integer32,
nSvcOutput OCTET STRING,
nSvcPerfData OCTET STRING
}Code: Select all
SvcEventEntry ::= SEQUENCE {
nSvcEventIndex Integer32,
nSvcHostname OCTET STRING,
nSvcHostAlias OCTET STRING,
nSvcHostStateID HostStateID,
nSvcHostStateType HostStateType,
nSvcDesc OCTET STRING,
nSvcStateID ServiceStateID,
nSvcAttempt Integer32,
nSvcDurationSec Integer32,
nSvcGroupName OCTET STRING,
nSvcLastCheck Integer32,
nSvcLastChange Integer32,
nSvcLastOK Integer32,
nSvcLastWarn Integer32,
nSvcLastCrit Integer32,
nSvcLastUnkn Integer32,
nSvcOutput OCTET STRING,
nSvcPerfData OCTET STRING
nSvcHostgroupnames OCTET STRING
}Code: Select all
nSvcHostgroupnames OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"This object contains the Hostgroup the Host associated to this service."
::= { nagiosSvcEventEntry 19 }Code: Select all
::= { nagiosSvcEventEntry 18 }