Zabbix monitoring Nginx

Source: Internet
Author: User


Edit nginx.conf File


Add content inside the server

Location/nginx-status {

Stub_status on;

Access_log off;

}


2.zabbix AGENTD Client Configuration


Edit/usr/local/zabbix/etc/zabbix_agentd.conf

Add the following at the end of the file

Unsafeuserparameters=1

Userparameter=nginx.accepts,/usr/local/zabbix/scripts/nginx_status.sh accepts

Userparameter=nginx.handled,/usr/local/zabbix/scripts/nginx_status.sh handled

userparameter=nginx.requests,/usr/local/zabbix/scripts/nginx_status.sh Requests

Userparameter=nginx.connections.active,/usr/local/zabbix/scripts/nginx_status.sh Active

userparameter=nginx.connections.reading,/usr/local/zabbix/scripts/nginx_status.sh Reading

userparameter=nginx.connections.writing,/usr/local/zabbix/scripts/nginx_status.sh Writing

Userparameter=nginx.connections.waiting,/usr/local/zabbix/scripts/nginx_status.sh Waiting

3. Edit the nginx_status.sh file


cat/usr/local/zabbix/scripts/nginx_status.sh

#!/bin/bash

host=127.0.0.1 (If you write a domain name under each domain name)

Term=$1

# Functions to return nginx stats

Function Active {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | grep ' Active ' | awk ' {print $NF} '

}

function reading {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | grep ' Reading ' | awk ' {print $} '

}

function writing {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | grep ' Writing ' | awk ' {print $4} '

}

function waiting {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | grep ' Waiting ' | awk ' {print $6} '

}

function accepts {

/usr/bin/curl "/http $HOST: $PORT/nginx-status" 2>/dev/null | awk nr==3 | awk ' {print '} '

}

function handled {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | awk nr==3 | awk ' {print $} '

}

function requests {

/usr/bin/curl "/http $HOST/nginx-status" 2>/dev/null | awk nr==3 | awk ' {print $} '

}

$TERM


chmod +x/usr/local/zabbix/scripts/nginx_status.sh

4. Restart Zabbix_agentd


Service Zabbix_agentd Restart

5.zabbixweb Control-Side Import Template

6.zabbix Monitoring Client Add Nginx module


This article is from the "System website Operations" blog, please be sure to keep this source http://cgc243652136qq.blog.51cto.com/3989433/1828323

Zabbix monitoring Nginx

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.