taylorthurlow/panda-motd

service_status error: Unable to parse systemctl output

Closed this issue · 5 comments

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

  • OS: Debian 9
  • systemd: 232-25+deb9u6
  • panda-motd: 0.0.10, 0.0.6
$ gem list | grep panda-motd
panda-motd (0.0.10, 0.0.6)

Configuration File

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?

@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.

@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.

@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.

Confirmed that the v.0.0.11 works~