There is a notification queue, if you exceed a certain value, you need to call the police
The query interface can return the number of queues, in the form of the number of json,data followed by the number of queues
{"Code": 0, "message": "Success", "Data": 22}
Edit the configuration file in the Zabbix client zabbix_agentd.conf
Vim/usr/local/zabbix-agent/zabbix_agentd.conf
Add Blue Section
Logfile=/tmp/zabbix_agentd.log
# # #zabbix Service-side address
server=192.168.1.110
# #agent服务监听地址, which is the native address
#ListenIP =192.168.1.105
serveractive=192.168.1.110
# #zabbix-server End host address (Zabbix server)
Hostname=zabbix Server
#允许所有字符的参数传递给用户定义的参数
Unsafeuserparameters=1
#用户自定义key, Format: userparameter=key name, execute command
#例如: Serparameter=system.test,who|wc-l
userparameter=inform_queue,/usr/local/php/bin/php/usr/local/zabbix-agent/script/inform_queue.php
Create a directory Script
mkdir Script
Filtering directly with the shell is not very good, with PHP is better
Vim inform_queue.php
The code is as follows:
<?php
$str = file_get_contents (' Http://10.x.x.x/app/inform_queue ');
$json =json_decode ($STR);
Echo $json->data;
?>
Test execution PHP code to get the number 22
Restarting the Zabbix client
Killall-9 Zabbix_agentd
/usr/local/zabbix-agent/sbin/zabbix_agentd-c /usr/local/zabbix-agent/etc/zabbix_agentd.conf
Enter Zabbix server, use Zabbix_get
Zabbix_get parameter Description:
-S--host: Specifies the client host name or IP
-P--port: Client port, default 10050
-I--source-address: Specify the source IP, write the IP address of the Zabbix server, and generally leave it blank, if the server has multiple IPs, you specify one.
-K--key: You want to get the key
Test if the key value is in effect
/usr/local/zabbix/bin/zabbix_get-s 192.168.1.105-p10050-k Inform_queue
There is a number to return the description on it.
Go to the background page of the Zabbix server
Click on the host under Configuration , click on a host under the name (the one that modifies the configuration file)
To create a monitoring item, click Monitoring Items
Enter a name, select a type, the information type is a number, because script execution returns the format of a number
Enter the application set name
Click Update
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/AC/wKiom1coYD2hh1KAAABT2NgQK1g528.png "title=" 10.png "alt=" Wkiom1coyd2hh1kaaabt2ngqk1g528.png "/>
Create a trigger by clicking Trigger
Enter a name
Expression: {host_1:inform_queue.min (1m)}>3
Represents more than 3 in the last 1 minutes of the queue then the trigger expression will return true
Select severity, click Update
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/AC/wKiom1coZOeCJUayAAA56NJiOt8491.png "title=" 13.png "alt=" Wkiom1cozoecjuayaaa56njiot8491.png "/>
Create a graphic by tapping graphics
Enter a name, select the longitudinal axis to secure the
To add a monitoring item, click Update
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/AA/wKioL1coYoGSQ5sfAABJ85RQoIs025.png "title=" 11.png "alt=" Wkiol1coyogsq5sfaabj85rqois025.png "/>
Click on the graph in monitoring
Select Host, select Graphics Inform_queue
Wait a few minutes and there will be data.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/AC/wKiom1coYinjKmZFAABcHuAIpbU000.png "title=" 12.png "alt=" Wkiom1coyinjkmzfaabchuaipbu000.png "/>
This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1769766
Zabbix 3.0.2 Custom Scripts