Zabbix Nginx error log monitoring

Source: Internet
Author: User

Customize the key value to match the number of Nginx error log occurrences 1 minutes ago.


Nginx_error_log Log Format:


2016/12/05 21:01:29 [ERROR] 13672#0: *440841 open () "/data/didipingang/steel-front/js/libs/ Angular-file-upload.js.map "failed (2:no such file or directory), client:10.10.1.27, Server: _, Request:" get/js/libs/a Ngular-file-upload.js.map http/1.0 ", Host:" Ddpg-static-steel-front "



The script is as follows:

#!/bin/bashfunction Error {date= ' date-d "1 minutes Ago" | awk ' {print $4} ' | cut-d:-f1,2 ' grep $date/usr/local/nginx/lo G/error.log | Egrep-i "Failed|no|not|denied|error" | Wc-l}$1



The results of the implementation are as follows:

$ sh error_log.sh error7



Add this line in the zabbix_agentd.conf file

Cat zabbix_agentd.confuserparameter=erro_log[*],/usr/local/zabbix/share/zabbix/alertscripts/error_log.sh $



Restart Zabbix Agent

/etc/init.d/zabbix_agentd restart


To add a Web monitoring template:

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/26/wKiom1hFcz-gQuDsAABjUuQXCls123.png-wh_500x0-wm_3 -wmp_4-s_187085551.png "title=" Zabbix1.png "alt=" Wkiom1hfcz-gqudsaabjuuqxcls123.png-wh_50 "/>



To add an app set:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8B/22/wKioL1hFc1jgwgdKAAA48UvEq-w339.png-wh_500x0-wm_3 -wmp_4-s_1907760133.png "title=" Zabbix2.png "alt=" Wkiol1hfc1jgwgdkaaa48uveq-w339.png-wh_50 "/>


To add a custom key:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8B/26/wKiom1hFc3jCmLD0AABrtDeynys651.png-wh_500x0-wm_3 -wmp_4-s_3695996778.png "title=" Zabbix3.png "alt=" Wkiom1hfc3jcmld0aabrtdeynys651.png-wh_50 "/>


To add a drawing:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8B/26/wKiom1hFc5Lh9o3kAABs5qFFELc637.png-wh_500x0-wm_3 -wmp_4-s_2571648833.png "title=" Zabbix4.png "alt=" Wkiom1hfc5lh9o3kaabs5qffelc637.png-wh_50 "/>


For the template, please go to the login to download:


This article is from the "LINUX Super Dream" blog, make sure to keep this source http://215687833.blog.51cto.com/6724358/1879738

Zabbix Nginx error log monitoring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.