19.12 Adding custom monitoring items
Ideas:
Client provisioning scripts Get data--server-side monitoring data collected with Zabbix_get Authentication Client->zabbix Management Interface Configuration Monitoring Entry->zabbix management interface configuration to graphical->zabbix management interface Configuration alarm (if required)
requirements: Monitor the number of 80-port connections for a web and plot.
- The implementation is divided into two steps:
- (1) Zabbix Monitoring Center to create a monitoring project
- For the first step, you need to define the script to the client:
vim/usr/local/sbin/estab.sh
- Add the following:
------------------------------------------------------------------
#!/bin/bash
#获取80端口并发连接数
Netstat-ant |grep ': |grep-c established
------------------------------------------------------------------
Let the user have permission to execute the script
chmod 755/usr/local/sbin/estab.sh
- Edit the configuration file on the client
vim/etc/zabbix/zabbix_agentd.conf//Increase
Unsafeuserparameters=1//means using a custom script
userparameter=my.estab.count[*],/usr/local/sbin/estab.sh
- Note: The above 1 sentence of the custom monitoring key is My.estab.count, the following [*] inside the script parameters, if no parameters can be omitted, the script is/usr/local/sbin/estab.sh
Restart Zabbix-agent Service
Systemctl Restart Zabbix-agent
- (2) Graphic display for the monitoring project
- First to the server authentication, execute the command:
Zabbix_get-s 192.168.168.130-p 10050-k ' My.estab.count '
- Then add monitoring items in the Zabbix Monitoring Center (browser) configuration:
Create a monitoring entry, configuration--host---(CENTOS_02) Monitoring item
Key-Value Write My.estab.countP2
- After you add the item, go to "monitoring", "latest data" to see if the item you just added has data. You can add graphics with the data:
Create a drawing, centos_02, configuration, host-
- Create a trigger to alert:
Create trigger with host--, centos_02 Trigger
Set the alarm when the number of connections >200
19.13/19.14 Configuring the message Alarm 19.15 Test alarm 19.16 Non-email problem handling
2018-4-16 Linux Learning Notes