Alarm needed to only fire when a Host object is created or deleted.

I need the ability to have a simple rule scoped to fire when any Host object is created or deleted.

  • Hi John,

    There is no automatic trigger/callback/notification when a topology object is created in Foglight.

    That means that you'd need to keep track of the "current" list of Hosts and periodically check to see if the list has changed and trigger the alert accordingly. That check could be expensive, but should be OK if you don't need to do it very frequently. Would a daily update suffice?

    If so, I would suggest implementing a "derived metric" containing a list of current uniqueIDs for all Hosts.

    This list would be generated once daily (off hours) and compared to the previous list:

    def yesterday = ["host1", "host2", "host3"]

    def today = ["host1", "host2", "host4"]

    newHosts = today - yesterday     // ["host4"] in this eg

    removedHosts = yesterday - today // ["host3"] in this eg

    If the newHosts and removedHosts lists are not empty, use the Alarm API to fire an alert that describes the changes.

    Does that make sense?


    Brian Wheeldon

  • I'd think a quick/dirty solution for new hosts would be to look at something like #!Host:effectiveStartDate < 1.hour#; I think Brian suggestion is the only way for deleted hosts.

  • Small question, the cartridge does not delete Host objects afaik... so in which cases (apart from deletion through scripting) would you actually get removed hosts?

  • Sure, excellent point.

    The more general concept is to monitor for any 'unexpected' topology changes, whether or not they happen through the 'normal' process.

  • I think this has the potential to work for new objects without a lot of overhead, will have to think some more about it.