Macros

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vignesha
Posts: 115
Joined: Wed Oct 03, 2018 9:09 am

Macros

Post 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.
vignesha
Posts: 115
Joined: Wed Oct 03, 2018 9:09 am

Re: Macros

Post 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)
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Macros

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vignesha
Posts: 115
Joined: Wed Oct 03, 2018 9:09 am

Re: Macros

Post 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$'
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Macros

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vignesha
Posts: 115
Joined: Wed Oct 03, 2018 9:09 am

Re: Macros

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Macros

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vignesha
Posts: 115
Joined: Wed Oct 03, 2018 9:09 am

Re: Macros

Post by vignesha »

Hi,

We have created a Support Ticket "SNMPTRPAE Macros #990093" and we have included system profile for reference.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Macros

Post by scottwilkerson »

Moving to ticket, locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked