I've seen questions here and there how to monitor multiple instances of the same service running on the same physical machine - with nothing elegant or scalable suggested.
-------------------------------------------------------------
There are two solutions I see for this, both require extending Zabbix. I'd like to receive feedback on them prior to deciding what to do next.
1) Parametrized templates
Implementation:
Pros:
Cons:
2) Separate host entry for each service instance
Implementation:
Pros:
Cons:
-------------------------------------------------------------
So, which way shall we go?
-------------------------------------------------------------
There are two solutions I see for this, both require extending Zabbix. I'd like to receive feedback on them prior to deciding what to do next.
1) Parametrized templates
Implementation:
- Introduce a concept of "abstract template" or "compile-time macros".
Upon linking with such template, a new template is generated with these macros substituted with given parameters. The generated template's attributes cannot be edited beyond what is available for a host attribute linked to a template. Upon altering the base template, the generated ones are regenerated. - Since such templates can be linked to others, an ability to link to a specific nested template multiple times has to be added as well (implies reference counting for correct unlinking and such).
Pros:
- "Natural" way of representation - everything regarding a server is within its host entry. In the hosts list, one can see all instances of all apps assigned to the machine (in "linked templates")
- The "abstract templates" make a basis for distributable libraries of templates to monitor all sorts of apps
- The service templates can make use of any other information available about the host: say, make triggers depend on "Ping failed"
Cons:
- Very complex design - a few new concepts and a whole new level of abstraction. A lot of work to implement this
- Complicates data view greatly - a server entry becomes very large and inconvenient to view. Entries of different instances must be labelled somehow to distinguish between them
- Any inter-host logic has to be duplicated at intra-host level
2) Separate host entry for each service instance
Implementation:
- Zabbix agent (active) must be made to support gathering info on several host entries at the same time. Specification variants: comma-separated list, any entries with the IP the agent is running at (it's better not implement wildcards - host entry names shall not be compound).
- Currently, this can be achieved by running several zabbix agents with different config files. But this requires supporting a multitude of files that are almost identical, and reconfiguration on client side is required after the list changes on the server side.
Pros:
- Very simple design, little changes needed
- Distributable templates can still be compiled
Cons:
- The link between the "base" host entry and its service entries is lost. To add the aforementioned trigger dependency, I have to do it manually or link every service entry to a "ping" template (and receive multiple notifications if it fires unless some trickery is done)
-------------------------------------------------------------
So, which way shall we go?
Comment