r3kzi / clamav-prometheus-exporter

Prometheus-Exporter for ClamAV
Apache License 2.0
26 stars 21 forks source link

Purpose dashboard example for Grafana #8

Closed ldubut closed 2 years ago

logopk commented 2 years ago

Thanks for that. That was missing.

I have a problem with escaping in the instance variable:

clamav_pools_used_bytes{instance="$instance"}

with instance variable value: "machine.mydomain.tld:9810" leads to

clamav_queue_length{instance='machine\\.mydomain\\.tld:9810'}

without result. I have other cases where this works correctly.

What am I missing!

Thanks Peter

ldubut commented 2 years ago

Hello, I didn't understand why you are trying to escape dots.

If you try to replace $instance variable in dashboard json, you shouldn't do this. Value are automatically get from prometheus query.

If you try to execute your own query for another pannel of anything else, I don't remember a case who need to escape dot character. A query like clamav_queue_length{instance="machine.mydomain.tld:9810"} should working fine

Have you try to execute clamav_queue_length directly on your prometheus server to show labels content?

logopk commented 2 years ago

Misunderstanding:

I did not escape the instance - I imported your JSON-File and my exporter is found (variable drop down is filled) but the dashboard is empty (no data). If I select explore I get the above escaped value...

If I manually remove the "\\" I get results.

Build info and Global Pool Usage are filled and have correct values...

I wonder if this is a problem of the Row Options...

guillaume-gambs commented 2 years ago

Hi, for fix the issue, you can change in query :

-clamav_queue_length{instance="$instance"}
+clamav_queue_length{instance=~"$instance"}

thanks for your work