Kafka connector status alerting

Dear community out there,

I have a dashboard which monitoring kafka connector status, it’s visualizing as expected.

query used for the visualization:

sum (kafka_connect_connector_metrics{instance=~"$instance", job=~"$job", cluster=~"$cluster",connector=~"$connector",status!=""}) by (status) 

Which is giving output something lime this:

  • paused Last : 1 * running Last *: 1

so the problem is if we stopped the connector still getting status 1 but time series graph shows in different color for paused and running.

I have created a alert

I have created a alert query:

sum by(status) (kafka_connect_connector_metrics{instance=~".+", job=~"xxxxxx", cluster=~"xxxxxxxx", connector=~"xxxxxxxxxxxxxxxxxxx", status="running"})

alert condition:

Issue: Issue with the alerting, because when paused the connector and i can see in the dashboard that connector stopped, but i am getting value for both running and paused 1, this is reason alert unable to trigger because looking values below 1 but paused status gives also 1, i was hoping to get value 0 when connector paused.

Any idea help in this situation.
Thanks in advance.