nagios主配置文件 vi /usr/local/nagios/etc/nagios.cfg 从里面可以看到相关的cfg文件,相关路径。
检测tomcat8080端口是否存活,主要是通过访问/tomcat/webapps/test文件实现的
define command {
command_name check_tomcat8080
command_line $USER1$/check_http -I $HOSTADDRESS$ -p 8080 -u /test/test.jsp -e 200
}
邮件配置部分
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/local/bin/sendEmail -f jiankong@*****.com -t $CONTACTEMAIL$ -s *.*.*.* -u "** $NOTIFICATIONTYPE$ Host: $HOSTADDRESS$ is $HOSTSTATE$ **" -xu jiankong@***** -xp 123456
}
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/local/bin/sendEmail -f jiankong@******.com -t $CONTACTEMAIL$ -s *.*.*.* -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" -xu jiankong@******.com -xp 123456
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。