Page 1 of 1

custom manage service commands

Posted: Wed Feb 13, 2019 5:17 am
by ibmkenexa
Team,

I need a help to configure nagios alerts with custom "Recovery" and P1_PROBLEM_SERVICE tag in alert subject line.

Requirement: Add tags in subject line as below:

Custom command with subject line : "P1_RECOVERY_SERVICE_ALERT - Nagios Monitor XI Alert for recovery alerts" - It does not work if select only "r" option in manage service command options in contact management.

Custom command with subject line "P1_PROBLEM_SERVICE_ALERT - Nagios Monitor XI Alert" for CRITICAL alerts - It works if select both "c" and "r" options but subject line is showing same for both critical and recover alerts.

I have tried with a custom command as below and added in manage service command as "notify-service-by-email_IWR_P1_alerts_recovery_template" and selected "r" option in service notification options. (Did not check "c" option" ) - BUT no luck the manage service notification command is not trigger alerts.

Custom command for P1_RECOVERY_SERVICE_ALERT :

/usr/bin/printf "%b" "** P1_RECOVERY_SERVICE_ALERT - Nagios Monitor XI Alert - SL Washington DC And Toronto**\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$ \nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nThis monitor has been $SERVICESTATE$ for: $SERVICEDURATION$\n\nResponse Documentation URL: $SERVICENOTESURL$\n\nRecipients of this alert: $NOTIFICATIONRECIPIENTS$\n\nComments: $NOTIFICATIONCOMMENT$\n\nNotes: $SERVICENOTES$" | /bin/mail -s "** P1 RECOVERY Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" -r [email protected] $CONTACTEMAIL$


Customized command for P1_PROBLEM_SERVICE_ALERT :

/usr/bin/printf "%b" "** P1_PROBLEM_SERVICE_ALERT - Nagios Monitor XI Alert - SL Washington DC And Toronto**\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$ \nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nThis monitor has been $SERVICESTATE$ for: $SERVICEDURATION$\n\nResponse Documentation URL: $SERVICENOTESURL$\n\nRecipients of this alert: $NOTIFICATIONRECIPIENTS$\n\nComments: $NOTIFICATIONCOMMENT$\n\nNotes: $SERVICENOTES$" | /bin/mail -s "** P1 PROBLEM Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" -r [email protected] $CONTACTEMAIL$

Re: custom manage service commands

Posted: Wed Feb 13, 2019 1:51 pm
by benjaminsmith
Hi @ibmkenexa,

I have included a few links below on custom variables and how to configure notifications in Nagios XI. Please refer to those documents to help configure your notification templates and commands.

I see you have two subject lines: "P1_RECOVERY_SERVICE_ALERT - Nagios Monitor XI Alert for recovery alerts" and "P1_PROBLEM_SERVICE_ALERT - Nagios Monitor XI Alert". Under what conditions are your trying to change the notification subject?

References
Understanding Notification Variables

How to Configure Email And Text Notifications