5.Zabbix User parameter Configuration

Source: Internet
Author: User

I. Introduction of USER Parameters

Sometimes when we run a monitoring project that is not defined in the Zabbix predefined key, we need to manually write Zabbix user parameters to monitor the project we are defining. The Zabbix agent is required to write commands related to the get parameters to the Userparameter in the configuration file, and then zabbix the return value in the server read configuration file is returned to the user by processing the front end.

Here's how to define it:

In the monitored side/etc/zabbix/zabbix_agentd.d/directory, create *.conf end-of-file, write the get command within the file.

The syntax for the definition is as follows:

Userparameter=key[*],command

Parameter description:

Key: unique . [*] indicates that multiple parameters can be passed inside

Command:the script that needs to be executed,Keyof the[]the parameter one by one inside corresponds $to the$9, altogether9a parameter. $ A represents a script command.

Precautions:

If you need to use this variable in the command line, then you need to use two $$2, such as awk ' {print $$2} ', otherwise you will not get the data.

Second, monitoring memory parameters

Example: Under the/etc/zabbix/zabbix_agentd.d/directory of the monitored server node2, create a os.conf file that defines the value to get the memory

[Email protected] ~]# Vim/etc/zabbix/zabbix_agentd.d/os.confuserparameter=os.memory.used,free-m | awk '/^mem/{print $} ' [[email protected] ~]#/etc/init.d/zabbix-agent restart

Zabbix_server Server creates a new monitoring item apply the newly defined user parameter, where the key value just defined is used

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/1D/wKioL1Wx8VDgwaL5AAN9aC5DvLk176.jpg "title=" Define the monitoring item. jpg "alt=" wkiol1wx8vdgwal5aan9ac5dvlk176.jpg "/>

Define the diagram:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/1D/wKioL1Wx8dHAJl6IAAJIWSG_itM692.jpg "title=" Define the figure. png "alt=" wkiol1wx8dhajl6iaajiwsg_itm692.jpg "/> can see the data collected on the homepage graph

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/1E/wKioL1Wx9GjihcztAATdv86PYu4753.jpg "title=" Memory display. jpg "alt=" wkiol1wx9gjihcztaatdv86pyu4753.jpg "/> Client can also monitor memory for other parameters, such as getting the second total space, get the remaining space of the fourth paragraph

[Email protected] ~]# Vim/etc/zabbix/zabbix_agentd.d/os.confuserparameter=os.memory.used,free-m | awk '/^mem/{print $} ' #内存已用空间UserParameter =os.memory.free,free-m | awk '/^mem/{print $4} ' #内存剩余空间UserParameter =os.memory.total,free-m | awk '/^mem/{print $ ' #内存总空间 [[email protected] ~]#/etc/init.d/zabbix-agent restart

In defining a monitoring item to monitor memory remaining space

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/1E/wKioL1Wx9-_Dtbg7AANwALxaNDw080.jpg "title=" Defines memory idle. jpg "alt=" wkiol1wx9-_dtbg7aanwalxandw080.jpg "/> Definition pie chart showing memory used space and remaining space

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/1E/wKioL1Wx-MSBpb_xAAMsAsuXKGs202.jpg "title=" Two and one plot. png "alt=" wkiol1wx-msbpb_xaamsasuxkgs202.jpg "/> Graphics preview is shown below

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/21/wKiom1Wx9xXTHaXYAAG7Je10cDU040.jpg "title=" Graphics preview. png "alt=" wkiom1wx9xxthaxyaag7je10cdu040.jpg "/> three, monitoring nginx state parameters

Install Nginx, need to install Epel source

[email protected] ~]# Yum install nginx-y

Configure Nginx, add the following information to open the Nginx status page

[Email protected] ~]# vim/etc/nginx/conf.d/default.conf location/status {stub_status on; 34 Allow 192.168.1.0/24; Deny all; }[[email protected] ~]#/etc/init.d/nginx start

Set Complete access verification:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/1F/wKioL1WyAGHwhlR0AAD92YPo6T0819.jpg "title=" Nginx status also. png "alt=" wkiol1wyaghwhlr0aad92ypo6t0819.jpg "/>

Display Description:

Active Connections:2 # The number of connections currently in the open state;

Server accepts handled requests

2 2 2

(1) Number of connections that have been received

(2) Number of connections that have been processed

(3) The number of requests that have been processed and the number of requests that may be more than the number of connections in "Keep connected" mode;

reading:0 writing:1 waiting:1

Reading: The number of connections that are in the receiving request State;

Writing: The number of connections in the process of processing a request or sending a response when the request has been received;

Waiting: The number of connections that remain in connection mode and are active;

Defines the value that Userparameter uses to get the specified parameter:

[[email protected] ~]# vim /etc/zabbix/zabbix_agentd.d/nginx.confuserparameter= nginx.active[*], /usr/bin/curl -s  "Http://$1:$2/status"  | awk  '/^active/ { print  $NF} '           #监控activeUserParameter =nginx.reading[*],  /usr/bin/curl -s  "Http://$1:$2/status"  | grep  ' Reading '  | cut -d " "  -f2     #监控readingUserParameter =nginx.writing[*], /usr/bin/curl -s   "Http://$1:$2/status"  | grep  ' Writing '  | cut -d   " -f4      #监控writingUserParameter =nginx.waiting[*], /usr/bin/curl -s  "http://$1:$2/ Status " | grep  ' Waiting '  | cut -d"   " -f6    # Monitoring waitinguserparameter=nginx.accepted[*], /usr/bin/curl -s  "Http://$1:$2/status"  |  awk  '/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$1} '    #监控已接受连接UserParameter =nginx.handled[*], /usr /bin/curl -s  "Http://$1:$2/status"  | awk  '/^[ \t]+[0-9]+[ \t]+[0-9]+[  \t]+[0-9]+/ {print $$2} '     #监控处理过的连接UserParameter =nginx.requests[*], /usr/bin/ curl -s  "Http://$1:$2/status"  | awk  '/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[ 0-9]+/ {print $$3} '    #监控已经处理过的请求数 [[email protected] ~]# service  Zabbix-agent restart




This article from "Rookie First Fly" blog, declined reproduced!

5.Zabbix User parameter Configuration

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.