Good afternoon,
I am trying to graph some new metrics. The data looks like this:
show measurements
name: measurements
name
messages
show series from messages where (“host” =~ /myhost/)
messages,author=me,host=myhost,service=proc_php-fpm,type=service_notification
messages,author=check-mk-notify,host=myhost,service=fs_/,type=service_notification
SELECT count(“message”) FROM “messages” WHERE (“host” =~ /myhost/ AND “type” =~ /service_notification/) AND time > now() -8h
name: messages
time count
1522243635297572386 3
Returns 3 rows.
If I look into it a bit deeper I see the 3 messages.
SELECT distinct(“message”) FROM “messages” WHERE (“host” =~ /myhost/ AND “type” =~ /service_notification/) AND time > now() -8h
name: messages
time distinct
1522243679978667319 CRITICAL:
CRIT - 71 processes (ok from 1 to 60)(!!) 37342.1 MB virtual, 5331.7 MB physical, 198.3% CPU, youngest running for 112 sec, oldest running for 18 days
1522243679978667319 WARNING:
WARN - 67 processes (ok from 1 to 60)(!) 35202.5 MB virtual, 4952.9 MB physical, 160.4% CPU, youngest running for 172 sec, oldest running for 18 days
1522243679978667319 OK:
OK - 39 processes 20074.9 MB virtual, 2538.6 MB physical, 41.7% CPU, youngest running for 232 sec, oldest running for 18 days
Here is my ask:
How can I do a select count to only calculate results that are WARNING or CRITICAL? I don’t care about the OK notifications. I just want to trend the number of WARNING and CRITICAL notifications for a given host, in this case, ‘myhost’ and the result would be 2, not 3.