In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the configuration of zabbix monitoring nginx". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the configuration of zabbix monitoring nginx.
I. modify the configuration
Modify the nginx configuration file and add this configuration at the end. In fact, php and nginx are configured together and taken out separately for scripting.
Server {listen 127.0.0.1 server_name 80; server_name 127.0.0.1; location / nginx_status {stub_status on; access_log off; allow 127.0.1; deny all } # location ~ ^ / (phpfpm_status) ${# include fastcgi_params; # fastcgi_pass 127.0.0.1 include fastcgi_params; 9000; # fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; #}}
2. Restart nginx
# service nginx restart
Third, configure the monitoring extension
For the monitored host, add this to the zabbix_agentd.conf file:
UserParameter=nginx [*], / etc/zabbix/scripts/nginx_status.py $1
4. Place the script in the / etc/zabbix/scripts/ directory
Chmod + x nginx_status.py
5. Script
#! / usr/bin/env python#__*__coding:utf8__*__import urllib2,sys Osdef Nginx_status (): nginx_stats_dirt = {} nginx_url = "http://127.0.0.1/nginx_status" req = urllib2.Request (nginx_url) response = urllib2.urlopen (req) request_list = response.read (). Split ("\ n ") nginx_stats_dirt [" active "] = request_list [0] .split () [2] nginx_stats_dirt [" accepts "] = Request_list [2] .split () [0] nginx_stats_dirt ["handled"] = request_list [2] .split () [1] nginx_stats_dirt ["requests"] = request_list [2] .split () [2] nginx_stats_dirt ["reading"] = request_list [3] .spl it () [1] nginx_stats_dirt ["writing"] = request_list [3] .split () [3] nginx _ stats_dirt ["waiting"] = request_list [3] .split () [5] if len (sys.argv) is not 2 or str (sys.argv [1]) not in nginx_stats_dirt.keys (): print "Usage: nginx_stauts.py $1 {active | accepts | handled | reading | writing | waiting}" exit (1) else: print nginx_stats_ dirt [str (sys.argv [1])] if _ _ name__ = ='_ main_ _': try: Nginx_status () except urllib2.URLError E: print "% s there may be something wrong with nginx!"% e Thank you for your reading. The above is the content of "zabbix monitoring nginx configuration". After the study of this article, I believe you have a deeper understanding of the configuration of zabbix monitoring nginx, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.