I think in the command definition, $CONTACTEMAIL$ -- -r [email protected] should be: -r [email protected] $CONTACTEMAIL$ --
Please let us know if that resolves the issue for you.
Nagios Email Notification Setup
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Nagios Email Notification Setup
ok perfect, i made the change to use $CONTACTEMAIL$ at the end and now my from address shows up as i configured it, however the to address still shows up funny it shows my address im sending to (like its suppose to) but it also shows the servername "[email protected]; [email protected]"
as for sending email from nagios webpage im seeing some inconsistancy.
- sending a custom host check i get the email right away
- sending a custom service check i dont get the email
- doing a re-schedule check on a host that is down (to force a email alert) does not work, same for the service check
however in the log it shows the command was executed
as for sending email from nagios webpage im seeing some inconsistancy.
- sending a custom host check i get the email right away
- sending a custom service check i dont get the email
- doing a re-schedule check on a host that is down (to force a email alert) does not work, same for the service check
however in the log it shows the command was executed
Code: Select all
10-07-2016 12:51:06] SERVICE NOTIFICATION: Urgent; myvmhost.mycompany.com;Datastore VM-10GDATASTORE-2;CUSTOM (CRITICAL);notify-service-by-email;CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: line 161: --username: command not found;System Admin;sc
Service Notification[10-07-2016 12:51:06] SERVICE NOTIFICATION: Warning;myvmhost.mycompany.com;Datastore VM-10GDATASTORE-2;CUSTOM (CRITICAL);notify-service-by-email;CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: line 161: --username: command not found;System Admin;sc
External Command[10-07-2016 12:51:06] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;myvmhost.mycompany.com;Datastore VM-10GDATASTORE-2;0;System Admin;sc
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Nagios Email Notification Setup
dwhitfield wrote:I think in the command definition, $CONTACTEMAIL$ -- -r [email protected] should be: -r [email protected] $CONTACTEMAIL$ --
Please let us know if that resolves the issue for you.
Did you also update the notify-service-by-email commandscheema31 wrote:- sending a custom service check i dont get the email
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios Email Notification Setup
yes i made the same change to the notify-service-by-email command
i have also noticed that i do get emails from the nagios instance, just seems little lagged and the custom service one doesnt work.
do i need something different in my notify-service-by-email command?
thanks!
i have also noticed that i do get emails from the nagios instance, just seems little lagged and the custom service one doesnt work.
do i need something different in my notify-service-by-email command?
Code: Select all
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "* Nagios Host *\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -r [email protected] $CONTACTEMAIL$ --
}
Code: Select all
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "* Nagios Services *\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" --r [email protected] $CONTACTEMAIL$ --
}
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Nagios Email Notification Setup
There is something wrong with your service definition, see:the custom service one doesnt work.
line 161: --username: command not found;System Admin;sc
notify-service-by-email contains an extraneous --
SERVICESTATE$ **" --r [email protected] should be SERVICESTATE$ **" -r [email protected]
Previous Nagios employee
Re: Nagios Email Notification Setup
All is working well after the syntax change.
thanks for everyones help!
thanks for everyones help!
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Nagios Email Notification Setup
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!