eschava / psmqtt

Utility reporting system health and status via MQTT
MIT License
159 stars 35 forks source link

New Feature: Docker monitoring #35

Open rikardronnkvist opened 1 year ago

rikardronnkvist commented 1 year ago

Would it be possible to get some simple monitoring of docker?

Would like to see how many containers and then how many that are up and running of those registered. For instance, this example below would show 7 total, 5 running, 2 stopped.

riro@photon01 [ ~ ]# sudo docker ps --all

CONTAINER ID   IMAGE                              COMMAND                  CREATED        STATUS                      PORTS                                                                   NAMES
9a7a33c7732e   txn2/irsync                        "/irsync --irsync-in…"   40 hours ago   Exited (2) 57 seconds ago                                                                           irsync
62f98e15b6d6   containrrr/watchtower              "/watchtower"            40 hours ago   Up 40 hours                 0.0.0.0:8880->8080/tcp, :::8880->8080/tcp                               watchtower
7bd8a4c9dcc3   telegraf                           "/entrypoint.sh tele…"   40 hours ago   Exited (0) 51 seconds ago                                                                           telegraf
f73f29272a9e   networkstatic/iperf3               "iperf3 -s"              40 hours ago   Up 40 hours                 0.0.0.0:5201->5201/tcp, :::5201->5201/tcp                               iperf3
ec1dde90cfdd   portainer/agent                    "./agent"                40 hours ago   Up 40 hours                 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp                               portainer-agent
2331405e738c   senexcrenshaw/xteve                "/bin/sh -c '${XTEVE…"   5 days ago     Up 5 days                   0.0.0.0:34400->34400/tcp, :::34400->34400/tcp                           xteve
de276fc2cd91   tautulli/tautulli                  "./start.sh python T…"   5 days ago     Up 5 days (healthy)         0.0.0.0:8181->8181/tcp, :::8181->8181/tcp                               tautulli
eschava commented 1 year ago

I support only functions implemented in the psutil library. I do not think this type of functionality is implemented there If you create a merge request with custom implementation I'll review and merge it