Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Duet3 reading the metrics...

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    3
    8
    476
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chrissundefined
      Chriss
      last edited by Chriss

      Hi *,

      I have a Duet 3 and a raspberry connected to it. So my idea is now to read out some metrics from the Duet and write them to a time series database for further analytics.
      My idea is to use telegraf (https://www.influxdata.com/time-series-platform/telegraf/) and write the data to a influxdb (https://www.influxdata.com/). The tools for graphs will be grafana. (https://grafana.com/)

      I user grafana, influx and telegraf in my job and at my home environment, so that should be a peace of a cake.

      My question is now: How can I read out the data from the Duet? The telegraf can execute commands/scripts to gather information. But where can I get information from? I think about hotend temperature, current layer No, time of the print? etc etc....

      Can I get that information form the serial interface? Or does one of the daemons provide that?

      (Yes I can provide a guide when I have something "ready".)

      Cheers, Chriss

      JoergS5undefined 1 Reply Last reply Reply Quote 0
      • JoergS5undefined
        JoergS5 @Chriss
        last edited by JoergS5

        @Chriss The new firmware RRF3 which is used by Duet 3 introduced a object model, which provides those information in json format, which you can get.

        As a first overview, you can check the links
        https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware
        https://duet3d.github.io/DuetSoftwareFramework/api/DuetAPI.Machine.MachineModel.html

        The first links gives in chapter "Uses" an overview how you can transfer the data.

        Chrissundefined 1 Reply Last reply Reply Quote 0
        • Chrissundefined
          Chriss @JoergS5
          last edited by

          @JoergS5

          Nice..... Thanks. I will source that json document from the web interface than. There is json plugin for telegraf which makes it very easy to handle that.....

          I have a duet2 main-board around, too. So I will source the the data from the web-interface, too.

          Well, I want to keep my 3D printer(s) as much self contained as I could. So it would be very convenient to use the local connected raspberry to query the local web service for the data. The data can than be stored in a local influxdb. The PI4 has more than enough resources for that.

          Cheers, Chriss

          1 Reply Last reply Reply Quote 0
          • niklas96undefined
            niklas96
            last edited by niklas96

            @Chriss Hey, could you give an update on the topic? I'm attempting the same thing with the Duet2 Wifi at the moment and would be glad to get some input! 🙂

            Regards
            Niklas

            Chrissundefined 1 Reply Last reply Reply Quote 0
            • Chrissundefined
              Chriss @niklas96
              last edited by

              @niklas96

              Hey Niklas,

              Well, the setup is almost done. 😉 The most important part is still missing. I have some problems with the json input plugin for telegraf. I postponed that for my other printer which have some mechanical issues. I can provide some more info and what I did so far if needed. I would be more than happy if somebody can take over the task and finish the very last step in the setup. Are you volunteering ? 😉

              Cheers, Chriss

              niklas96undefined 1 Reply Last reply Reply Quote 0
              • niklas96undefined
                niklas96 @Chriss
                last edited by

                @Chriss
                Hey Chriss,
                so you can already read the metrics in form of a Json file? Do you use M409 or rr_model command? Would be great if you shared some of your steps as I've just started to work with the duet board.
                I think that I will also use telegraf anyway. So I can share my progress with the json plugin with you once I've set up the basics 😉
                Regards
                Niklas

                Chrissundefined 1 Reply Last reply Reply Quote 0
                • Chrissundefined
                  Chriss @niklas96
                  last edited by Chriss

                  @niklas96

                  Hi Niklas,

                  sorry fir the late answer. My jobs consumes a lot of time at the moment. 😞

                  Let me elaborate what I did so far:
                  1: Installed influxdb on the PI https://docs.influxdata.com/influxdb/v2.0/get-started/?t=Linux
                  2: Installed Grafana to make some fancy graphs: https://grafana.com/docs/grafana/latest/installation/debian/
                  3: Installed telegraf: https://docs.influxdata.com/telegraf/v1.18/introduction/installation/
                  All of that was not a surprise so far.

                  I played with the json input plugin than:
                  https://docs.influxdata.com/telegraf/v1.18/data_formats/input/json/
                  https://stackoverflow.com/questions/62570876/parsing-json-file-using-telegraf-input-plugin-unexpected-output

                  The status of the duet can be queried here:
                  http://localhost/machine/status
                  So this gives you the full status of the duet and all connected toolboards etc.

                  I tried to read the "board0_vIn" from the json code for testing. That example below does not work and reflects the state where I left it:

                  [[inputs.http]]
                    ## One or more URLs from which to read formatted metrics
                    urls = [
                      "http://localhost/machine/status"
                    ]
                    # next field replace default metrics name "http" to your custom name:
                    name_override = "board0_vIn"
                    # set true if you want to ignore self signed certificate validation:
                    insecure_skip_verify = true 
                    data_format = "json"
                    timeout = "5s"
                    # Here you can filter your JSON using special syntax:
                  #  json_query = "boards"
                  #  json_string_fields = ["boards_0_vIn_current"]
                  

                  I hope that helps. I can spend some time into it as soon as we have at least one working example. 😉

                  Cheers, Chriss

                  1 Reply Last reply Reply Quote 0
                  • niklas96undefined
                    niklas96
                    last edited by

                    Hi Chriss,

                    thanks for the answer! I think I can use some of your input. I will update you as soon as I have made progress with the json plugin. It might take a while though, as I'm pretty busy atm...

                    Regards
                    Niklas

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA