Re: [Nagios-users] Nagios "from" address change
Hello, I just saw your post on the nagios mailing list. I have changed my nagios to put the name of the server as the "from" server and put the severity and problem in the subject of the email. I have attached the script that I use for this. It uses sendmail specifically, so you may have to edit the sendmail path to suit your environment. You would add the following line to your misccommands.cfg: define command{ command_namenotify-by-email-spawner command_line/usr/bin/perl /usr/local/nagios/bin/email-spawner --notif icationtype "$NOTIFICATIONTYPE$" --notificationnumber "$NOTIFICATIONNUMBER$" --se rvicedesc "$SERVICEDESC$" --serviceduration "$SERVICEDURATION$" --hostalias "$HOS TALIAS$" --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --servicestate "$S ERVICESTATE$" --datetime "$LONGDATETIME$" --output "$SERVICEOUTPUT$" --contactema il "$CONTACTEMAIL$" --serviceackauthor "$SERVICEACKAUTHOR$" --serviceackcomment " $SERVICEACKCOMMENT$" } I have not done this for the host notifications, so you may want to play with it for that. And this is for nagios 2.x You can play with it to get it to work with nagios 1.x Thanks, Janet From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Buechler, Frank Sent: May 21, 2007 9:16 AM To: nagios-users@lists.sourceforge.net Subject: [Nagios-users] Nagios "from" address change Greetings all, My apologies in advance if this question has been hashed out here before. I have a request from management to change the "from" address in Nagios alerts. In other words, notifications come from "nagios@, my boss would like to see it be something different, as in "WhateverAlerts@". I've tried playing with genericstable in sendmail, and have been unsuccessful. Is there another way to do this? Thanks in advance, Frank email-spawner Description: email-spawner - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] Nagios "from" address change
Thanks Chris !! I actually managed to do what I needed using genericstables in sendmail, but this is a much more elegant solution. I like it, and I think I'll implement it here. Thanks again! Frank -Original Message- From: Christopher Odenbach [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 22, 2007 3:40 AM To: nagios-users@lists.sourceforge.net Cc: Buechler, Frank Subject: Re: [Nagios-users] Nagios "from" address change Hi, > My apologies in advance if this question has been hashed out here > before. I have a request from management to change the "from" address > in Nagios alerts. In other words, notifications come from "nagios@, my > boss would like to see it be something different, as in > "WhateverAlerts@". I've tried playing with genericstable in sendmail, > and have been unsuccessful. Is there another way to do this? We do: define command{ command_namenotify-by-email command_line/usr/bin/printf "%b" "* Nagios *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: \n\n$SERVICEOUTPUT$" | /usr/bin/mail -a "From: [EMAIL PROTECTED]" -a "Return-Path: [EMAIL PROTECTED]" -a "List-Id: Nagios " -s "[Nagios] **$SERVICEDESC$ at $HOSTALIAS$ ($NOTIFICATIONTYPE$) **" $CONTACTEMAIL$ } So /usr/bin/mail allows you to add additional headers, like "From" or "List-Id". Christopher -- == Dipl.-Ing. Christopher Odenbach Zentrum fuer Informations- und Medientechnologien Universitaet Paderborn Raum N5.110 [EMAIL PROTECTED] Tel.: +49 5251 60 5315 == - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] Nagios "from" address change
Hi, > My apologies in advance if this question has been hashed out here > before. I have a request from management to change the "from" address > in Nagios alerts. In other words, notifications come from "nagios@, > my boss would like to see it be something different, as in > "WhateverAlerts@". I've tried playing with genericstable in sendmail, > and have been unsuccessful. Is there another way to do this? We do: define command{ command_namenotify-by-email command_line/usr/bin/printf "%b" "* Nagios *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: \n\n$SERVICEOUTPUT$" | /usr/bin/mail -a "From: [EMAIL PROTECTED]" -a "Return-Path: [EMAIL PROTECTED]" -a "List-Id: Nagios " -s "[Nagios] **$SERVICEDESC$ at $HOSTALIAS$ ($NOTIFICATIONTYPE$) **" $CONTACTEMAIL$ } So /usr/bin/mail allows you to add additional headers, like "From" or "List-Id". Christopher -- == Dipl.-Ing. Christopher Odenbach Zentrum fuer Informations- und Medientechnologien Universitaet Paderborn Raum N5.110 [EMAIL PROTECTED] Tel.: +49 5251 60 5315 == pgp4uhsmzOXYo.pgp Description: PGP signature - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] Nagios "from" address change
> My apologies in advance if this question has been hashed out > here before. I have a request from management to change the > "from" address in Nagios alerts. In other words, > notifications come from "nagios@, my boss would like to see > it be something different, as in "WhateverAlerts@". I've > tried playing with genericstable in sendmail, and have been > unsuccessful. Is there another way to do this? It depends how you're sending the mail. The genericstable approach should probably work if set up correctly, as would adding a "From" header to outgoing mail. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null