Shelly Plug M Gen3 Server Monitor

As my Intel n100 based home server crashes sometimes without reason (at least I did not find one) (every 2-3 weeks or so) I searched for a way to monitor the server without having to install a extra server. The physical n100 server runs Proxmox. On it runs Home Assistant OS and other stuff.

Of course it's not a good idea to monitor the physical server using a VM on it.....

So I had the idea... Why not use a Shelly Plug M Gen3 which I use to Power measure the server and as on/off switch for the server manually if it hangs (I also have a GL.iNet Comet for KVM)?

It can run scripts.. so why not use it as Server Monitor, signal fails via Telegram and maybe powercycle the server if it really hangs?

So, here it is:

Shelly Plug M Gen3 Server Monitor

Monitoring and auto-recovery script for the Shelly Plug M Gen3 (and other shellys...).

Features

  • Monitoring of multiple devices
  • HTTP-based availability checks
  • Telegram notifications
  • Power cycling in case of failure
  • Watchdog
  • Logging
  • Protection against internet connection issues
  • Recovery detection

Recommended Network Settings

  • Static IP for the Shelly
  • Good Wi-Fi signal
  • 2.4 GHz Wi-Fi
  • Stable power supply

Supported Devices

Well suited for:

  • Home Assistant
  • Unifi
  • Web servers
  • Cameras

Known Limitations

ICMP Ping

Shelly devices do not support ICMP functions such as ping.

Therefore, the script uses HTTP checks.

HTTPS without a valid certificate

HTTPS pages without a valid certificate (such as a default Proxmox installation) do not work.

Workaround: test an LXC running on the Proxmox server via HTTP, which therefore supports HTTP checks.


Main script

shellyServerMon.js

  • Provides all the described functionality
  • Set parameters in the script to your needs (see readme.md in the repo for detailed documentation)
  • Run it on your Shelly Plug
  • Mark it as "Run on startup"

Additional Scripts

shellyHostCheck.js

  • Checks whether the selected host can be tested via HTTP

shellyTelegramTest.js

  • Tests whether a message can be sent to the Telegram bot

haRESTsensor.yaml

  • A REST sensor for Home Assistant
  • Add it to the configuration.yaml
  • Enter the IP address of the Shelly device running the script
  • Restart Home Assistant
  • The sensor provides the entity sensor.servermonstatus
  • Can then be added to the dashboard for visual verification that the script is running. With a display condition it can be only displayed when status <> 'running'
  • Status: 'running' or 'stopped'
  • !! The Shelly must not be password protected, otherwise it will not work !!

haScriptRunCheckAutomation.yaml

  • Sends the message 'serverMon is no longer running. Please check' to all HA client apps when the script stops

haTileServerMon.yaml

  • A tile card for HA dashboards that is only displayed when the script is not running

Requirements

Hardware

  • Shelly Plug M Gen3
  • Wi-Fi connection
  • Current firmware

Releases

  • 2026/05/15 V0.4.0 Initial release - readme.md at the moment in german language only, but it's easy to understand

Use at your own risk :winking_face_with_tongue:!

Is using HomeAssistant to monitor crashes on HomeAssistant going to be a fatal dependency?
Maybe find and fix the cause for the crashes?

1 Like

I am using the Shelly to Monitor the HA Server availability. The HA part is only to check if the script on the Shelly is still running. The Monitoring does NOT depend on HA. That is the point of this. And you do not need an extra Monitoring Server….

How about finding the cause for the crash instead? For a start: how much ‎RAM your HA VM has? Enough? Did you check/monitor ram usage?
HA doesn't crash "just like that", it must be something...

1 Like

The complete Proxmox Crashes. After around 2-3 weeks or more. Logs stop before crash, nothing to find… But thats not the Point. This Script is a easy and cheap Monitoring Solution for homelabs… Have fun with it if you need it​:grinning_cat::grinning_cat:

1 Like