Active patterns are not only provided by templatesStandard detector
way
Zabbix-agent operates in two modes: active mode and passive mode. Default passive mode.
- In passive mode, the server uses Zabbix_GET to obtain data from the Agent.
- Active mode: The Agent actively pushes data to the server, and the server uses the Zabbix_Sender to push customized data to the server. The server uses a collector to collect such data.
Note that passive mode notes the configuration file :server= parameter configuration. This parameter specifies who the agent will allow to fetch data. If set to 127.0.0.1, data will only be retrieved locally.
Look at the picture at the picture
Use the built-inCopy the code
Custom keys are usedCopy the code
Zabbix collectorCopy the code
The client executes the send command.
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "temp.cpu"33.32 - oCopy the code
Zabbix_sender Sends the packet to the server collector. Currently, the packet is sent periodically.
A simple script
#! /bin/bash
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "temp.cpu" -o $(sensors -u coretemp-isa-0000 |grep temp1_input:|cut -c 16-55) &>/dev/null
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "fan.cpu" -o $(sensors |grep fan2 |awk '{print $2}') &>/dev/null
Copy the code
Scheduled task (sent once in 20s)
crontab -e
* * * * * sh /root/zabbixS.sh
* * * * * sleep 20 ; sh /root/zabbixS.sh
* * * * * sleep 40 ; sh /root/zabbixS.sh
Copy the code
Added on July 14
Interpreter difference
Timed task scripts, note the difference between the SH interpreter (on some systems, sh only wants the DASH interpreter) and the bash interpreter.
Details you can refer to: stackoverflow.com/questions/5…
case
Failed to execute correctly using the SH interpreter. The Bash interpreter is fine.
test $(($RANDOM%2)) && zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "ip" -o `curl -s ip.cip.cc` &>/dev/null || zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k "ip" -o `curl -s iiip.co` &>/dev/null
Copy the code