Hide ipaddress from showing on sendmail alerts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
seboagwu
Posts: 1
Joined: Mon Oct 31, 2016 2:19 pm

Hide ipaddress from showing on sendmail alerts

Post by seboagwu »

I currently have alerts that have been created and mails that are sent to me but when i receive alerts and notifications it uses the ip address. This is a security risk. I would like to fin out if there's a way to mitigate that and have the alerts show NULL value or no value with the address section:

Host: server2302
Alias: OpenAM_prod
Address: xx.xxx.194.15
Service: NTP Time
State: CRITICAL -> OK (RECOVERY)
Command: check_mk-ntp.time
Output: OK - sys.peer - stratum 2, offset -20.00 ms, jitter 14.27 ms, last reached 60 secs ago (synchronized on xx.xx.248.20)
Perfdata: offset=-20.005;200;500;0; jitter=14.274;200;500;0;
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Hide ipaddress from showing on sendmail alerts

Post by rkennedy »

Are you using Nagios XI, or Nagios Core?

Regardless, you should be able to modify the notification commands, and remove the part that mentions the $HOSTADDRESS$ macro. For example -

Code: Select all

define command {
       command_name                             notify-host-by-email
       command_line                             /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Remove the \nAddress: $HOSTADDRESS$ part -

Code: Select all

define command {
       command_name                             notify-host-by-email
       command_line                             /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
If it's XI, you'll want to modify the email template associated with the user.
Former Nagios Employee
Locked