dcu / mongodb_exporter

MongoDB exporter for prometheus.io
MIT License
356 stars 216 forks source link

Metrics when mongodb is not available #54

Closed ralberto closed 6 years ago

ralberto commented 7 years ago

It would be nice if this plugin exported a new metric signaling mongodb availability. There are other exporters doing that (ex. haproxy_exporter). Following the convention, it would be:

mongodb_up x ; where x=0 mongo is down; x=1 mongodb is avaialable.

insoIite commented 7 years ago

Hello, The exporter doesn't expose the mongodb_* metrics when it can't connect to the mongod instance. Therefore you can have a rule wich looks that the exporter doesn't expose those metrics. (Using prometheus)

absent(mongodb_instance_uptime_seconds{job=“$your_target”})

This rule will return 1 if the metric mongodb_instance_uptime_seconds doesn't exist in the target $your_target

zhihuiFan commented 7 years ago

@dcu open pull request https://github.com/dcu/mongodb_exporter/pull/75 for this, could you check if it is ok to merge?

zhihuiFan commented 6 years ago

The code in https://github.com/dcu/mongodb_exporter/pull/75 has been merged, so I think we can close this issue