source of alert in message

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
fasanchez
Posts: 23
Joined: Wed Jan 10, 2018 9:07 am

source of alert in message

Post by fasanchez »

would like to include the source of an alert in the message being passed to snmp trap. The source always show the Nagios Syslog server as the source of the alert, but in the syslog message I have a device, would like to pass that on to the snmp trap and show it in the trap.

In the emailed version of the alert a field called %Uniquehost% may be pass this same variable to an snmp trap?

The SNMP trap that is generated as a result of an event with the service in Nagios.
Variables:
1: nHostname
Syntax:OCTETSTR
Description:Hostname as specified in the Nagios configuration file.
2: nHostStateID
Syntax:TEXTUAL_CONVENTION
Description:The host state as defined by the HOSTSTATEID macro
3: nSvcDesc
Syntax:OCTETSTR
Description:This value is taken from the description directive of the service definition.
4: nSvcStateID
Syntax:TEXTUAL_CONVENTION
Description:A number that corresponds to the current state of the service: 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN
5: nSvcAttempt
Syntax:INTEGER
Description:The number of the current service check retry. For instance, if this is the second time that the service is being rechecked, this will be the number two. Current attempt number is really only useful when writing service event handlers for soft states that take a specific action based on the service retry number.
6: nSvcDurationSec
Syntax:INTEGER
Description:A number indicating the number of seconds that the service has spent in its current state.
7: nSvcGroupName
Syntax:OCTETSTR
Description:The short name of the servicegroup that this service belongs to. This value is taken from the servicegroup_name directive in the servicegroup definition. If the service belongs to more than one servicegroup this object will contain the name of just one of them.
8: nSvcLastCheck
Syntax:INTEGER
Description:This is a timestamp in time_t format (seconds since the UNIX epoch) indicating the time at which a check of the service was last performed.
9: nSvcLastChange
Syntax:INTEGER
Description:This is a timestamp in time_t format (seconds since the UNIX epoch) indicating the time the service last changed state.
10: nSvcOutput
Syntax:OCTETSTR
Description:The text output from the last service check (i.e. Ping OK).
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: source of alert in message

Post by scottwilkerson »

Unfortunately those special macros can only be use in email alerts.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
fasanchez
Posts: 23
Joined: Wed Jan 10, 2018 9:07 am

Re: source of alert in message

Post by fasanchez »

So is there a way I can somehow pass on to the snmp trap the source of the alert.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: source of alert in message

Post by scottwilkerson »

fasanchez wrote:So is there a way I can somehow pass on to the snmp trap the source of the alert.
No there is not unfortunately.

One way i could be accomplished would be if you were sending to a trap service for each of these hosts, then you could setup alerts for each of these hosts and add the specific host to a filter for each alert.

But I realize this is a lot more setup
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked