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
Different Email subjects for different notifications
-
- Posts: 2
- Joined: Thu Oct 14, 2021 10:30 am
Re: Different Email subjects for different notifications
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."
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."
-
- Posts: 2
- Joined: Thu Oct 14, 2021 10:30 am
Re: Different Email subjects for different notifications
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.
Re: Different Email subjects for different notifications
Maybe refer to this document on how to customize notification messagesDharmaNunna 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.
https://answerhub.nagios.com/support/s/ ... s-b902c496
Re: Different Email subjects for different notifications
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
puppet hockey