Closed araujorm closed 3 years ago
First proposal was not quite correct, now it should be OK.
Thanks a lot for your time and effort to fix the bug and enhance the plugin :). Just tested your commit and it seems to be working great and I merged your pull request.
Good point with the regular expressions for the filter to give it more flexibility.
Currently to be able to use exclude filters, one has to have an include filter. A requirement that prevents the check being used for simple excludes like the following:
which is useful if one wants to be alerted about everything except virtual machine cpu usage alerts (and as this example, more aren't hard to imagine).
Worse, this always yields OK, even if there are other alerts that don't contain the aforementioned substring, which I think isn't the expected behaviour.
This commit should fix the above issues.
Side note about something this pull request doesn't address, but should be considered to the future: the wildcard syntax currently implemented is very limited, as it only supports
*string*
patterns and not other variants likestring*
orst*ring
. I would suggest replace (or if backwards compatibility is a concern, complement e.g.i=datastore:bastion,e~name=^Virtual.*CPU
) with perl regular expressions on the filters, as that is given for free with perl, would be more complete and (in case of replacing) should quite simplify and reduce the code.