taylorthurlow / panda-motd

a utility for generating a more useful MOTD
MIT License
134 stars 6 forks source link

service_status error: Unable to parse systemctl output #27

Closed giantcow closed 5 years ago

giantcow commented 5 years ago

Bug description

Service status check is throwing an error.

Reproduction steps

Steps to reproduce the behavior:

  1. Execute: panda-motd ~/.config/panda-motd.yaml

Expected behavior

Normal output of service information via systemd.

Screenshots

$ panda-motd ~/.config/panda-motd.yaml
service_status error: Unable to parse systemctl output

Uptime 38 days, 10 hours, 15 minutes

SSL Certificates:
    <snip>

Filesystems  Size  Used  Free  Use%
  root       2.0T  186G  1.7T    9%
  [===============================]
  boot       510M   97M  382M   19%
  [===============================]

Last Login:
  kayo:
    from <snip> at 12/30/2018 01:05PM (still logged in)

OS Information

Configuration File

taylorthurlow commented 5 years ago

Thanks for the bug report! Do you mind posting the output of systemctl is-active SERVICENAME where SERVICENAME is a name of one of the services you're trying to monitor?

Also, you should have a log file located at /var/log/panda-motd.error.log. Can you post this as well?

giantcow commented 5 years ago

@taylorthurlow no worries, happy to help.

$ my_services=('nginx' 'fail2ban' 'snmpd' 'ufw' 'php7.0-fpm' 'clamv-freshclam'); for service in $my_services[@]; do echo $service is $(systemctl is-active $service); done
nginx is failed
fail2ban is active
snmpd is active
ufw is active
php7.0-fpm is active
clamv-freshclam is inactive

I noticed that if I removed NGINX from my panda-motd configuration under service_status that panda-motd showed the correct output. Perhaps panda-motd is not parsing the failure message correctly?

Looks like /var/log/panda-motd.error.log exists, but there are no contents.

taylorthurlow commented 5 years ago

@RyoshiKayo You're correct - I haven't encountered the failed state yet. I'll fix that and look into other possible states. I'll let you know as soon as it's fixed.

taylorthurlow commented 5 years ago

@RyoshiKayo I've just pushed v0.0.11 to rubygems, so you should be able to do a gem update panda-motd to grab the latest. Let me know if this fixes the issue for you - it should.

giantcow commented 5 years ago

Confirmed that the v.0.0.11 works~