Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that we can use nagios plugin notify-by-email to send emails for any kind of critical alerts. Now I want one email to be sent as a report for the critical alerts of last one day daily. Can someone please help me to solve this.

share|improve this question
up vote 6 down vote accepted

Now I want one email to be sent as a report for the critical alerts of last one day daily.

Edit the nagios.cfg to change the rotation method to daily:

# This is the log rotation method that Nagios should use to rotate
# the main log file. Values are as follows..
#   n   = None - don't rotate the log
#   h   = Hourly rotation (top of the hour)
#   d   = Daily rotation (midnight every day)
#   w   = Weekly rotation (midnight on Saturday evening)
#   m   = Monthly rotation (midnight last day of month)


then parse the nagios.log for the CRITICAL alerts, something like this:

awk '/SERVICE ALERT: .*;CRITICAL;HARD/ { print $0 }' nagios.log | \
    perl -pe 's/(\d+)/localtime($1)/e' | \
        mail -s "Nagios daily report $(date +%F)" <your_email>

Run the above command at the end of day as a daily cron job if you want.

share|improve this answer

You could look into http://<nagios-server>/cgi-bin/icinga/summary.cgi and select a report you want to see every day. After fiddling with the parameters, grab the URL of the generated report.

Now via cron do something like the following:

  • grab the report from said URL
  • if you want, preprocess and rearrange the html you just pulled down
  • send it via email
share|improve this answer

in order to call the cgis on the shell, you should consider reading those hints as well (they are targetting Icinga 1.x so some cgi params might not work with Nagios).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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