Multi-timeseries operations in Grafana










7















How do I subtract two timeseries in Grafana? Or add two together, divide one by another, etc...? I have found vague hints online about taking differences between timeseries, but nothing that actually tells me how to do so. I'm using Grafana v2.0.2 with Influxdb v0.8 and have played around with the graph controls enough to discover things like the difference operator I can apply, but I have no idea how to use it. I've attempted to find documentation on this, but the closest I can find is pretty much silent on this topic, and also looks to be slightly out of date, as the interface has changed since those screenshots were taken.



Thanks!










share|improve this question
























  • With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

    – Torkel
    May 4 '15 at 7:02











  • Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

    – staticfloat
    May 4 '15 at 13:46















7















How do I subtract two timeseries in Grafana? Or add two together, divide one by another, etc...? I have found vague hints online about taking differences between timeseries, but nothing that actually tells me how to do so. I'm using Grafana v2.0.2 with Influxdb v0.8 and have played around with the graph controls enough to discover things like the difference operator I can apply, but I have no idea how to use it. I've attempted to find documentation on this, but the closest I can find is pretty much silent on this topic, and also looks to be slightly out of date, as the interface has changed since those screenshots were taken.



Thanks!










share|improve this question
























  • With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

    – Torkel
    May 4 '15 at 7:02











  • Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

    – staticfloat
    May 4 '15 at 13:46













7












7








7








How do I subtract two timeseries in Grafana? Or add two together, divide one by another, etc...? I have found vague hints online about taking differences between timeseries, but nothing that actually tells me how to do so. I'm using Grafana v2.0.2 with Influxdb v0.8 and have played around with the graph controls enough to discover things like the difference operator I can apply, but I have no idea how to use it. I've attempted to find documentation on this, but the closest I can find is pretty much silent on this topic, and also looks to be slightly out of date, as the interface has changed since those screenshots were taken.



Thanks!










share|improve this question
















How do I subtract two timeseries in Grafana? Or add two together, divide one by another, etc...? I have found vague hints online about taking differences between timeseries, but nothing that actually tells me how to do so. I'm using Grafana v2.0.2 with Influxdb v0.8 and have played around with the graph controls enough to discover things like the difference operator I can apply, but I have no idea how to use it. I've attempted to find documentation on this, but the closest I can find is pretty much silent on this topic, and also looks to be slightly out of date, as the interface has changed since those screenshots were taken.



Thanks!







metrics influxdb grafana






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 13 '17 at 22:27









Tombart

19k89396




19k89396










asked May 3 '15 at 4:55









staticfloatstaticfloat

3,38142841




3,38142841












  • With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

    – Torkel
    May 4 '15 at 7:02











  • Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

    – staticfloat
    May 4 '15 at 13:46

















  • With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

    – Torkel
    May 4 '15 at 7:02











  • Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

    – staticfloat
    May 4 '15 at 13:46
















With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

– Torkel
May 4 '15 at 7:02





With Graphite this is easy. Not sure how to do it with InfluxDB. The place to ask is in the InfluxDB mailing list or on their irc channel on freenode

– Torkel
May 4 '15 at 7:02













Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

– staticfloat
May 4 '15 at 13:46





Could you explain how to do it with Graphite? That would be useful as I might be able to map the concepts on my own, and I would at least know what form the question should be in, if not the answer.

– staticfloat
May 4 '15 at 13:46












3 Answers
3






active

oldest

votes


















6














This feature has been added as issue 177 of Grafana:



Setup two series, click the eye icon to hide them and put a third with the division of the preceding ones.



grafana - graphite queries



This is only working in Graphite (I'd like it to work on influx badly also)






share|improve this answer

























  • Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

    – staticfloat
    May 7 '15 at 14:30











  • well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

    – XFMoulet
    May 11 '15 at 7:15


















6














InfluxDB v0.12 support following operations:



Arithmetic operation on aggregation function result:



SELECT 10* MEAN(usage_system) AS avg 
FROM cpu WHERE time > now() - 10s;


or arithmetic operation between fields:



SELECT usage_system + usage_user AS avg 
FROM cpu WHERE time > now() - 10s;


and most importantly you can perform arithmetic operation between aggregation function results:



SELECT MEAN(usage_system) + MEAN(usage_user) AS avg 
FROM cpu
WHERE time > now() - 10s
GROUP BY host;


It's not supported by Grafana GUI editor yet (but you can write it in manual mode).






share|improve this answer
































    2














    Another possible solution (that I've only tried with graphite) is to use the sumSeries and scale functions. To add two time seriers together, do



    sumSeries(first.time.series, second.time.series)


    and to get the difference do



    sumSeries(first.time.series, scale(second.time.series, -1))


    This must be done using the text editor for metrics.






    share|improve this answer






















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      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: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fstackoverflow.com%2fquestions%2f30010364%2fmulti-timeseries-operations-in-grafana%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      This feature has been added as issue 177 of Grafana:



      Setup two series, click the eye icon to hide them and put a third with the division of the preceding ones.



      grafana - graphite queries



      This is only working in Graphite (I'd like it to work on influx badly also)






      share|improve this answer

























      • Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

        – staticfloat
        May 7 '15 at 14:30











      • well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

        – XFMoulet
        May 11 '15 at 7:15















      6














      This feature has been added as issue 177 of Grafana:



      Setup two series, click the eye icon to hide them and put a third with the division of the preceding ones.



      grafana - graphite queries



      This is only working in Graphite (I'd like it to work on influx badly also)






      share|improve this answer

























      • Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

        – staticfloat
        May 7 '15 at 14:30











      • well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

        – XFMoulet
        May 11 '15 at 7:15













      6












      6








      6







      This feature has been added as issue 177 of Grafana:



      Setup two series, click the eye icon to hide them and put a third with the division of the preceding ones.



      grafana - graphite queries



      This is only working in Graphite (I'd like it to work on influx badly also)






      share|improve this answer















      This feature has been added as issue 177 of Grafana:



      Setup two series, click the eye icon to hide them and put a third with the division of the preceding ones.



      grafana - graphite queries



      This is only working in Graphite (I'd like it to work on influx badly also)







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Apr 17 '16 at 11:05









      Tombart

      19k89396




      19k89396










      answered May 7 '15 at 10:29









      XFMouletXFMoulet

      8115




      8115












      • Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

        – staticfloat
        May 7 '15 at 14:30











      • well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

        – XFMoulet
        May 11 '15 at 7:15

















      • Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

        – staticfloat
        May 7 '15 at 14:30











      • well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

        – XFMoulet
        May 11 '15 at 7:15
















      Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

      – staticfloat
      May 7 '15 at 14:30





      Excellent, thank you for the screenshot! Can you elucidate a little bit on why there is a difference between influxdb and graphite? Are the series operations happening inside of the database engine? That seems strange to me, as I'd assume things would scale much nicer if the clients did the data manipulation, but then again I didn't write grafana. :P

      – staticfloat
      May 7 '15 at 14:30













      well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

      – XFMoulet
      May 11 '15 at 7:15





      well, I didn't design grafana so I cannot tell you why .. maybe because queries are directly sent to tghe DB layer ?

      – XFMoulet
      May 11 '15 at 7:15













      6














      InfluxDB v0.12 support following operations:



      Arithmetic operation on aggregation function result:



      SELECT 10* MEAN(usage_system) AS avg 
      FROM cpu WHERE time > now() - 10s;


      or arithmetic operation between fields:



      SELECT usage_system + usage_user AS avg 
      FROM cpu WHERE time > now() - 10s;


      and most importantly you can perform arithmetic operation between aggregation function results:



      SELECT MEAN(usage_system) + MEAN(usage_user) AS avg 
      FROM cpu
      WHERE time > now() - 10s
      GROUP BY host;


      It's not supported by Grafana GUI editor yet (but you can write it in manual mode).






      share|improve this answer





























        6














        InfluxDB v0.12 support following operations:



        Arithmetic operation on aggregation function result:



        SELECT 10* MEAN(usage_system) AS avg 
        FROM cpu WHERE time > now() - 10s;


        or arithmetic operation between fields:



        SELECT usage_system + usage_user AS avg 
        FROM cpu WHERE time > now() - 10s;


        and most importantly you can perform arithmetic operation between aggregation function results:



        SELECT MEAN(usage_system) + MEAN(usage_user) AS avg 
        FROM cpu
        WHERE time > now() - 10s
        GROUP BY host;


        It's not supported by Grafana GUI editor yet (but you can write it in manual mode).






        share|improve this answer



























          6












          6








          6







          InfluxDB v0.12 support following operations:



          Arithmetic operation on aggregation function result:



          SELECT 10* MEAN(usage_system) AS avg 
          FROM cpu WHERE time > now() - 10s;


          or arithmetic operation between fields:



          SELECT usage_system + usage_user AS avg 
          FROM cpu WHERE time > now() - 10s;


          and most importantly you can perform arithmetic operation between aggregation function results:



          SELECT MEAN(usage_system) + MEAN(usage_user) AS avg 
          FROM cpu
          WHERE time > now() - 10s
          GROUP BY host;


          It's not supported by Grafana GUI editor yet (but you can write it in manual mode).






          share|improve this answer















          InfluxDB v0.12 support following operations:



          Arithmetic operation on aggregation function result:



          SELECT 10* MEAN(usage_system) AS avg 
          FROM cpu WHERE time > now() - 10s;


          or arithmetic operation between fields:



          SELECT usage_system + usage_user AS avg 
          FROM cpu WHERE time > now() - 10s;


          and most importantly you can perform arithmetic operation between aggregation function results:



          SELECT MEAN(usage_system) + MEAN(usage_user) AS avg 
          FROM cpu
          WHERE time > now() - 10s
          GROUP BY host;


          It's not supported by Grafana GUI editor yet (but you can write it in manual mode).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 17 '16 at 12:03

























          answered Apr 17 '16 at 11:25









          TombartTombart

          19k89396




          19k89396





















              2














              Another possible solution (that I've only tried with graphite) is to use the sumSeries and scale functions. To add two time seriers together, do



              sumSeries(first.time.series, second.time.series)


              and to get the difference do



              sumSeries(first.time.series, scale(second.time.series, -1))


              This must be done using the text editor for metrics.






              share|improve this answer



























                2














                Another possible solution (that I've only tried with graphite) is to use the sumSeries and scale functions. To add two time seriers together, do



                sumSeries(first.time.series, second.time.series)


                and to get the difference do



                sumSeries(first.time.series, scale(second.time.series, -1))


                This must be done using the text editor for metrics.






                share|improve this answer

























                  2












                  2








                  2







                  Another possible solution (that I've only tried with graphite) is to use the sumSeries and scale functions. To add two time seriers together, do



                  sumSeries(first.time.series, second.time.series)


                  and to get the difference do



                  sumSeries(first.time.series, scale(second.time.series, -1))


                  This must be done using the text editor for metrics.






                  share|improve this answer













                  Another possible solution (that I've only tried with graphite) is to use the sumSeries and scale functions. To add two time seriers together, do



                  sumSeries(first.time.series, second.time.series)


                  and to get the difference do



                  sumSeries(first.time.series, scale(second.time.series, -1))


                  This must be done using the text editor for metrics.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 6 '16 at 19:43









                  Johannes HoffJohannes Hoff

                  2,18532431




                  2,18532431



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • 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%2fstackoverflow.com%2fquestions%2f30010364%2fmulti-timeseries-operations-in-grafana%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

                      Darth Vader #20

                      How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                      Ondo