In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Edit the configuration file of nginx and add the following under server:
Location / status {
Stub_status on
Access_log off
Allow 127.0.0.1
Deny all
}
Save exit and restart nginx
2. Create a script directory to monitor nginx
Mkdir / usr/local/zabbix/libexec
3. Vim / usr/local/zabbix/libexec/nginx.sh & & chmod + x / usr/local/zabbix/libexec/nginx.sh
#! / bin/bash
# # #
# Description:zabbix monitors nginx through status module
# Note:Zabbix 3.2
# DateTime: 2016-11-22
# # #
HOST= "localhost"
PORT= "80"
Function ping {
/ sbin/pidof nginx | wc-l
}
Function active () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | grep 'Active' | awk' {print $NF}'
}
Function accepts () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | awk NR==3 | awk'{print $1}'
}
Function handled () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | awk NR==3 | awk'{print $2}'
}
Function requests () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | awk NR==3 | awk'{print $3}'
}
Function reading () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | grep 'Reading' | awk' {print $2}'
}
Function writing () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | grep 'Writing' | awk' {print $4}'
}
Function waiting () {
/ usr/bin/curl-s "http://$HOST:$PORT/status/" 2 > / dev/null | grep 'Waiting' | awk' {print $6}'
}
Case "$1" in
Active)
Active
Accepts)
Accepts
Handled)
Handled
Requests)
Requests
Reading)
Reading
Writing)
Writing
Waiting)
Waiting
*)
Echo $"Usage $0 {active | accepts | handled | requests | reading | writing | waiting}"
Exit
Esac
4. Create a key monitored by zabbix_agentd
Vim / usr/local/zabbix/etc/zabbix_agentd.conf.d/userparameter_nginx.conf
UserParameter=nginx.status [*], / usr/local/zabbix/libexec/nginx.sh $1
Restart zabbix_agentd
5. Test script and key
[root@zabbix ~] # vim / usr/local/zabbix/etc/zabbix_agentd.conf.d/userparameter_nginx.conf
[root@zabbix] # / usr/local/zabbix/libexec/nginx.sh-h
Usage / usr/local/zabbix/libexec/nginx.sh {active | accepts | handled | requests | reading | writing | waiting}
[root@zabbix ~] # / usr/local/zabbix/libexec/nginx.sh accepts
2016
[root@zabbix] # / usr/local/zabbix/bin/zabbix_get-s 127.0.0.1-k 'nginx.status [accepts]'
nine hundred and sixty five
6. Import templates and manage hosts
Template: nginx.xml
7. Verification
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.