nagios 日志未更新

nagios 日志未更新

每当我尝试在 ubuntu 中重新启动 nagios 和 postfix 时,var/log/mail.log 文件都不会根据当前进程进行更新。请帮我解决这个问题。

答案1

Nagios使用 来自 的命令发送邮件/usr/local/nagios/etc/objects/commands.cfg

根据nagios评论

################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require 
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################

安装mailxmail

sudo apt-get install mailx

并在同一个文件中检查命令使用/usr/bin/mail

例子

# 'notify-host-by-email' command definition
define command{
    command_name    notify-host-by-email
    command_line    /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$
    }

相关内容