Adding metrics together in InfluxDB/Grafana

Hi All,

First off let me apologise if this is a pretty basic question, I’ve not been using Influx for long!

I’m graphing two metrics in Grafana, which are as follows:
SELECT last("value") from "broker_to_client_connections" where hostname = 'host' and metric = '\\"\\Broker(*)\\Broker to Client Connections\\"'
and
SELECT last("value") from "broker_to_webclient_connections" where hostname = 'host' and metric = '\\"\\Broker(*)\\Broker to WebClient Connections\\"'

It’s pretty self explanatory but the first query find the number of users connected via a desktop client, and the second via a web/mobile client.

I would like another display of total number of connections, so I’ll need to add the above metrics together. Is this possible?

Many thanks in advance

Unfortunately this cannot be done, it is a long standing issue and one that will be fixed with ifql. Currently the best way to work around this problem is to set up your schema such that you can put your connections in one measurement and split the origin in tags. Thus your measurement might look more like:

broker_to_connections,hostname=host,type=web value=something
broker_to_connections,hostname=host,type=mobile value=something

Then the query would include the “type” tag in the query.

Hope this helps, let me know if not.

If you have control of the input, then nathans suggestion is probably best. If not you could create a CQ or use kapacitor to combine the separate measurements into a new measurement with multiple fields which you can do the addition across.