ITRS-Group / monitor-merlin

Module for Effortless Redundancy and Loadbalancing In Naemon
https://itrs-group.github.io/monitor-merlin/
GNU General Public License v2.0
22 stars 14 forks source link

Apps: fix exception in mon check distribution #60

Closed jacobbaungard closed 4 years ago

jacobbaungard commented 4 years ago

This fixes a regression that occurred due to the fix of MON-10954.

If there are no expired checks, the list of expired checks is empty, hence the 0th index could not be checked. This commit puts a safeguard around the check.

This fixes: MON-12097

jacobbaungard commented 4 years ago

Note, because CS wants this to be put out as a hotfix, this a based of the 2020.c.1 tag rather than the latest master.

For merging to master I think we need a different PR here: https://github.com/ITRS-Group/monitor-merlin/pull/61

erikdsjostrom commented 4 years ago

Damn, you were faster than me! I think perhaps a cleaner solution would be to move line 83-84 after line 90 and make it an elif like this:

    if not expired:
        print "OK: All %i nodes run their assigned checks" % (len(info),),
        state = 0
    elif list(expired)[0] == -1:
        return 1

Since empty collections in python are falsy.

jacobbaungard commented 4 years ago

I think we want to do it before we call get_merlin_nodeinfo otherwise, the error message when the query handler is down (i.e. due to a poller with a bad hostgroup) is printed twice. Because the query handler is queried both on get_expired and get_merlin_nodeinfo

kdnilsson commented 4 years ago

Once this has been verified I will update our repos and build new versions of tar-ball, iso, ova and publish them

jacobbaungard commented 4 years ago

Verification will need to be done directly on this branch without merging right?

kdnilsson commented 4 years ago

Yes I think so

jacobbaungard commented 4 years ago

Closing this PR as hotfix has been released. https://github.com/ITRS-Group/monitor-merlin/pull/61 for merging to the master branch.