Part 3 (in case you havent figured it out by now there is no particular order to my ramblings). I will probably bug a mod to rename these into order when I am done.
What are trappers?
Instead of asking the agent for the values defined on the server side, the monitored location can decide what items to send and on what interval.
This can be useful where there are many items receiving updates at different intervals or to feed the output from one command into multiple items on the server.
This doesn't make sense, do you have an example?
Sure. This script will send all the MySQL status variables (its a WIP so might be non functioning).
#!/bin/bash
echo "show global status" | mysql -N -uroot -pMYSQL_PASSWORD | awk -F'\t' '{ printf("- "); printf("mysql.status[\"%s\"]",$1); printf(" \"%s\"",$2); print ""; }' | zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i - | grep sent | awk '{ print $2 }' | sed 's/;$//'
echo "show variables" | mysql -N -pMYSQL_PASSWORD | awk -F'\t' '{ printf("- "); printf("mysql.var[\"%s\"]",$1); printf(" \"%s\"",$2); print ""; }' | zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -vv -i -
This script uses zabbix_sender to send the values for all mysql variables and status variables to the monitoring server, it is then possible to create items to receive this data and triggers to act upon it. Additional data that does not have a matching key will be discarded.
This script should be run on a cron, or even via a system.run item (or UserParameter). In which case you can also monitor its status.
Create items you say... how?
Create an item of type "Zabbix trapper", the key should exactly match the data sent from the trapper. Here is an example below of an item matching the output of this script.
What are trappers?
Instead of asking the agent for the values defined on the server side, the monitored location can decide what items to send and on what interval.
This can be useful where there are many items receiving updates at different intervals or to feed the output from one command into multiple items on the server.
This doesn't make sense, do you have an example?
Sure. This script will send all the MySQL status variables (its a WIP so might be non functioning).
#!/bin/bash
echo "show global status" | mysql -N -uroot -pMYSQL_PASSWORD | awk -F'\t' '{ printf("- "); printf("mysql.status[\"%s\"]",$1); printf(" \"%s\"",$2); print ""; }' | zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i - | grep sent | awk '{ print $2 }' | sed 's/;$//'
echo "show variables" | mysql -N -pMYSQL_PASSWORD | awk -F'\t' '{ printf("- "); printf("mysql.var[\"%s\"]",$1); printf(" \"%s\"",$2); print ""; }' | zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -vv -i -
This script uses zabbix_sender to send the values for all mysql variables and status variables to the monitoring server, it is then possible to create items to receive this data and triggers to act upon it. Additional data that does not have a matching key will be discarded.
This script should be run on a cron, or even via a system.run item (or UserParameter). In which case you can also monitor its status.
Create items you say... how?
Create an item of type "Zabbix trapper", the key should exactly match the data sent from the trapper. Here is an example below of an item matching the output of this script.