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

Combining metrics #1692

Closed
hryamzik opened this Issue May 30, 2016 · 10 comments

Comments

Projects
None yet
2 participants
@hryamzik
Copy link

hryamzik commented May 30, 2016

I have a metric that comes from different hosts exported by node_exporter. Due to the way it's exported it has two different labels: env and instance. I'd like to remove them for a set of metrics but once I do so a query error appears:

(label_replace(label_replace(domain_check_expiration_date,"instance", "", "instance", ".*"),"env", "", "env", ".*") - time()) / 3600/24 < 14
Error executing query: duplicated label set in output of label_replace(): domain_check_expiration_date{job="node", name="example.org"}

This metric comes from two hosts for redundancy reasons but it should be aggregated as a single one. How can I do this? I'm fine to move to a blackbox_exporter but I don't see cmd support there and expect to get same issues with duplicates.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 30, 2016

What are you expecting as the output? The error is because what you've requested results in clashing time series, and there's no sane semantics for that.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 30, 2016

Also as a general note adding additional duplicate exporters for redundancy is often more hassle than it's worth. In this case even if you have a single exporter that fails, you'll have many days to get it back up and running which is more than enough time to get domains renewed.

@hryamzik

This comment has been minimized.

Copy link
Author

hryamzik commented May 30, 2016

I have some other metrics that should be duplicated. At the moment I have redundancy for all the prometheus stack including prometheus itself and an alert manager and I'm very happy with the way it works – no duplicated alerts at all.

What are you expecting as the output? The error is because what you've requested results in clashing time series, and there's no sane semantics for that.

Good point. In this particular case I'd like to get min value but once I apply the min function all the labels got lost. So at least it's possible to create a personal rule for each domain and use the min function. Is there a way to avoid this?

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 30, 2016

Are you specifying an ignoring clause on your min?

@hryamzik

This comment has been minimized.

Copy link
Author

hryamzik commented May 31, 2016

I believe you meant without – I wasn't able to create a valid queue with ignoring.

And it did work, thank you so much!

(min(domain_check_expiration_date) without (job,env,instance) - time() )/3600/24

@hryamzik hryamzik closed this May 31, 2016

@hryamzik

This comment has been minimized.

Copy link
Author

hryamzik commented May 31, 2016

Oops, with without I still get two results but they are similar, should this result in a single alert?

@hryamzik hryamzik reopened this May 31, 2016

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 31, 2016

Are you sure you've removed all the labels you need to?

@hryamzik

This comment has been minimized.

Copy link
Author

hryamzik commented May 31, 2016

I am, I have now two labels left:

{host="some_ip_here",name="example.org"}

And the values are expectedly equal.

@hryamzik

This comment has been minimized.

Copy link
Author

hryamzik commented May 31, 2016

Oops, my bad, IP were different. Closing this now, thank you again!

@hryamzik hryamzik closed this May 31, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.