anapsix / zabbix-haproxy

HAProxy Zabbix Discovery and Template
170 stars 77 forks source link

Confusing cache behavior #34

Closed Prev-I closed 7 years ago

Prev-I commented 7 years ago

I'm still inexperienced at using zabbix, so maybe i'm confusing myself....

From what I have understood the script sends cached data to zabbix every five minutes.

This behavior produce spikes in zabbix graphs because the server receive the data only once every five minutes but the agent request is more frequently. All other requests are treated as there is no data.

A better idea can be to send the cached data every time the agent asks, only refresh them after the specified time is passed

noamik commented 7 years ago

But that is what is actually happening. If you look into https://github.com/anapsix/zabbix-haproxy/blob/master/haproxy_stats.sh you can see that each time a query for a parameter is issued UserParameter=haproxy.stats[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 $4 , the get method extracts the relevant value from the cached line and prints it for the zabbix agent to send. Before the get method is executed the get_stats method is run and determines, whether the cache needs an update or not: get_stats && get "^${pxname},${svname}," ${stat}.

Prev-I commented 7 years ago

probably I was fooled by data...

Thanks for explanation, next time I will read more carefully the actual code.