Influxdb and grafana: howto create series that is the sum of two other series












1















I have these three queries. They show the average upload speed of three different docker containers over time:



enter image description here



The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.



Here is an example of the output:



enter image description here



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:



enter image description here



The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:



enter image description here



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.










share|improve this question














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
















1















I have these three queries. They show the average upload speed of three different docker containers over time:



enter image description here



The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.



Here is an example of the output:



enter image description here



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:



enter image description here



The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:



enter image description here



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.










share|improve this question














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














1












1








1








I have these three queries. They show the average upload speed of three different docker containers over time:



enter image description here



The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.



Here is an example of the output:



enter image description here



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:



enter image description here



The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:



enter image description here



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.










share|improve this question














I have these three queries. They show the average upload speed of three different docker containers over time:



enter image description here



The difference() call is needed, because the data contains cumulative "bytes_sent" values, and it never decreases.



Here is an example of the output:



enter image description here



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:



enter image description here



The reason for this is that mean() always precedes difference(), and the mean value of these independent cumulative sums is meaningless:



enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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










1 Answer
1






active

oldest

votes


















0














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)





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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)





    share|improve this answer




























      0














      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)





      share|improve this answer


























        0












        0








        0







        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)





        share|improve this answer













        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)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 28 '18 at 0:18









        Jan GarajJan Garaj

        1161




        1161






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            الفوسفات في المغرب

            Four equal circles intersect: What is the area of the small shaded portion and its height

            جامعة ليفربول