# Gauge metric over time to availability of consul

**URL:** https://discuss.prometheus.io/t/gauge-metric-over-time-to-availability-of-consul/775
**Category:** PromQL
**Created:** [February 4, 2022, 5:51pm UTC](https://discuss.prometheus.io/t/gauge-metric-over-time-to-availability-of-consul/775 "2022-02-04T17:51:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gangs](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@gangs](https://discuss.prometheus.io/u/gangs)
#### Post date: [February 4, 2022, 5:51pm UTC](https://discuss.prometheus.io/t/gauge-metric-over-time-to-availability-of-consul/775/1 "2022-02-04T17:51:05Z")

</div>

we use consul and push consul metrics to prometheus using telegraf…  
this is `consul.autopilot.healthy` consul metric tells about health of consul cluster that is type guage  
to know availability of the cluster I’m using `avg_over_time(consul_autopilot_healthy[1y])`  
but some how telegraf pushing ipaddress as one of the label… over time this label might change that giving different resultsis there anyway ignore ipaddress label to get correct results?

---

<div class="post-metadata">

### Author: ![stuart](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/stuart/32/18_2.png) [@stuart](https://discuss.prometheus.io/u/stuart)
#### Post date: [February 4, 2022, 6:07pm UTC](https://discuss.prometheus.io/t/gauge-metric-over-time-to-availability-of-consul/775/2 "2022-02-04T18:07:31Z")

</div>

You can use an aggregation function to remove labels (using `without`). If there will only ever be once instance at a time the exact function probably doesn’t matter, but in general if you have a gauge which is either 0 or 1 (for unhealthy/healthy) I would probably use `min`, so something like:

`avg_over_time(min without (instance) consul_autopilot_healthy)[1y]`

---

<div class="post-metadata">

### Author: ![gangs](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@gangs](https://discuss.prometheus.io/u/gangs)
#### Post date: [February 18, 2022, 1:55pm UTC](https://discuss.prometheus.io/t/gauge-metric-over-time-to-availability-of-consul/775/3 "2022-02-18T13:55:10Z")

</div>

thanks @stuart … i’ve another question if metric itself absent for some time how do we calculate the availability?
