Page 1 of 1

Macros

Posted: Fri Mar 20, 2020 11:59 am
by vignesha
Hello,

I just required your help to create Macro for host/Service StateType while sending Traps via SNMPTRAP sender, could you please help me to incidue this Macro on "command and snmptrapsender.php" based on that we can able to filter the HARD/SOFT type alerts for host/services in Servicenow end.

Let me know any further details required.

Re: Macros

Posted: Mon Mar 23, 2020 3:35 am
by vignesha
Hello Team,

I just tried to configuration in snmptrapsender.php file but am receiving below error "nSvcHostStateType: Value out of range (SOFT)", also snmp trap is not sending any alert through the port, could you please help me to resolve this issue at the earliest.

PROCESSING:
Array
(
[address] => xx.xxx.xx.xx
[port] => 9030
[hoststateid] => 0
[servicestateid] => 0
[statetype] => BOTH
[downtime] => 1
[snmpversion] => 2c
[community] => xxxxxx
)
PHP Notice: Undefined index: contact in /usr/local/nagiosxi/html/includes/utils-notifications.inc.php on line 0
PHP Notice: Undefined variable: _SESSION in /usr/local/nagiosxi/html/includes/utils-users.inc.php on line 1944
RUNNING COMMAND: /usr/bin/snmptrap -v 2c -c public xx.xxx.xxx.xx:9030 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "xxxxxxxxxxxxx" nSvcDesc s "IIB Broker Status" nSvcStateID i 0 nSvcOutput s "OK - no errors or warnings" nHostAlias s "xxxxxxxxx" nSvcAttempt i 3 nSvcHostStateType i "SOFT"
No log handling enabled - turning on stderr logging
nSvcHostStateType: Value out of range (SOFT)

Re: Macros

Posted: Mon Mar 23, 2020 4:08 pm
by Box293
So there could be two issues going on here.

First I recommend rolling back the changes you made. You commented that traps are not sending any traps through the port. We need to resolve that issue before any customisations are made. Please follow this KB article to see if traps are being sent:

https://support.nagios.com/kb/article/s ... ic-86.html

This KB article is useful for sending a test trap manually:

https://support.nagios.com/kb/article/s ... p-493.html

Re: Macros

Posted: Tue Mar 24, 2020 2:03 am
by vignesha
Hi,
As per functionality after scheduled downtime ends nagios is not triggering any alerts, so we have raised a ticket with nagios support, as recommended we have created custom traps to send the alerts via port.

We have created one user as xxxx, and we have tagged this user to all the server/ services and we have created the command and we tagged to xxx user which can send the alerts via port and it was working fine as expected but in our environment we do have auto ticketing functionality is enabled for every alert triggered in nagios will send via snmptrap sender and will assign to respective team, suppose any communication/ glitch from source to destination server we are getting HARD alert for the service but once the services started working nagios is triggering 1/5 SOFT alert only post that clearing event is not sending to ServiceNow end. So we are planning to enable both HARD/SOFT alert but as per functionality nagios will send soft alert and it will create multiple tickets, so it will make much noise in PROD environment, to over this issue while sending snmptrap sender alerts by using $HostStateType$ and $ServiceStateType$ macros as hard/ soft we can easily filter, also the soft alert which are not required like Critical, Unknown, Warning can be suppressed from ServiceNow end and will allow only OK alerts to auto close the alerts

Host Trap Command:-
/usr/bin/snmptrap -v 2c -c xxxxx xx.xxx.xxx.xx:9030 '' NAGIOS-NOTIFY-MIB::nHostEvent nHostname s '$HOSTNAME$' nHostStateID i $HOSTSTATEID$ nHostOutput s '$HOSTOUTPUT$' nSvcAttempt i '$CURRENTATTEMPT$'

Service Trap Command:-
/usr/bin/snmptrap -v 2c -c xxxxx xx.xxx.xxx.xx:9030 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s '$HOSTNAME$' nSvcDesc s '$SERVICEDESC$' nSvcStateID i $SERVICESTATEID$ nSvcOutput s '$SERVICEOUTPUT$' nHostAlias s '$HOSTALIAS$' nSvcAttempt i '$currentattempt$'

Re: Macros

Posted: Tue Mar 24, 2020 4:02 pm
by Box293
vignesha wrote:also snmp trap is not sending any alert through the port,
Before going any further could you confirm if traps are being sent using the basic troubleshooting steps. Before we do any modifications we need to ensure everything is working.

Re: Macros

Posted: Wed Mar 25, 2020 11:19 am
by vignesha
Hi,

Yes, We have reverted back the changes, traps are sending to Servicenow end.

Could you please me to resolve this issue, as of now its making which noise in PROD and we are manually closing more number of tickets manually :( , post your update we will be first test in DR and will monitor for few days if every thing fine, will implement the changes in PROD.

Re: Macros

Posted: Wed Mar 25, 2020 5:19 pm
by Box293
Looking at this further it seems to be a bit more complicated than what can be handled in a forum ticket. Can you please create a support ticket and send through your system profile:

Click the Admin menu
System Config > System Profile
Click the Download Profile button and send us that file

https://support.nagios.com/kb/article/c ... r-769.html

Re: Macros

Posted: Thu Mar 26, 2020 12:09 pm
by vignesha
Hi,

We have created a Support Ticket "SNMPTRPAE Macros #990093" and we have included system profile for reference.

Re: Macros

Posted: Thu Mar 26, 2020 12:55 pm
by scottwilkerson
Moving to ticket, locking thread