diff --git a/ui/src/hosts/apis/index.js b/ui/src/hosts/apis/index.js index 413a6cadcd..cbcb7c6f84 100644 --- a/ui/src/hosts/apis/index.js +++ b/ui/src/hosts/apis/index.js @@ -5,16 +5,17 @@ import _ from 'lodash' export const getCpuAndLoadForHosts = ( proxyLink, telegrafDB, - telegrafSystemInterval + telegrafSystemInterval, + rp ) => { return proxy({ source: proxyLink, - query: `SELECT mean("usage_user") FROM cpu WHERE "cpu" = 'cpu-total' AND time > now() - 10m GROUP BY host; - SELECT mean("load1") FROM "system" WHERE time > now() - 10m GROUP BY host; - SELECT non_negative_derivative(mean(uptime)) AS deltaUptime FROM "system" WHERE time > now() - ${telegrafSystemInterval} * 10 GROUP BY host, time(${telegrafSystemInterval}) fill(0); - SELECT mean("Percent_Processor_Time") FROM win_cpu WHERE time > now() - 10m GROUP BY host; - SELECT mean("Processor_Queue_Length") FROM win_system WHERE time > now() - 10s GROUP BY host; - SELECT non_negative_derivative(mean("System_Up_Time")) AS winDeltaUptime FROM win_system WHERE time > now() - ${telegrafSystemInterval} * 10 GROUP BY host, time(${telegrafSystemInterval}) fill(0); + query: `SELECT mean("usage_user") FROM cpu WHERE "${telegrafDB}"."${rp}"."cpu" = 'cpu-total' AND time > now() - 10m GROUP BY host; + SELECT mean("load1") FROM "${telegrafDB}"."${rp}"."system" WHERE time > now() - 10m GROUP BY host; + SELECT non_negative_derivative(mean(uptime)) AS deltaUptime FROM "${telegrafDB}"."${rp}"."system" WHERE time > now() - ${telegrafSystemInterval} * 10 GROUP BY host, time(${telegrafSystemInterval}) fill(0); + SELECT mean("Percent_Processor_Time") FROM "${telegrafDB}"."${rp}".win_cpu WHERE time > now() - 10m GROUP BY host; + SELECT mean("Processor_Queue_Length") FROM "${telegrafDB}"."${rp}".win_system WHERE time > now() - 10s GROUP BY host; + SELECT non_negative_derivative(mean("System_Up_Time")) AS winDeltaUptime FROM "${telegrafDB}"."${rp}".win_system WHERE time > now() - ${telegrafSystemInterval} * 10 GROUP BY host, time(${telegrafSystemInterval}) fill(0); SHOW TAG VALUES WITH KEY = "host";`, db: telegrafDB, }).then(resp => { diff --git a/ui/src/hosts/containers/HostsPage.js b/ui/src/hosts/containers/HostsPage.js index 2183c456b6..baaad2ef1f 100644 --- a/ui/src/hosts/containers/HostsPage.js +++ b/ui/src/hosts/containers/HostsPage.js @@ -38,7 +38,8 @@ class HostsPage extends Component { const hosts = await getCpuAndLoadForHosts( source.links.proxy, source.telegraf, - telegrafSystemInterval + telegrafSystemInterval, + source.defaultRP ) if (!hosts) { throw new Error(hostsError)