Different Email subjects for different notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
DharmaNunna
Posts: 2
Joined: Thu Oct 14, 2021 10:30 am

Different Email subjects for different notifications

Post by DharmaNunna »

Hi,

How can I change the email subject for different host notifications?

Example:

Subject of email Notification for Host1 : CRITICAL - Host1 - CPU Usage
Subject of email Notification for Host2 : Host2 - CPU Usage - CRITICAL
deby23456
Posts: 21
Joined: Tue Apr 11, 2023 1:44 pm

Re: Different Email subjects for different notifications

Post by deby23456 »

Hello,

I got the following prompt straight from google. This isn't a fix to your issue but somewhere to edit and check if you can change it. Check on that and see what you see and edit it for testing.
"
The commands.cfg file is located in the Nagios configuration directory. The default location of the Nagios configuration directory is /etc/nagios/.

To change the subject name of host notification, you need to edit the notify-host-by-email command definition. The notify-host-by-email command definition is located in the commands.cfg file.

The notify-host-by-email command definition has a subject parameter. The subject parameter specifies the subject line of the email notification that is sent when a host alert is triggered.

To change the subject name of host notification, you need to edit the value of the subject parameter. The following is an example of how to change the subject name of host notification:

command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Subject: My Custom Subject\n******* Nagios *****\n\nNotification Type: NOTIFICATIONTYPE\nHost: HOSTNAME\nState: HOSTSTATE\n\nAdditional Info: HOSTOUTPUT\n"

In the example above, the subject line of the email notification is changed to "My Custom Subject".

Once you have edited the notify-host-by-email command definition, you need to restart the Nagios service. The Nagios service can be restarted by running the following command:


service nagios restart

Use code with caution. Learn more

After you have restarted the Nagios service, the new subject name of host notification will be used."


:D :D :D :D
DharmaNunna
Posts: 2
Joined: Thu Oct 14, 2021 10:30 am

Re: Different Email subjects for different notifications

Post by DharmaNunna »

So the issue with this is it would change the subject for all nottifications. I want to change the subject line only for a few server notifications.
bv406
Posts: 31
Joined: Tue Apr 11, 2023 11:45 am

Re: Different Email subjects for different notifications

Post by bv406 »

DharmaNunna wrote: Fri Jun 16, 2023 9:58 am So the issue with this is it would change the subject for all nottifications. I want to change the subject line only for a few server notifications.
Maybe refer to this document on how to customize notification messages
https://answerhub.nagios.com/support/s/ ... s-b902c496
Marilian
Posts: 5
Joined: Sun Jun 25, 2023 11:31 pm

Re: Different Email subjects for different notifications

Post by Marilian »

The problem is that doing so would divert the focus of all notifications. I'd like to customize the subject line for certain server alerts.
puppet hockey
Post Reply