zabbix nginx error log监控
生活随笔
收集整理的這篇文章主要介紹了
zabbix nginx error log监控
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
自定義key值,匹配1分鐘前nginx error log出現的次數。
nginx_error_log的日志格式:
腳本如下:
#!/bin/bash function?error?{ date=`date?-d?"1?minutes?ago"?|?awk?'{print?$4}'?|?cut?-d:?-f1,2` grep?$date?/usr/local/nginx/log/error.log?|?egrep?-i?"failed|no|not|denied|error"?|?wc?-l } $1執行結果如下:
$?sh?error_log.sh?error 7在zabbix_agentd.conf文件添加此行
cat?zabbix_agentd.conf UserParameter=erro_log[*],/usr/local/zabbix/share/zabbix/alertscripts/error_log.sh?$1重啟zabbix agent
?/etc/init.d/zabbix_agentd?restart添加web監控模板:
添加應用集:
添加自定義key:
添加繪圖:
模板請到入監下載:
轉載于:https://blog.51cto.com/215687833/1879738
總結
以上是生活随笔為你收集整理的zabbix nginx error log监控的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 探索ASP.NET MVC5系列之~~~
- 下一篇: Js文件中调用其它Js函数的方法(转)