Connection error detection in MySQL Exporter

203 views
Skip to first unread message

Peter Zaitsev

unread,
Mar 29, 2017, 6:00:24 PM3/29/17
to Prometheus Developers
Hi,

I noticed if MySQL exporter can't connect to the database it should monitor (ie invalid password) it just  returns very few metrics rather than throwing the error
and the error is just seen in the error log file,  which complicates troubleshooting

I wonder what is the intended mechanism for fatal error reporting from the exporter so for example Prometheus Target page would display proper error message ? 

For example reporting HTTP 500  with  error information as a text could do it

Ben Kochie

unread,
Mar 29, 2017, 6:08:27 PM3/29/17
to Peter Zaitsev, Prometheus Developers
The exporter should be returning a `mysql_up` metric as 0 in the case of failures.  This way you can differentiate between the exporter being up, and the target behind the exporter being up.

An alert would look something like this:

ALERT MySQLDown
  IF mysql_up == 0 or up == 0
...


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/6f014dc1-fd53-4339-9b13-7907cd9659a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Zaitsev

unread,
Mar 29, 2017, 6:20:46 PM3/29/17
to Ben Kochie, Prometheus Developers
Thanks Ben,

This makes sense.  If I understand correctly there is no way to see the error message on Why MySQL is down without looking at the logs right ? 

On Wed, Mar 29, 2017 at 6:08 PM, Ben Kochie <sup...@gmail.com> wrote:
The exporter should be returning a `mysql_up` metric as 0 in the case of failures.  This way you can differentiate between the exporter being up, and the target behind the exporter being up.

An alert would look something like this:

ALERT MySQLDown
  IF mysql_up == 0 or up == 0
...

On Thu, Mar 30, 2017 at 12:00 AM, Peter Zaitsev <p...@percona.com> wrote:
Hi,

I noticed if MySQL exporter can't connect to the database it should monitor (ie invalid password) it just  returns very few metrics rather than throwing the error
and the error is just seen in the error log file,  which complicates troubleshooting

I wonder what is the intended mechanism for fatal error reporting from the exporter so for example Prometheus Target page would display proper error message ? 

For example reporting HTTP 500  with  error information as a text could do it

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscri...@googlegroups.com.




--
Peter Zaitsev, CEO, Percona
Tel: +1 888 401 3401 ext 7360   Skype:  peter_zaitsev



Ben Kochie

unread,
Mar 29, 2017, 6:31:57 PM3/29/17
to Peter Zaitsev, Prometheus Developers
Not currently, and it would be possibly too messy to try and fit that into a metric.

Part of the idea with Prometheus alerts is that they signal you to go look at the logs. :-) The typical annotation we recommend for an alert like this would be a "runbook" URL to docs that point the user to look at the error logs, try "service mysql status", or similar.

Peter Zaitsev

unread,
Mar 29, 2017, 6:36:53 PM3/29/17
to Ben Kochie, Prometheus Developers
Thank you,

I understand the idea.   
Reply all
Reply to author
Forward
0 new messages