We are using kubernetes, which is collecting data in influxdb. The values in influx are displayed in grafana.
For a new dashboard we are creating, we are using the queries from grafana and implemented them in node.js. The queries in node however return values 2x the values as displayed in grafana.
The query we are using to test is:
q=SELECT SUM(\"value\") FROM \"cpu/usage_rate\" WHERE time > now() - 5m
AND \"pod_namespace\" =~ /ournamespace/
AND \"pod_name\" =~ /ourSinglePod/ GROUP BY time(1m)
Curl version for easy reproduction:
curl -G http://10.144.1.5:8086/query?pretty=true --data-urlencode "db=k8s" --data-urlencode "q=SELECT SUM(\"value\") FROM \"cpu/usage_rate\" WHERE time > now() - 5m AND \"pod_namespace\" =~ /adserving/ AND \"pod_name\" =~ /ads-357196871-qek76/ GROUP BY time(1m)"
Results:
{
"results": [
{
"series": [
{
"name": "cpu/usage_rate",
"columns": [
"time",
"sum"
],
"values": [
[
"2017-01-26T18:51:00Z",
null
],
[
"2017-01-26T18:52:00Z",
156
],
[
"2017-01-26T18:53:00Z",
162
],
[
"2017-01-26T18:54:00Z",
148
],
[
"2017-01-26T18:55:00Z",
156
],
[
"2017-01-26T18:56:00Z",
154
]
]
}
]
}
]
}
The values displayed in graphs in grafana are half of these values.