Fire events on strings in metrics

In the json data I collect from a rest api there are various string fields, e.g:
“healthStatus”: “UP”,
“status”: “SUCCEEDED”,
“status”: “OK”,

etc, for which I’d like to fire events if e.g. healtStatus changes to DOWN.

The normal mechanism to get an event from a collected value as I undersand it is to define a threshold. However, reading the source it seems that is only possible for numeric values as all ThresholdEvaluator instances only works with values as double. Ever for an expression the data that is ingested to the expression evaluator have only datatype double.

Is this correct? Is there another way to trigger an event from a string value in data fetched by collectd?

If your only approach is to collect via the json collector, then you are correct - you can’t threshold on non-numeric data types.

However, you could probably leverage the WebMonitor (or Http(s)Monitor, or PageSequenceMonitor…) to build a poller that checks for an output of “healthStatus”: “UP”, at the rest endpoint URL.

Well, not easily. As we discussed in the other thread I collect metrics as json data which contains a number of “store” indexed on a key. So far it works fine now, but I haven’t found a way to work with the string values.

The idea is to use Business Service Monitoring to model the system, and the events generated from these metric to be picked up there. It’s my understanding that’s the correct flow.

I’ve read on WebMonotor and PageSequenceMonitor but they don’t seem to be suitable for this task.

On the other hand I’ve been running the threshd in the debugger and it seems it shouldn’t be too hard to make thresholds more generic…

I have a few other concerns about thresholds, I’ll write them as separate threads to try not to mess up each topic.

Have you looked at the default config for the Elasticsearch poller? It uses a HttpMonitor to check if the status is anything but green. This check is done separately of any collection you may have configured, and would trigger a serviceDown event rather than a threshold.

1 Like

I think that would require setting up poll on each such parameter separately in a big json which may change dynamically, and would I be able to get the store id in that event? Well, probably if it would be set statically as metadata…

That may take a bit of regex magic to work out, though not knowing the entire content of the JSON, it can be difficult to suggest other specifics.