zabbix custom monitoring nginx status implementation process

zabbix custom monitoring nginx status implementation process

Zabbix custom monitoring nginx status

zabbix_server 192.168.200.145
zabbix_agentd, nginx 192.168.200.146

1. Open the status interface

Enable status:

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location /status {
     stub_status on;
     allow 192.168.200.146;
     allow 192.168.200.145
     deny all;
}
[root@localhost ~]# nginx -s reload 

insert image description here

Status page information details:

Status Code Meaning
Active connections 2 All currently open connections
accepts How many connections were processed in total
handled How many handshakes were successfully created
requests How many requests were processed in total?
Reading The number of header information read by nginx from the client, indicating the number of connections in the state of receiving requests
Writing The number of header information returned by nginx to the client, indicating that the request has been received and the number of connections that are in the process of processing the request or sending a response
Waiting When keep-alive is enabled, this value is equal to active - (reading + writing), which means that Nginx has processed the resident connection that is waiting for the next request instruction.

2. Write monitoring scripts

[root@localhost scripts]# vim check_status.sh
#!/bin/bash
ip=$(ip a | grep 'inet ' | grep -v '127.0.0.1' | awk -F'[ /]+' '{print $3}')
case $1 in
    "Reading")
    curl -s http://$ip | awk 'NR==4 {print $2}';;
    "Writing")
    curl -s http://$ip | awk 'NR==4 {print $4}';;
    "Waiting")
    curl -s http://$ip | awk 'NR==4 {print $6}'
esac

//Add configuration file [root@localhost scripts]# vim /usr/local/etc/zabbix_agentd.conf
UnsafeUserParameters=1
UserParameter=check_status[*],/bin/bash /scripts/check_Reading.sh $1
[root@localhost scripts]# pkill zabbix_agentd 
[root@localhost scripts]# zabbix_agentd 

//Test[root@zabbix ~]# zabbix_get -s 192.168.200.146 -k check_status Waiting
1

3. Configure monitoring items

insert image description here

insert image description here

insert image description here

4. Configure triggers

insert image description here

insert image description here

insert image description here

5. Testing

[root@localhost scripts]# ab -n 1500000 http://192.168.200.146/status

insert image description here

The above is the detailed content of the implementation process of Zabbix custom monitoring nginx status. For more information about Zabbix custom monitoring nginx, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • The whole process of Zabbix custom script monitoring nginx and WeChat alarm
  • Detailed tutorial on how to monitor Nginx/Tomcat/MySQL using Zabbix
  • Implementation of zabbix configuration nginx monitoring

<<:  Common styles of CSS animation effects animation

>>:  Why does using limit in MySQL affect performance?

Recommend

How to use MySQL 5.7 temporary tablespace to avoid pitfalls

Introduction MySQL 5.7 aims to be the most secure...

Detailed explanation of MySQL DEFINER usage

Table of contents Preface: 1.Brief introduction t...

Javascript to achieve the effect of closing advertisements

Here is a case study on how to close ads using Ja...

Detailed explanation of the use of state in React's three major attributes

Table of contents Class Component Functional Comp...

Detailed explanation of simple snow effect example using JS

Table of contents Preface Main implementation cod...

Four ways to create objects in JS

Table of contents 1. Create objects by literal va...

js to achieve the pop-up effect

This article example shares the specific code of ...

Summary of English names of Chinese fonts

When using the font-family property in CSS to ref...

Common writing examples for MySQL and Oracle batch insert SQL

Table of contents For example: General writing: S...

Tutorial on installing MySQL under Linux

Table of contents 1. Delete the old version 2. Ch...

Practical record of MySQL 5.6 master-slave error reporting

1. Problem symptoms Version: MySQL 5.6, using the...

Detailed explanation of Linux curl form login or submission and cookie usage

Preface This article mainly explains how to imple...

MariaDB-server installation of MySQL series

Table of contents Tutorial Series 1. Install Mari...