I have been fighting with this virtual server for a week to get it to send emails from nagios using sSMTP. I finally today got it to be able to send emails from the telnet, and through the nagios core. but the problem I am having seems to be lying in the command to send emails.

The current config I am using for the email is Notify-service-by-email Command is:/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

The one for the host is notify-host-by-email command is:/usr/bin/printf "%b" "***** Nagios *****\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$ **" $CONTACTEMAIL$

I am just trying to get this thing to send me emails when one of my websites is down/responding really slow. I have everything else configured roughly how it needs to be. I can go into a service under nagios core and click send custom notification and that goes through just fine. Just not standard emails when the site is giving a warning, such as when it's ping hits over 1000ms.

Any suggestions would be greatly appreciated. Thank you.

  • If the custom notification is working, then the problem isn't the notification command. Add a service definition and contact definition to the question. Also show relevant log lines. – Keith Oct 23 '15 at 2:32
  • I looked at it and it is apparently working, i got over 200 emails from my nagios config when latency spiked up during a backup. – Cody Oct 27 '15 at 17:43

It was configured properly using the info above, i just was using the wrong thing to test it. The command I was using was to test latency and I was trying to test downtime.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.