Read the statement by Michael Teeuw here.
ChatGpt developed Module MMM-Dockerstat
-
@mumblebaj sorry, no idea on jq
i use terminal commands all the time… jq only in nodejs
when I have a terminal command i need output of, I use terminal command tools.
the thing about docker is you can make an image of a ‘thing’ you want to run, and run it everywhere that supports that processor type. independent of OS and you can run multiple instance at the same time (scale up server?) without changing anything inside the image
start up a web server with this content (mapped source folder)
or that content , or both poof a docker command and up you go.getting the folders mapped to the right place for the ‘thing’ in the container takes a little (tiny amount) work
-
@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 ). -
@Rags got it…
ssh will be the fun part (I think!)
-
@Rags said in ChatGpt developed Module MMM-Dockerstat:
and I would realise quite late that a particular service is down
then
docker ps --format "{{.Names}} {{.State}}"
maybe is the better choice,State
can be one of the following:(created|restarting|running|removing|paused|exited|dead)
-
@karsten13 said in ChatGpt developed Module MMM-Dockerstat:
docker ps --format "{{.Names}} {{.State}}
should this command produce an output when run directly on the docker machine? I am not getting any output.!
Docker ps -a gives this output listing all containers whether up or exited. I need to just pickup name and status
Now just need to workout (as Sam says ‘the fun part’) ssh into second pi retrieve the docker ps -a and display. -
missed the
-a
❯ docker ps -a --format "{{.Names}} {{.State}}" magicmirror running watchtower running traefik running
-
@karsten13 said in ChatGpt developed Module MMM-Dockerstat:
missed the
-a
❯ docker ps -a --format "{{.Names}} {{.State}}" magicmirror running watchtower running traefik running
Great !
Yes the command is working now but locally on the docker machine only. It needs to work from the first machine after ssh ing into docker machine.
ssh
.exec (‘docker ps -a --format “{{.Names}} {{.State}}”’)
.on(‘error’, (err) => {
console.error(Error: ${err}
);
this.status = ‘Error’;
this.sendSocketNotification(‘STATUS_UPDATE’, { status: this.status, icon: this.offlineIcon });
})