Zabbix's Custom key (10)

Source: Internet
Author: User


Custom key


The configuration file on the Zabbix agent defines user-defined parameters by the user through the Userparameter directive


Userparameter=<key>,<command>userparameter=<key[*]>,<command> $1...$9


Example 1 (without parameters)

[[email protected] ~]# Vim/etc/zabbix/zabbix_agentd.confuserparameter=system.memory.free,awk '/^memfree/{print /proc/meminfo[[email protected] ~]# systemctl restart zabbix-agent in server-side testing [[email protected] ~]# zabbix_get-s 10.1.249.168-k ' System.memory.free ' 89844


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/4B/wKiom1hI_1HydwLHAAAsguePnds119.png-wh_500x0-wm_3 -wmp_4-s_3420878369.png "title=" 1.png "alt=" Wkiom1hi_1hydwlhaaasguepnds119.png-wh_50 "/>



Example 2 (with parameters)

[[email protected] ~]# Vim/etc/zabbix/zabbix_agentd.confuserparameter=system.memory.usage[*],awk '/^$1/{print $$2} ' /proc/meminfo[[email protected] ~]# systemctl restart zabbix-agent in server-side testing [[email protected] ~]# zabbix_get-s 10.1.249.168-k ' system.memory.usage[memtotal] ' 493224[[email protected] ~]# zabbix_get-s 10.1.249.168-k ' System.memory.usage[memfree] ' 89188[[email protected] ~]# zabbix_get-s 10.1.249.168-k ' system.memory.usage[ Memavailable] ' 342664


Practical cases

(Monitor the Nginx status page for each indicator)

[[email protected] ~]# vim /etc/zabbix/zabbix_agentd.confuserparameter=nginx.status[*],/ tmp/status.sh $1[[email protected] ~]# vim /tmp/status.sh #!/bin/bash#host= 10.1.249.168port= ' statusurl= '/status ' active ()  {    curl -s http://${host }:${port}${statusurl} | awk  '/^active/{print $3} '}accepts ()  {     curl -s http://${host}:${port}${statusurl} | awk  ' nr==3{print $1} '}handled ()  {    curl -s http://${host}:${port}${statusurl} | awk  ' nr== 3{print $2} '}requests ()  {    curl -s http://${host}:${port}${statusurl } | awk  ' nr==3{print $3} '}reading ()  {    curl -s http:/ /${host}:${port}${statusurl} | awk  ' nr==4{print $2} '}writing ()  {     curl -s http://${host}:${port}${statusurl} | awk  ' nr==4{print $4} '}waiting ()  {     curl -s http://${host}:${port}${statusurl} | awk  ' nr==4{print $6} '}$ 1[[email protected] ~]# chmod +x /tmp/status.sh in server-side testing [[email protected] ~] # zabbix_get -s 10.1.249.168 -k  ' nginx.status[accepts] '//parameters can be changed




This article is from the "Homecoming" blog, make sure to keep this source http://sixijie123.blog.51cto.com/11880770/1880732

Zabbix's Custom key (10)

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.