Influxdb and grafana: howto create series that is the sum of two other series
I have these three queries. They show the average upload speed of three different docker containers over time:
The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.
Here is an example of the output:
I would like to create a third series that shows the sum of the above three graphs. If I simply remove the WHERE condition the it won't work:
The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:
The correct solution would be to calculate the three difference values and add them together. But I don't know how to do this in grafana?
Obviously the very best solution would be to store the differences in the database in the first place. Unfortunately, I'm not the one who is sending the data so I can't do anything about it.
influx-db
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have these three queries. They show the average upload speed of three different docker containers over time:
The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.
Here is an example of the output:
I would like to create a third series that shows the sum of the above three graphs. If I simply remove the WHERE condition the it won't work:
The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:
The correct solution would be to calculate the three difference values and add them together. But I don't know how to do this in grafana?
Obviously the very best solution would be to store the differences in the database in the first place. Unfortunately, I'm not the one who is sending the data so I can't do anything about it.
influx-db
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49
add a comment |
I have these three queries. They show the average upload speed of three different docker containers over time:
The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.
Here is an example of the output:
I would like to create a third series that shows the sum of the above three graphs. If I simply remove the WHERE condition the it won't work:
The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:
The correct solution would be to calculate the three difference values and add them together. But I don't know how to do this in grafana?
Obviously the very best solution would be to store the differences in the database in the first place. Unfortunately, I'm not the one who is sending the data so I can't do anything about it.
influx-db
I have these three queries. They show the average upload speed of three different docker containers over time:
The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.
Here is an example of the output:
I would like to create a third series that shows the sum of the above three graphs. If I simply remove the WHERE condition the it won't work:
The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:
The correct solution would be to calculate the three difference values and add them together. But I don't know how to do this in grafana?
Obviously the very best solution would be to store the differences in the database in the first place. Unfortunately, I'm not the one who is sending the data so I can't do anything about it.
influx-db
influx-db
asked Apr 13 '18 at 9:33
nagylzsnagylzs
1649
1649
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49
add a comment |
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49
add a comment |
1 Answer
1
active
oldest
votes
In theory, switch Grafana query editor to the raw mode and write a query where you use a subquery - outer query will just sum data precalculated by inner query:
SELECT SUM(field_from_main_query) FROM (
<your current Grafana query with GROUP BY time(10s) hostname>
) GROUP BY time(10s)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f203856%2finfluxdb-and-grafana-howto-create-series-that-is-the-sum-of-two-other-series%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In theory, switch Grafana query editor to the raw mode and write a query where you use a subquery - outer query will just sum data precalculated by inner query:
SELECT SUM(field_from_main_query) FROM (
<your current Grafana query with GROUP BY time(10s) hostname>
) GROUP BY time(10s)
add a comment |
In theory, switch Grafana query editor to the raw mode and write a query where you use a subquery - outer query will just sum data precalculated by inner query:
SELECT SUM(field_from_main_query) FROM (
<your current Grafana query with GROUP BY time(10s) hostname>
) GROUP BY time(10s)
add a comment |
In theory, switch Grafana query editor to the raw mode and write a query where you use a subquery - outer query will just sum data precalculated by inner query:
SELECT SUM(field_from_main_query) FROM (
<your current Grafana query with GROUP BY time(10s) hostname>
) GROUP BY time(10s)
In theory, switch Grafana query editor to the raw mode and write a query where you use a subquery - outer query will just sum data precalculated by inner query:
SELECT SUM(field_from_main_query) FROM (
<your current Grafana query with GROUP BY time(10s) hostname>
) GROUP BY time(10s)
answered Sep 28 '18 at 0:18
Jan GarajJan Garaj
1161
1161
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f203856%2finfluxdb-and-grafana-howto-create-series-that-is-the-sum-of-two-other-series%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Actually, instead of mean() + difference() it should be spread() withouth difference. But it doesn't answer the question anyway.
– nagylzs
Apr 13 '18 at 9:49