Is there any way to do LLD scripts that run on the zabbix server not the zabbix agent?
That may sound silly at first, but I want to set up items and triggers based on what templates are already applied to a host.
Here's the use case: All servers discovered and have templates for all services that should be there. I want to discover if a service pops up that should NOT be there, e.g. a web server opening up on a firewall, or an FTP or SMTP server on a host that should not have it. Basically to catch configuration mistakes, or things that come unexpectedly with upgrades/updates.
In concept this is simple to do... have LLD have a list of services, and let it check the host's zabbix configuration to see if they are already monitored (either by template name, or dive into the expressions). If any are not already monitored, then monitor for "down" and alert if "up".
In practice I can't see a legitimate way to check for this. I could do this during discovery, and have a bunch of negative rules (e.g. if SNMP service not found link template "smtp must be down") but that's both ugly and requires discovery running all the time. I was hoping to separate it from discovery. LLD is a great time and concept in which to check it -- I just don't have access to current host configuration information, at least so far as I can see. Do I?
Which is why I got excited seeing scriptable LLD's, then I realized the script is only on the agent (i.e. host) not the server. I need to see Zabbix's configuration to do this in a script.
The best I can come up with is using SQL to generate these from configuration data, then either blow them in directly (probably not, likely to conflict somewhere with caching and identity numbers), or script calls to the restful interface to link up the necessary templates (i.e. "NOT SMTP" template).
Any thoughts on a more zabbix-like approach to this? Some LLD magic?
That may sound silly at first, but I want to set up items and triggers based on what templates are already applied to a host.
Here's the use case: All servers discovered and have templates for all services that should be there. I want to discover if a service pops up that should NOT be there, e.g. a web server opening up on a firewall, or an FTP or SMTP server on a host that should not have it. Basically to catch configuration mistakes, or things that come unexpectedly with upgrades/updates.
In concept this is simple to do... have LLD have a list of services, and let it check the host's zabbix configuration to see if they are already monitored (either by template name, or dive into the expressions). If any are not already monitored, then monitor for "down" and alert if "up".
In practice I can't see a legitimate way to check for this. I could do this during discovery, and have a bunch of negative rules (e.g. if SNMP service not found link template "smtp must be down") but that's both ugly and requires discovery running all the time. I was hoping to separate it from discovery. LLD is a great time and concept in which to check it -- I just don't have access to current host configuration information, at least so far as I can see. Do I?
Which is why I got excited seeing scriptable LLD's, then I realized the script is only on the agent (i.e. host) not the server. I need to see Zabbix's configuration to do this in a script.
The best I can come up with is using SQL to generate these from configuration data, then either blow them in directly (probably not, likely to conflict somewhere with caching and identity numbers), or script calls to the restful interface to link up the necessary templates (i.e. "NOT SMTP" template).
Any thoughts on a more zabbix-like approach to this? Some LLD magic?


Comment