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

need to set manticore_up early #4

Open
britcey opened this issue Oct 4, 2021 · 2 comments
Open

need to set manticore_up early #4

britcey opened this issue Oct 4, 2021 · 2 comments
Assignees

Comments

@britcey
Copy link

britcey commented Oct 4, 2021

The manticore_up metric only gets set at the end of Collect - if there are any errors Collect returns before it is set.

Ideally want to initialize it to 0 & set it to one at the end of Collect (I'm a bit unclear on the right way to do this otherwise this would be a PR)

@netgineer netgineer self-assigned this Oct 4, 2021
@netgineer
Copy link
Owner

Hey, @britcey!
I'm not sure i understand what is the problem. Can you elaborate this issue? Some real-life example would be great.

@britcey
Copy link
Author

britcey commented Oct 6, 2021

Sure, that would have helped:

Call to manticore-exporter while manticore is running normally:

$ curl -s http://localhost:9247/metrics|grep 'manticore_up '
# HELP manticore_up Could the manticore server be reached.
# TYPE manticore_up gauge
manticore_up 1

Call to manticore-exporter while manticore (searchd) is not running:

$ curl -s http://localhost:9247/metrics|grep 'manticore_up '

(just get the go_* metrics)

Ideally, I want to alert when manticore_up == 0.

The 'return' at main.go:546 means the

ch <- prometheus.MustNewConstMetric(e.up, prometheus.GaugeValue, float64(status))

at main.go:790 never gets called. Same for the other 'return' calls in Collect.

I hacked in

ch <- prometheus.MustNewConstMetric(e.up, prometheus.GaugeValue, float64(0))

in each error block, with a final

ch <- prometheus.MustNewConstMetric(e.up, prometheus.GaugeValue, float64(1))

but surely there's a cleaner way to do that.

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

2 participants