Code Monkey home page Code Monkey logo

motd's People

Contributors

axilleas avatar gammelon avatar thomaslachaux avatar tomaspapan avatar xyaren avatar yboetz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motd's Issues

grep treats portions of syslog as binary file

I noticed that sometimes grep aborts its search through syslog when it thinks portions of the file are binary. This resulted in missing the "Previous self test" lines that 36-diskststus needs.

To see the problem, I removed the second grep to get the results of the first grep with:

tac /var/log/syslog /var/log/syslog.1 | grep -hiP 'smartd\[[[:digit:]]+\]:'

It results in:

image

My solution is to use add --text to grep to force grep to treat the entire file as text. The diff is:

diff --git a/36-diskstatus b/36-diskstatus
index 43bbbe9..2bc43bd 100755
--- a/36-diskstatus
+++ b/36-diskstatus
@@ -23,7 +23,7 @@ hddtemp_port=7634
 logfiles='/var/log/syslog /var/log/syslog.1'

 # get all lines with smartd entries from syslog
-lines=$(tac $logfiles | grep -hiP 'smartd\[[[:digit:]]+\]:' | grep -iP "previous self-test")
+lines=$(tac $logfiles | grep --text -hiP 'smartd\[[[:digit:]]+\]:' | grep --text -iP "previous self-test")
 # use nc to query temps from hddtemp daemon
 hddtemp=$(timeout 0.01 nc $hddtemp_host $hddtemp_port | sed 's/|//m' | sed 's/||/ \n/g')

40-services script doesn't properly detect lxd running from snap

The 40-services script doesn't properly detect lxd when it's running in an Ubuntu snap package. It improperly states the services is inactive. The 60-lxd script, using lxc commands, does properly detect running containers though.

$ systemctl is-active lxd
inactive
$ snap services lxd
Service Startup Current
lxd.daemon enabled active

Using 35-diskspace, run-parts fails

System information: Raspberry Pi 2B running Raspbian 9, fresh install.

After running sudo run-parts /etc/update-motd.d containing working scripts and 35-diskspace, the output looks as follows:

### OTHER SCRIPT OUTPUT ###
run-parts: failed to exec /etc/update-motd.d//35-diskspace: Exec format error
run-parts: /etc/update-motd.d//35-diskspace exited with return code 1

When runnning 35-diskspace on its own, it generates output and, strangely enough, has exit code 1.

sff@raspberrypi:/etc/update-motd.d $ ./35-diskspace

disk usage:
./35-diskspace: line 19: [: : integer expression expected
  /                               4% used out of  32G
  [==================================================]
./35-diskspace: line 19: [: : integer expression expected
  /boot                          51% used out of  46M
  [==================================================]
sff@raspberrypi:/etc/update-motd.d $ echo $?
0

Looking at the file itself on line 19, it uses a variable max_usage that is never set, maybe it's related to that? Note: I tried setting max_usage to 100, just to test it out but that didn't seem to fix the issue.

Permissions To Log Files

How are you getting access to run the syslog and fail2ban greps without access to the log files? Are you giving log files read access to others? Just curious if there's another way for those items to work!

36-smartd

I can't get your smartd script running on my server, and it seems my smartd logs are a different format to yours. My log lines look like this

Dec 6 11:21:43 onora smartd[1108]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 114 to 113

(the actual temperature is 34C, I checked with hddtemp after seeing that)

They don't contain a UUID like it seems to suggest in the script. Would you be able to post an example of your syslog lines to help me get the script working on my system?

[RFE] Add docker container information

You can use this as example:

printf "\ncontainers:\n"
docker ps --format 'table {{.Names}}\t{{.Status}}' | tr '[A-Z]' '[a-z]' | column -ts $',' | sed -e 's/^/  /'

Thanks!

36-smartd reports all disks with same temperature.

I looked at issue #8 and it looks like this might be the same issue. All my disks are reported to have the same temperature, although it changes occasionally, it's always the same.

I added the relevant lines to my /etc/smartd.conf maybe this fixes this also?

Another minor issue I have with the script is it takes 0.8-0.9 seconds to run on my machine. Searching the syslog might be an inefficient way to get the temperature. Caching the output would also work.

I am working on the script now to try to get it to work for me.

Use .profile instead update-motd

Instead using update-motd, you can just modify the ~/.bash_profile to run the scripts at login, adding the script location at the end of the ~/.bash_profile file:

~/bin/sysinfo
~/bin/services
~/bin/dockerstatus
~/bin/zpool-bar
...

May need full path to run lolcat

On my Ubuntu 22.04 install, I had to specify the full path for lolcat to function. Otherwise 10-hostname-color did not display at all on the MOTD.

Full path: /usr/games/lolcat

/usr/bin/env figlet "$(hostname)" | /usr/bin/env lolcat -f

Doesnt work in debian?

Hi!

I am wondering if this needs some dependencies? I am using debian 9.

I just added this repos file to /etc/update-motd.d/ but nothing seems to have changed.

Scripts will not run on login

Running ubuntu 20.04 server, all required packages are install, script files have the same permissions as the default scripts, sshd has printmotd set to yes. Any advice?

update-motd: /usr/sbin/update-motd /etc/update-motd.d /usr/share/man/man5/update-motd.5.gz /usr/share/man/man8/update-motd.8.gz
figlet: /usr/bin/figlet /usr/share/figlet /usr/share/man/man6/figlet.6.gz
lolcat: /snap/bin/lolcat
hddtemp: /usr/sbin/hddtemp /etc/hddtemp.db /usr/share/man/man8/hddtemp.8.gz
~$ ls -la /etc/update-motd.d/
total 44
drwxr-xr-x   2 root root  4096 Feb 27 09:20 .
drwxr-xr-x 128 root root 12288 Feb 27 09:03 ..
-rwxr-xr-x   1 root root    72 Jul 12  2020 00-hostname-color
-rwxr-xr-x   1 root root  1246 Jul 12  2020 20-sysinfo
-rwxr-xr-x   1 root root  1074 Jul 12  2020 30-zpool-bar
-rwxr-xr-x   1 root root  1084 Jul 12  2020 35-diskspace
-rwxr-xr-x   1 root root  1810 Jul 12  2020 36-diskstatus
-rwxr-xr-x   1 root root   883 Jul 12  2020 40-services
-rw-r--r--   1 root root   998 Jul 12  2020 README.md```

Docker status?

Not an issue, but a question. For the services status, do you have a way to identify docker containers and if any have any errors?

How to exclude drive paths?

Love the scripts! Is there a way to exclude a directory/path from the disk usage script?
I don't want to show the docker mnts:
/var/lib/docker/aufs/mnt/

I can see that you've done a few locations with the '-x', doesn't appear to work with /var or just var etc.
Ideally just want to ignore from /var onwards.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.