zabbix自定义监控3(2.4网页报警,邮件报警)
参考:http://fengxiaoli.blog.运维网.com/12104465/1954649http://fengxiaoli.blog.运维网.com/12104465/1954654
1.Zabbix客户端配置
# cat /tmp/user.sh
#!/bin/bash
uptime |awk '{print $4}'
# vim /etc/zabbix/zabbix_agentd.conf
UserParameter=login-user,/bin/bash /tmp/user.sh(可以跟脚本,可以跟命令,这里的login-uesr是key值,可以自己命名,不要和已有key冲突)
2.Zabbix服务端测试
#yum install -y zabbix-get
# zabbix_get -s 192.168.10.128 -k login-user
2
3.创建Items(监控的项)
https://s5.运维网.com/wyfs02/M00/9E/02/wKiom1mJ3RmRlZeqAACd75t3Kf0633.png
https://s4.运维网.com/wyfs02/M00/9E/02/wKioL1mJ3RqyQ8Q3AAFOS4uK2U8734.png
https://s5.运维网.com/wyfs02/M00/9E/02/wKioL1mJ3RuTF_uyAACvm6mmSTY443.png
https://s5.运维网.com/wyfs02/M01/9E/02/wKiom1mJ3Rzg499kAABPUkmJpiI462.png
4.创建Graphs
https://s2.运维网.com/wyfs02/M02/9E/03/wKiom1mJ3o-gcIPLAACbi07colI283.png
https://s2.运维网.com/wyfs02/M02/9E/02/wKioL1mJ3pDxnm0yAADCVkLKyz4386.png
https://s2.运维网.com/wyfs02/M00/9E/03/wKiom1mJ3pCyXXeoAABCC2I4sbU811.png
https://s3.运维网.com/wyfs02/M00/9E/03/wKiom1mJ3pGQJvbRAAB75IU9-gw484.png
5.创建触发器triggers(网页报警)
https://s1.运维网.com/wyfs02/M01/9E/02/wKioL1mJ3zDTql-TAADaUGv4pYs726.png
https://s4.运维网.com/wyfs02/M00/9E/02/wKioL1mJ3zGQCjpLAAGjxdvW6TE531.png
https://s4.运维网.com/wyfs02/M02/9E/03/wKiom1mJ3zGiaZRKAABRXsSO12s105.png
https://s4.运维网.com/wyfs02/M02/9E/02/wKioL1mJ3zKAWbFMAAAyneyzDm8959.png
6.邮件报警设置:action
https://s2.运维网.com/wyfs02/M02/9E/03/wKiom1mJ37GSr9LpAACktyJ46dE980.png
https://s2.运维网.com/wyfs02/M00/9E/03/wKiom1mJ37Gj9oLSAACXHJxCX_o811.png
https://s5.运维网.com/wyfs02/M00/9E/02/wKioL1mJ37LjqsO-AAB9o_jZPSc493.png
https://s5.运维网.com/wyfs02/M01/9E/03/wKiom1mJ37PwVcN7AAB_jbUqdgM767.png
https://s1.运维网.com/wyfs02/M02/9E/02/wKioL1mJ37OAvyihAABxnflb3v4783.png
设置通过脚本发邮件
设置报警脚本路径
# vim /etc/zabbix/zabbix_server.conf
AlertScriptsPath=/usr/lib/zabbix/alertscripts
# cd /usr/lib/zabbix/alertscripts
# cat sendmail.sh 实际这里应该写发送邮件脚本,这里进测试
echo "$1 $2 $3" >> /tmp/test如果/tmp/test出现内容则发送成功
https://s3.运维网.com/wyfs02/M00/9E/03/wKiom1mJ4HSgF9uJAAC0Nnd4T7Q789.png
https://s5.运维网.com/wyfs02/M01/9E/03/wKioL1mJ4HXwYi-1AABsMuB1YAA598.png
https://s5.运维网.com/wyfs02/M02/9E/03/wKiom1mJ4HWQSMu-AADV49ktMn8416.png
https://s3.运维网.com/wyfs02/M02/9E/03/wKioL1mJ4HbQwbzcAABHyvHYZ5g680.png
https://s3.运维网.com/wyfs02/M00/9E/03/wKioL1mJ4HbQTcSRAABuJ3d0w0c969.png
https://s3.运维网.com/wyfs02/M00/9E/03/wKiom1mJ4IehRhopAAA1cqdJr3M918.png
https://s5.运维网.com/wyfs02/M00/9E/03/wKioL1mJ4Iiy-iiQAABscwHErps244.png
发送成功
# cat /tmp/test
Original event ID: 400*:*UNKNOWN*): *UNKNOWN* loginuser>2
页:
[1]