MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. Rags
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    R
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 18
    • Posts 91
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: ChatGpt developed Module MMM-Dockerstat

      @sdetweil said in ChatGpt developed Module MMM-Dockerstat:

      @Rags but are you running this on the docker host? outside any container?

      if u run this from INSIDE the container (where MM is running) , does it work?

      as I recall, it does not.

      I think the command (on the host) is

      Usage:  docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
      

      docker exec container_id “docker -ps … rest of parms”

      but you will have to use docker command to get the container_id from the name to use in the exec

      long time ago, 9 years now, I wrote a whole bunch of scripts to support using docker to deploy and manage a software api testing service…

      Sorry if i have not been clear. My MagicMirror is in the living room. The MM is running on the first pi( standalone ) not in any container. The second pi in my network is tucked away in my study. This machine is installed with Docker containing multiple containers, which include pihole, wireguard, nginx, apache etc. Occasionally, one or two containers would quit running and I would realise quite late that a particular service is down. That’s why i was trying to build this module so that the status of all containers are known in a jiffy on the MM display.
      So when the MM docker module probes the second pi it should just ssh into it and retrieve the docker status easily, format the info in an array and display it. Simple (apparently ).

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @mumblebaj said in ChatGpt developed Module MMM-Dockerstat:

      @Rags The output from the query does not return a Status of “Online”

      See below what it returns.

      6ddea81e-8969-4d68-b3c3-62dfb470ab10-image.png

      Yes you are right even i got a similar output when the command was run on the second pi directly. So at least we are getting somewhere. Good news.
      sudo docker ps -f name=wireguard --format “{{.Names}} {{.Status}}”
      wireguard Up 36 hours.
      so now i have to figure out a command line to get status of all containers in a table form with name of container and the uptime.

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @sdetweil said in ChatGpt developed Module MMM-Dockerstat:

      @mumblebaj can u see the container names from inside a container?

      ‘Docker ps’ command list all the containers that are currently running. So i guess the command will execute and should be able to confirm the status with the command
      " ‘.exec(sudo docker ps -f name=${payload.container} --format "{{.Names}} {{.Status}}")’"

      This command uses the Docker CLI (Command Line Interface) to list the running Docker containers on a host, filtering the results by the name of the container specified in payload.container. The --format option specifies how to format the output of the docker ps command. In this case, {{.Names}} {{.Status}} is used to output only the names and statuses of the containers that match the specified filter. The output is then captured and processed by the SSH library used in the code.

      anyways " work in progress ".

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @mumblebaj {
      module: ‘MMM-Dockerstat’,
      header: ‘Docker Status’,
      position: ‘top_right’,
      config: {
      host: ‘192.168.1.200’, // IP address of the second Pi running Docker
      interval: 600000, //60 seconds
      user:‘pi’,
      password:‘mypass’,
      container: ‘wireguard’, // just added to check
      offlineIcon: ‘fa-times-circle’, // Font Awesome icon for offline status
      onlineIcon: ‘fa-check-circle’ // Font Awesome icon for online status
      }
      },
      Yes i added the name of the container. It is still not displaying the status. Anyways the idea was for the module to probe and display the status of all containers running in docker.

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @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

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @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

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

      @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.

      posted in Development
      R
      Rags
    • RE: ChatGpt developed Module MMM-Dockerstat

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

      posted in Development
      R
      Rags
    • RE: MMM-Moon, See the moon phases and rise/set times!

      @sdetweil said in MMM-Moon, See the moon phases and rise/set times!:

      @Rags a much better way is to use css to set the size instead of changing the code

      Sure. Understood. Just learning.

      posted in Utilities
      R
      Rags
    • ChatGpt developed Module MMM-Dockerstat

      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

      posted in Development
      R
      Rags
    • 1 / 1