• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

ChatGpt developed Module MMM-Dockerstat

Scheduled Pinned Locked Moved Development
27 Posts 4 Posters 4.6k Views 4 Watching
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.
  • R Offline
    Rags
    last edited by Rags Mar 31, 2023, 3:14 PM Mar 31, 2023, 3:10 PM

    I am novice self taught coder having basic knowledge of coding in various languages. I used ChatGPT to help me code a module for MagicMirror. The results are definitely encouraging. I am sure the masters in coding may not need to rely on ChatGPT, but for novice coders it is a good beginning.
    So the Module is uploaded on github . It is not fully functional and has a few bugs. ChatGPT almost gave up to debug the code and advised me to check with the community/forum to resolve it and make it work. So i request the community to identify the bugs and make it work.
    The idea of the module is very basic and is to;

    1. ssh into another machine running on the home network and probe the status of the docker container running.
    2. Display the results in a dashboard form on the MM instance running on another pi.

    Any help will be greatly appreciated and will definitely motivate many MM fans to start to design and code newer modules and increase the fan base.
    https://github.com/Ragziesoft/MMM-Dockerstat

    S 1 Reply Last reply Mar 31, 2023, 3:13 PM Reply Quote 0
    • S Offline
      sdetweil @Rags
      last edited by Mar 31, 2023, 3:13 PM

      @Rags ssh via program is a tricky thing

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      R 1 Reply Last reply Apr 1, 2023, 8:33 AM Reply Quote 0
      • R Offline
        Rags @sdetweil
        last edited by Apr 1, 2023, 8:33 AM

        @sdetweil Ok, is there any other method of achieving this?

        M 1 Reply Last reply Apr 1, 2023, 10:44 AM Reply Quote 0
        • M Offline
          mumblebaj Module Developer @Rags
          last edited by Apr 1, 2023, 10:44 AM

          @Rags Welcome to the forum and great start.

          Have you tried to run the module and found any issues?

          • Node_helper.js must be named node_helper.js

          • Your modules defines a bunch of dependent modules in node_helper.js but none of these were installed when you built the module so anybody who clones the module will not get of the dependent modules installed as they are not mentioned in package,js.

          • You declare ‘./Logger’ but it is never used. Do you need it?

          If you fix the above issues the module starts. I do not run a Docker anywhere but the modules seems to working with the above issues fixed or at least it should get you going.

          Always try and run the module first and check for issues and fix them if you can

          Check out my modules at: https://github.com/mumblebaj?tab=repositories

          R 1 Reply Last reply Apr 2, 2023, 5:40 AM Reply Quote 1
          • R Offline
            Rags @mumblebaj
            last edited by Apr 2, 2023, 5:40 AM

            @mumblebaj Thanks for the encouragement. I made the changes as suggested and updated the files on github. I also did some debugging and tried to resolve issues. However, I guess i am reaching a dead end. So any help will be appreciated greatly.

            M 1 Reply Last reply Apr 2, 2023, 8:25 AM Reply Quote 0
            • M Offline
              mumblebaj Module Developer @Rags
              last edited by sdetweil Apr 2, 2023, 11:12 AM Apr 2, 2023, 8:25 AM

              @Rags Need to be bit more specific with what issues you are experiencing. If you are running you mirror with npm start then list the output from npm. Also check the developer console (shift + ctrl+i) and see if there are any errors there.

              Check out my modules at: https://github.com/mumblebaj?tab=repositories

              R 1 Reply Last reply Apr 2, 2023, 11:55 AM Reply Quote 1
              • R Offline
                Rags @mumblebaj
                last edited by Apr 2, 2023, 11:55 AM

                @mumblebaj
                Thanks for the help, i am running with npm start. The display does not show the status of the docker containers. Instead the rotating arrow is continuously displayed.
                I don’t know if the these error messages will indicate something, however here goes

                The error msg with npm start;
                02.04.2023 17:12.36.528] [LOG] Host 192.168.1.200 is offline.
                [02.04.2023 17:12.36.530] [ERROR] (node:11566) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading ‘info’)
                at /home/pi/MagicMirror/modules/MMM-Dockerstat/node_helper.js:59:21
                at /home/pi/MagicMirror/modules/MMM-Dockerstat/node_modules/ping/lib/ping-sys.js:40:9
                [02.04.2023 17:12.36.531] [ERROR] (node:11566) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
                with developer console;

                Failed to load resource: the server responded with a status of 404 (Not Found)
                0.0.0.0/:1 Refused to execute script from ‘http://0.0.0.0:8088/modules/MMM-Dockerstat/fontawesome.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
                loader.js:194 Error on loading script: modules/MMM-Dockerstat/fontawesome.js
                script.onerror @ loader.js:194

                M 1 Reply Last reply Apr 2, 2023, 12:03 PM Reply Quote 0
                • M Offline
                  mumblebaj Module Developer @Rags
                  last edited by Apr 2, 2023, 12:03 PM

                  @Rags Lots of issues in the code you had. I created a PR. Check it out.

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories

                  R 1 Reply Last reply Apr 2, 2023, 12:24 PM Reply Quote 0
                  • R Offline
                    Rags @mumblebaj
                    last edited by Apr 2, 2023, 12:24 PM

                    @mumblebaj
                    Yes Sir. I noticed the changes committed by you and I immediately approved the merge commit. Please understand this is my first attempt and I had ChatGPT to help me. I guess we both are still learning. Well, I cloned the fresh updated repository and installed it. Now when i run it the constantly rotating arrow is not displayed anymore, but even the status of the containers are not being displayed. The npm start logs do not have any error messages. The dev console is also not indicating any issue. So probably some more debug is required. Sincere request to keep assisting till it is resolved.
                    Thanks

                    M 1 Reply Last reply Apr 2, 2023, 12:31 PM Reply Quote 0
                    • M Offline
                      mumblebaj Module Developer @Rags
                      last edited by Apr 2, 2023, 12:31 PM

                      @Rags Unfortunately I don’t have a docker running here so cannot test that portion of your code. You need to supply the docker name as an input parameter to feed into .exec(`sudo docker ps -f name=${payload.container} --format "{{.Names}} {{.Status}}"`)

                      Have you added this into the config.js?

                      Check out my modules at: https://github.com/mumblebaj?tab=repositories

                      S R 2 Replies Last reply Apr 2, 2023, 12:41 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      1 / 3
                      • First post
                        1/27
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy