Query to calculate average of servers uptime

Hi all, I’m using InfluxDB datasource and Telegraf ping plugin to monitor server availability. The result as per below:

Query for server uptime:

-I’m trying to create a panel to monitor average of two/more servers uptime but I’m still stuck at the query. The result as per below:

-I would like to know is there any solution to write the proper query? Or it is impossible to calculate the average of two/more servers uptime?

Thank you in advance for your help.

Regards,
Farah

I’m no expert at InfluxDB, but your query has WHERE ("url" = 'A') AND ("url" = 'B') which means you’re asking for pings where the URL is simultaneously A and B (which isn’t possible). If you change that AND to an OR, that part of your query should be more correct.

If you instead use the regular expressions format, you could write the same query as WHERE "url" =~ /A|B/, see https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/#regular-expressions

Good luck!

Hi, thank you so much for your guidance. It’s really helps me a lot! I’ve changed the query and it’s works! :smile:

So this is the query that I’ve been using for measuring the total uptime for all the servers.

Regards,
Farah

Awesome :raised_hands: Glad to be of assistance!