zabbix / community-templates

Zabbix Community Templates repository
https://share.zabbix.com
MIT License
1.39k stars 1.81k forks source link

App Varnish by Zabbix agent - AllowKey instead of EnableRemoteCommands #182

Open rafaelorafaelo opened 1 year ago

rafaelorafaelo commented 1 year ago

One should allow external commands with "EnableRemoteCommands=1" says the README. According to https://www.zabbix.com/documentation/6.2/en/manual/config/items/restrict_checks this is outdated. The new configuration is AllowKey=system.run[varnishstat -j].

Another point: because Zabbix usually runs as user zabbix and Varnish as user varnish, it's not allowed to access Varnish from Zabbix with varnishstat. I simply added user zabbix to the varnish group usermod -a -G varnish zabbix to get it working on Rocky 9/RHEL 9.

marco910 commented 1 year ago

It's working to retrieve the 'Varnish: Get status' and a few other data options. But most of the data options for Varnish are empty in Zabbix. Also, I get the problem message 'Varnish: Process is not running'. It looks like this:

zabbix-varnish

@rafaelorafaelo Did the same happen in your case?

rafaelorafaelo commented 1 year ago

Check ouput of varnishstat, when it's run as zabbix user, because this user is used by Zabbix Agent. You could check it with runas on the command line. If it doesn't work, you have to find a way to make it work. One approach is my solution to add the zabbix user to the varnish group, which is used to run the varnish daemon. Another approach is to make it running with the sudo system.

You can already see some values, because they come from data sources other than varnishstat.