有没有人知道在哪里可以修改nagios发送的通知,只有最后2个字节的ip可以说我的ip是192.168。 1.1
我想有xx1.1 os,可以用xsreplace,或者只查看最后2个八位字节
您可以在/etc/nagios/objects/commands.cfg编辑notify-host-by-email或notify-service-by-email命令定义来支持您的格式。
你需要修改
/etc/nagios3/commands.cfg
例如
'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$ }
也许修改这一点pipe道hostaddress通过切割命令,并得到你想要的八位字节…例如在这个例子