Now I want one email to be sent as a report for the critical alerts of last one day daily.
Edite o nagios.cfg
para alterar o método de rotação para diário:
# LOG ROTATION METHOD
# 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)
log_rotation_method=d
depois analise o nagios.log
para os alertas CRITICAL, algo assim:
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>@domain.com
Execute o comando acima no final do dia como um trabalho cron diário, se desejar.