Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Admin Page services status doesn't handle disabled services

The services section of the Admin page doesn’t handle disabled services well. The page assumes a service is either running or dead, but doesn’t handle a situation where a service is loaded, but purposefully disabled.

As an example, I have Emoncms running on a CentOS host that also has the mosquitto MQTT package installed. This package includes both the mosquitto binary utilities, and the mosquitto systemd .service file. The service is loaded and disabled by default. I happen to have my MQTT broker running on another machine, so I’ve left it disabled on the Emoncms host. When the Admin page loads, it sees that the mosquitto service exists and is dead, and indicates this with a red dot next to the mosquitto service in the services listing.

I’ve modified my local installation to also check the “UnitFileState” as reported by the “systemctl show” command, and display disabled services with a grey dot. I’d be happy to contribute this change back, but would like to get some feedback from the community first. Is this the best way to handle this situation? Would it be preferable to not list disabled services at all, so as to not clutter up the Admin page? Does someone have a better solution?

Additionally, this is my first time contributing to a GitHub project. I’m familiar with git, but I would appreciate it if someone could help walk me through the process of forking/branching and submitting a pull request back to the master. Does Emoncms have a preferred workflow for this?

Thanks,

Joe

Welcome, Joe, to the OEM forum.

This, I think, is something that should come to @TrystanLea’s attention.

A disabled service can still be started if another serive wants or requires it. A disabled service is simply not started at boot. To stop it ever being started, you need to mask the service.

Fair enough - I do this but in my case it isn’t even installed.

Which is not unreasonable as in the majority of cases, it does indicate an error state.

I suggest you assign the grey dot to a masked service as a dead service may well indicate an error state.

Thanks, Brian. I like your solution better.

I’ve put a feature branch with this solution up at https://github.com/joemcool/emoncms/tree/admin-display-disabled-services. If this looks good, let me know and I’ll go ahead and open a PR.

Joe