Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background colours for service status list on admin page #1150

Closed
TrystanLea opened this issue Jan 10, 2019 · 6 comments · Fixed by #1153 or #1157
Closed

Background colours for service status list on admin page #1150

TrystanLea opened this issue Jan 10, 2019 · 6 comments · Fixed by #1153 or #1157
Assignees

Comments

@TrystanLea
Copy link
Member

I've merged pull request: #1134

@glynhudson @borpin @Paul-Reed the services all show up as red if not running, which is fine for emonpi/emonbase but may be confusing for installs that dont use these services as they are all optional.

I could remove the background colouring if $allow_emonpi_admin is true perhaps? do you have any preferences?

I removed the start,stop,restart and kill buttons for now as they are not yet implemented and I have not yet added any access to logs, which would be great to add in future.

@borpin
Copy link
Contributor

borpin commented Jan 10, 2019

You could always check the status of the service? Can't check how from here, but would it not be better, rather than just look for a process (which is a very binary state), to use systemctl to understand whether it has failed, not enabled etc? I note that systemctl status command implicitly attempts to load any service not loaded so it may be better to do a systemctl is-enabled or a systemctl show instead (can't check if the output is usable right now).

@borpin
Copy link
Contributor

borpin commented Jan 10, 2019

So a quick test here;

~# systemctl show service-runner.service | grep State

LoadState=loaded
ActiveState=active
SubState=running
UnitFileState=enabled
StateChangeTimestamp=Tue 2018-11-20 20:24:50 GMT
StateChangeTimestampMonotonic=6115500

On a non existent service

LoadState=not-found
ActiveState=inactive
SubState=dead
StateChangeTimestampMonotonic=0

I think this would be better than a ps command to determine state.

@glynhudson
Copy link
Member

Nice update. Yes, probably best remove for non emonPi systems to avoid confusion.

@borpin
Copy link
Contributor

borpin commented Jan 10, 2019

No, I think you could check for all systems and just include when a service is found. I'd certainly like it. The command is non-intrusive so checking when it does not exist would not be an issue.

Not sure how it would respond if it was still the init.d version though.

@borpin
Copy link
Contributor

borpin commented Jan 14, 2019

@glynhudson @emrysr I have been trying to load the output of the command systemctl show service-runner.service | grep State into an array and then put the output into the admin view without success - my PHP is really not up to it. The only way I've found was to call the command multiple times on one service which is not very efficient.

If I could, I'd do a PR 😦!

I'd suggest putting the output into the view as

  • UnitFileState (but need to check for a null as if the service does not exist, command will return nothing - alternatively simply ignore a service if this response is empty - solves a 'no emonhub' problem)
  • LoadState
  • ActiveState
  • SubState

Cheers - a really good enhancement.

@emrysr
Copy link
Contributor

emrysr commented Jan 25, 2019

issue continues in issue #1164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants