taylorthurlow / panda-motd Goto Github PK
View Code? Open in Web Editor NEWa utility for generating a more useful MOTD
License: MIT License
a utility for generating a more useful MOTD
License: MIT License
Describe the solution you'd like
When rendering/displaying the SSL Certificates, automagically sort them alphabetically by default, and also have the option to sort by expiration date, ex, having the certificates that are going to expire listed first.
Describe alternatives you've considered
Manually sorting certificates :(
The non-ASCII characters are here:
It would be wise to filter any non-ascii characters, regardless of what init system is being used.
Error log:
/var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:47:in `split': invalid byte sequence in US-ASCII (ArgumentError)
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:47:in `parse_services'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:16:in `process'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/motd.rb:9:in `each'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/motd.rb:9:in `initialize'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd.rb:9:in `new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd.rb:9:in `new_motd'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/bin/panda-motd:5:in `<top (required)>'
from /usr/local/bin/panda-motd:22:in `load'
from /usr/local/bin/panda-motd:22:in `<main>'
Get error on first run of panda-motd, not familiar with ruby, so i cant describe the bug better than this.
output of cat /var/log/panda-motd.error.log
:
/var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/ascii_text_art.rb:15:in ``': No such file or directory - (Errno::ENOENT)
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/ascii_text_art.rb:15:in `process'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `each'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `initialize'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new_motd'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/bin/panda-motd:5:in `<top (required)>'
from /usr/local/bin/panda-motd:23:in `load'
from /usr/local/bin/panda-motd:23:in `<main>'
Steps to reproduce the behavior:
I expected panda-motd to print a successful result.
https://gist.github.com/eevahr/ae2e87642f55c0a1704cc6a093aa1953
If the service is in a non-running state, it's omitted from the services component list.
There is a string encoding bug when printing services and their status.
panda-motd had errors. Check '/var/log/panda-motd.error.log'.
/var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:41:in `delete': invalid byte sequence in US-ASCII (ArgumentError)
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:41:in `parse_services'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:16:in `process'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `each'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `initialize'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new_motd'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/bin/panda-motd:5:in `<top (required)>'
from /usr/local/bin/panda-motd:23:in `load'
from /usr/local/bin/panda-motd:23:in `<main>'
Adding export LANG=en_US.UTF-8
to /etc/update-motd.d/00-panda-motd resolves the issue for now
The configured MOTD would print
https://gist.github.com/sroche0/7f131d8874aed54ea631059784b66b95
Currently components add errors to an @errors
instance variable. This makes it so methods in components which fail in one way or another still need to return a value in order to prevent actual exceptions.
To handle this, real errors should be raised (something like ComponentError
), and the #process
method should be able to catch them and log them. This will make error control flow easier, while still allowing execution to continue to other components.
I created this on the wrong project :) Ignore me
Fails to run.
Steps to reproduce the behavior:
sudo gem install panda-motd
sudo panda-motd
rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo gem install panda-motd
[sudo] password for rush:
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: require_all-2.0.0.gem (100%)
Successfully installed require_all-2.0.0
Fetching: ruby-units-2.3.0.gem (100%)
Successfully installed ruby-units-2.3.0
Fetching: drydock-0.6.9.gem (100%)
Successfully installed drydock-0.6.9
Fetching: storable-0.8.9.gem (100%)
Successfully installed storable-0.8.9
Fetching: sysinfo-0.8.1.gem (100%)
Successfully installed sysinfo-0.8.1
Fetching: panda-motd-0.0.4.gem (100%)
Successfully installed panda-motd-0.0.4
Parsing documentation for colorize-0.8.1
Installing ri documentation for colorize-0.8.1
Parsing documentation for require_all-2.0.0
Installing ri documentation for require_all-2.0.0
Parsing documentation for ruby-units-2.3.0
Installing ri documentation for ruby-units-2.3.0
Parsing documentation for drydock-0.6.9
Installing ri documentation for drydock-0.6.9
Parsing documentation for storable-0.8.9
Installing ri documentation for storable-0.8.9
Parsing documentation for sysinfo-0.8.1
Installing ri documentation for sysinfo-0.8.1
Parsing documentation for panda-motd-0.0.4
Installing ri documentation for panda-motd-0.0.4
Done installing documentation for colorize, require_all, ruby-units, drydock, storable, sysinfo, panda-motd after 0 seconds
7 gems installed
rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo panda-motd
Traceback (most recent call last):
6: from /usr/local/bin/panda-motd:23:in `<main>'
5: from /usr/local/bin/panda-motd:23:in `load'
4: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/bin/panda-motd:5:in `<top (required)>'
3: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new_motd'
2: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new'
1: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/motd.rb:8:in `initialize'
/var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/config.rb:13:in `components_enabled': undefined method `map' for nil:NilClass (NoMethodError)
Expected the application to create the config file and run.
Service status check is throwing an error.
Steps to reproduce the behavior:
panda-motd ~/.config/panda-motd.yaml
Normal output of service information via systemd.
$ 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)
$ gem list | grep panda-motd
panda-motd (0.0.10, 0.0.6)
I would be very interested in docker support of some kind. Even if it is just some run statuses.
Currently the text art component just displays the machine's hostname, which is obviously not the only thing to turn into cool text art. Should allow a configurable command to run and turn into text art.
When I run the script, I get ssl_certificates error: Unable to find certificate expiration date
in the ssl section
Steps to reproduce the behavior:
ssl_certificates:
enable: true
certs:
...: /etc/letsencrypt/live/.../cert.pem
panda-motd
I expect valid until <date>
/var/log/panda-motd.error.log
exists but it's empty?
https://gist.github.com/MarcelRobitaille/19541379a55f19e21a8d8774a55662bf
Would be cool to have fail2ban statistics.
Need to look over each component and take a good look at where errors, especially in configuration, need to be handled. Should come up with a simple way to add these errors and print them in lieu of the actual component when errors occur.
The uptime displayed by panda-motd isn't the good one.
Uncomment the "uptime" paragraph in ~/.config/panda-motd
Have the right uptime displayed
If applicable, add screenshots to help explain your problem.
See the red ractangles
uptime:
enabled: true
prefix: up
I just installed a Ubuntu 18.04 LTS and tried setting up panda-motd - but it crashed complaining about the last_login
component not being able to parse a date. Upon inspection, the results of the command:
last --time-format=iso taylor
are
taylor pts/2 tmux(14328).%2 2018-11-05T16:04:53-0800 gone - no logout
taylor pts/2 tmux(14328).%1 2018-11-05T16:02:57-0800 - 2018-11-05T16:03:24-0800 (00:00)
taylor pts/1 tmux(14328).%0 2018-11-05T16:00:25-0800 gone - no logout
taylor pts/3 tmux(13667).%1 2018-11-05T16:00:09-0800 - 2018-11-05T16:00:22-0800 (00:00)
taylor pts/1 tmux(13667).%0 2018-11-05T15:59:09-0800 - 2018-11-05T16:00:19-0800 (00:01)
taylor pts/1 tmux(13582).%0 2018-11-05T15:59:01-0800 - 2018-11-05T15:59:08-0800 (00:00
The -
in the gone - no logout
section is what breaks the regex search. On top of that, we were basically assuming that that section of the log would only be "still logged in" or a valid date. I'm going to play with the regex a bit to get it to match the entire section, and handle whatever messages show up in that column.
It would be nice to have support for less popular init systems, like runit, OpenRC or upstart.
Hello,
I'm facing a little issue with the installation.
I have installed Ruby2.3 on my fresh Debian 9 and did the "sudo gem install panda-motd" command. Then I wrote panda-motd ~/.config/panda-motd.yaml and I have an error.
Generation of a YAML file containing options to customize panda-motd.
If applicable, add screenshots to help explain your problem.
/var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/config.rb:50:in load_config': undefined method
[]' for nil:NilClass (NoMethodError)
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/config.rb:13:in initialize' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/motd.rb:7:in
new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/motd.rb:7:in initialize' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd.rb:9:in
new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd.rb:9:in new_motd' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/bin/panda-motd:5:in
<top (required)>'
from /usr/local/bin/panda-motd:22:in load' from /usr/local/bin/panda-motd:22:in
UFW does not show in output when in config
service_status:
enabled: true
services:
nginx: NGINX
fail2ban: Fail2Ban
snmpd: snmpd
ufw: ufw
php7.0-fpm: PHP7-FPM
$ panda-motd ~/.config/panda-motd.yaml
Services:
fail2ban: running
nginx: running
php7.0-fpm: running
snmpd: running
...
$ panda-motd ~/.config/panda-motd.yaml
Services:
fail2ban: running
nginx: running
php7.0-fpm: running
snmpd: running
ufw: running
https://gist.github.com/RyoshiKayo/34dafb49e8af391df6fd4b748c8c19e9
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.