Search code examples
sensu

Filter every n:th event


Is there any way of creating a filter that filters every n:th event where n is different for different checks. I.e I would like to specify a field in each check such that I can control the filter frequency for different checks.

I have some checks that run once a day, some checks that runs once an hour and some that runs every minute. Using the same filter where I filter every n:th occurrence would not work for the different checks.

Is there any way of avoiding creating 10 different filters with different frequency?

Edit: I also have to create 10 different handlers, each that uses a different filter. Not a very clean solution and very much duplicated code.


Solution

  • The fine folks at Sensu have implemented what I asked for. It uses replacement tokens in the filter part as well now.

    {
      "filters": {
        "occurrences": {
          "negate": true,
          "attributes": {
            "occurrences": "eval: value > :::check.occurrences|60:::"
          }
        }
      }
    }