Greetings,
Many of us have been there. You want to add a new UserParameter item, but to do so, means you have to push out the new script to each client, then you have to stop and restart Zabbix Agentd, then you have to go through the UI and enable the items. It got so bad for me recently, that I sat down and started writing an Agent side plugin system. But what if there is an easier way?
This weekend, I was in the middle of working on the plugin system and I had a thought. WHY??? Why not just use a single UserParameter entry that calls a simple wrapper? What I came up with is the following;
zabbix_agentd.conf
Zabbix Items
/opt/zabbix/lib/zabbix.plugin
Obviously there needs to be a bit more meat in the zabbix.plugin, but it is working right now for single argument commands. By doing this, I still need to push out the code to all of the clients, but I no longer need to restart the Zabbix Agent(d) when I add new checks, nor do I need to push out the new code before I add the item checks to the server.. I can pre-load the new item checks without fear of breaking anything when the Zabbix Agent(d) returns an incorrect value type, instead a zero gets returned if the wrapper doesn't know how to handle the new item yet.
Many of us have been there. You want to add a new UserParameter item, but to do so, means you have to push out the new script to each client, then you have to stop and restart Zabbix Agentd, then you have to go through the UI and enable the items. It got so bad for me recently, that I sat down and started writing an Agent side plugin system. But what if there is an easier way?
This weekend, I was in the middle of working on the plugin system and I had a thought. WHY??? Why not just use a single UserParameter entry that calls a simple wrapper? What I came up with is the following;
zabbix_agentd.conf
Code:
UserParameter=zabbix.plugin[*],/opt/zabbix/lib/zabbix.plugin $1
Code:
zabbix.plugin['uptime'] zabbix.plugin['ping zabbix.zabbixtest.net'] zabbix.plugin['load cpu0'] zabbix.plugin['load cpu1']
Code:
#!/bin/bash
#
# Simple Wrapper Script
case ${1} in
"uptime")
/usr/bin/uptime
;;
"ping")
/bin/ping -c 1 ${2} | grep "packets transmitted"
;;
...
*)
/bin/echo "0"
;;
But even 1.1 and dev versions of 1.4 require Zabbix Agent(d) restart when you add new UserParameter entries and the Agent(d) plugin system is still in development.
Comment