I've noticed a couple patterns in example monitoring setups for various services.
In both cases the daemons in question only provide their data in an oddly formatted ZOMGEVERYTHING dump that is expensive to generate and could impact performance if called too often.
I got to thinking about a better way to handle this came came up with something along the lines of memcached or possibly even just using memcached to store the key-values generated by these data scrapping scripts. The way I'm imagining this working right now is a new UserParameter type option in the agent that you specify a base key (bind9[*]), an life-time for the value, and a script scrapes the data out of the daemon and formats it into a list key: values. The agent then takes the output and stores it (in a memcached or internally) and responds to requests for that base key out of the cache until it expires, at which point it re-runs the script to get fresh data.
IE:
The template can then look for bind9.requests.query and bind9.requests.notify, etc
This way, instead of a wall of UserParameter= text that needs to be customized on every host individual daemon's stat gathering can be defined in the agent simply and any host specifics (paths, usernames, etc) can be declared only once. Also, it provides a simple, clean, consistant mechanism for feeding data into the agent and thus Zabbix without having to with the specifics zabbix_sender and Zabbix hostname individually for each monitored daemon, or deal with cron and items bouncing between supported & non-supported constantly because the cron'd script isn't running as fast as the zabbix_server likes.
Comments?
I may take a stab at implementing this, but it's been a while since I dealt with straight C.
- there is on script to dump the stats from the daemon and translate it into an easily parse-able form that either another script or grep & cut can extract through a series of long nasty UserParameter lines.
- A script is run via cron to extract the data from the daemon then upload it using zabbix_sender.
In both cases the daemons in question only provide their data in an oddly formatted ZOMGEVERYTHING dump that is expensive to generate and could impact performance if called too often.
I got to thinking about a better way to handle this came came up with something along the lines of memcached or possibly even just using memcached to store the key-values generated by these data scrapping scripts. The way I'm imagining this working right now is a new UserParameter type option in the agent that you specify a base key (bind9[*]), an life-time for the value, and a script scrapes the data out of the daemon and formats it into a list key: values. The agent then takes the output and stores it (in a memcached or internally) and responds to requests for that base key out of the cache until it expires, at which point it re-runs the script to get fresh data.
IE:
Code:
UserParameterKey=bind9,30,bind9stats.py
Code:
requests.query: 2097 requests.notify: 6 queries.a: 1352 queries.mx: 181 zones.discovery: JSONBLAH
This way, instead of a wall of UserParameter= text that needs to be customized on every host individual daemon's stat gathering can be defined in the agent simply and any host specifics (paths, usernames, etc) can be declared only once. Also, it provides a simple, clean, consistant mechanism for feeding data into the agent and thus Zabbix without having to with the specifics zabbix_sender and Zabbix hostname individually for each monitored daemon, or deal with cron and items bouncing between supported & non-supported constantly because the cron'd script isn't running as fast as the zabbix_server likes.
Comments?
I may take a stab at implementing this, but it's been a while since I dealt with straight C.
Comment