Ad Widget

Collapse

Is there an easier way - host groups vs macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Linwood
    Senior Member
    • Dec 2013
    • 398

    #1

    Is there an easier way - host groups vs macros

    There's a big overlap, at least in my mind, between host groups and macros.

    Let me use an example from real life -- I have a host group for "downtime expected" where I put hosts that are up and down frequently. I can then check that in the alert messages and not send email. Simple.

    However, it breaks down when you want to treat triggers (for example) differently. I'd like to trigger different actual alerts, one informative and one high, based on the host group (yes, I know some help for this is coming in V4, but it's an example not the only area). You can't (as best I can tell) test for host group membership inside of a trigger expression (can you?). But you can use macros. So I create a {$DOWNTIME_EXPECTED} macro and all is good, I can tag the hosts that need it and test for values - works great. but I can't use that in the alert actions. Perhaps more to the point, it's difficult to verify, you can't do a list of hosts with a specific macro (inside zabbix) like you can host groups.

    Now I worked around this in an ugly and unsupported way -- I have code that runs in postgresql and creates the macro based on the host group itself (and I call it in a database monitor item created on the zabbix host itself so it's running in the context of zabbix). Works OK, but not the greatest of approaches as I wouldn't really encourage people to modify the database directly.

    So my question is whether I'm missing something -- is there a better way to push host grouping into the various aspects of zabbix, from templates (triggers notably, but potentially item calculations)? Is anything on the V4 roadmap that I've missed in this regard? Or maybe I've just missed it and it's in 3.4.x.

    Another example: I want edge devices to behave differently, e.g. I create trigger dependencies so devices behind an edge device (as seen from zabbix) are dependent on the edge device, so if a site drops off line you get one alert, not dozens. It would be nice to have a host group of Edge Devices, but it's not usable in calculated items or triggers to change how (for example) the ping triggers (to make edge devices trigger faster so they are already triggered before the dependent ones try otherwise there's a race condition).

    It seems to me that while Macros are useful, Hostgroups are user friendly for binary items (inclusion or exclusion in a group), whereas Macros are not. Is there a better way?

    Or should I keep doing the SQL magic to drive one from the other?
Working...