I have been trying to figure out how to write OR function with prometheus inside Grafana. I ahve been reading Operators Prometheus and so far I was only able to get a positive sum where the negative doesn’t seem to work.
The positive scenario is that when the response is either 200 or 404 sum(scraper_request_count_total{http_status=~"200|404"})
then its a successful request and everything else is failed requests. I thought it would work by doing sum(scraper_request_count_total{http_status!="200|404"})
but it doesn’t, that gives me an ouput that its failed request even though the request is returning 200.
My question is, how can I write a “negative” OR function where I want the response to NOT be either 200 OR 404, meaning all other response status code is counted as false if not 200/404
- What Grafana version and what operating system are you using?
Grafana 6, Debian