# Sum of some hosts

**URL:** <https://community.icinga.com/t/sum-of-some-hosts/1036>\
**Category:** Visualization, Metrics & Reporting\
**Tags:** grafana\
**Created:** [April 26, 2019, 5:39pm UTC](https://community.icinga.com/t/sum-of-some-hosts/1036 "2019-04-26T17:39:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viper539](https://community.icinga.com/letter_avatar_proxy/v4/letter/v/7ba0ec/32.png) [@viper539](https://community.icinga.com/u/viper539)\
**Post date:** [April 26, 2019, 5:39pm UTC](https://community.icinga.com/t/sum-of-some-hosts/1036/1 "2019-04-26T17:39:40Z")

</div>

Hi,

i currently trying to setup a Singestat with something like “all AccessPoints are up”.  
I can use “State” for this which is 0 when all ist fine.

My problem is that i didn’t see the way to do this with more than one host.  
With Graphite i used as filter “Accesspointname\*” and the Function “SumSeries” and Grafana adds all the state-values of this hosts together.  
When i try this with InfluxDB i get only the first host.

Maybe the push of the Hostgroups to InfluxDB fails.  
hostgroups = “$host.groups$”  
They’re all like this: ["city1", "company1", "printer"]  
The Preview of the Query looks fine, only hits which contains “city1” are shown.  
Like this:

> ["city1", "company1", "printer"] ["city1", "company2", "printer"] ["city1", "company1", "server"]…

and so on…

I’m looking forward to hearing from you

---

<div class="post-metadata">

**Author:** ![anon66228339](https://community.icinga.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@anon66228339](https://community.icinga.com/u/anon66228339)\
**Post date:** [May 22, 2019, 7:18pm UTC](https://community.icinga.com/t/sum-of-some-hosts/1036/2 "2019-05-22T19:18:40Z")

</div>

Did you try to `sum()` with `where hostname ~= /^accespoint*$/` ?

You can use regex nearly everywhere in Grafana with InfluxDB datasource.

Regards,  
Carsten

---

<div class="post-metadata">

**Author:** ![viper539](https://community.icinga.com/letter_avatar_proxy/v4/letter/v/7ba0ec/32.png) [@viper539](https://community.icinga.com/u/viper539)\
**Post date:** [August 3, 2019, 12:44pm UTC](https://community.icinga.com/t/sum-of-some-hosts/1036/3 "2019-08-03T12:44:53Z")

</div>

Hello Carsten,  
a  
“SELECT mean(“state”) FROM “hostalive” WHERE (“hostname” =~ /^(AP1|AP2 …” is working for me  
is working fine for me, i think.  
Let’s wait until the next AP dies.

Thank you!  
Viper
