Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broker up/down status #12

Open
iwittkau opened this issue Jul 26, 2018 · 3 comments
Open

Broker up/down status #12

iwittkau opened this issue Jul 26, 2018 · 3 comments

Comments

@iwittkau
Copy link

Is there a way to determine if the broker is reachable? If my broker goes down the exporter will expose the last metrics it was able to scrape. Im currently using something like

abs(broker_heap_current - (broker_heap_current offset 10m))

to determine if there are any changes in the heap. But that is not very reliable so far.

I'm using the 0.4.0 tagged docker image of the exporter.

@ArtieReus
Copy link
Contributor

Based on the Broker Status documented here:
https://mosquitto.org/man/mosquitto-8.html
I don't see other option.

@iwittkau
Copy link
Author

I think there is a simpler way: other exporters expose a metric like last_scrape_time. Then you are able to monitor the time since that timestamp. Also a counter metric like broker_connection_errors_sum is possible by counting the connection errors somewhere here: https://github.com/sapcc/mosquitto-exporter/blob/master/main.go#L167

Related suggestions from the prometheus docs:
https://prometheus.io/docs/instrumenting/writing_exporters/#metrics-about-the-scrape-itself

If I find some time I will create a PR if that is OK.

@daviddetorres
Copy link

I was thinking to add a metric with the seconds since the last $SYS message. That can give rise an alarm if that value is higher that 60 seconds (or the $SYS update time configured in the broker).

Also the up/down status detected by the status of the connection with the broker can be a good idea and with the other metric can detect both scenarios for broker error:

  1. The broker breaks and connection is closed
  2. The socket and the connection is ok but the broker is stalled or saturated and doesn't send updates (and probably other messages in the queue).

If you think it is a good idea I can work in a PR about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants