Refactor sysinfo#12
Open
seven-beep wants to merge 20 commits into
Open
Conversation
There is a lot that can go wrong if we ask for bind mounts, containers, etc. Stay concise. Also rearrange the output in columns so it is more compact.
ldidry
reviewed
Nov 26, 2024
|
|
||
| ``` | ||
| apt-get install figlet lsb-release python3-utmp bc | ||
| apt-get install figlet lsb-release bc |
Owner
There was a problem hiding this comment.
findmnt is in util-linux, could you add it, please?
ldidry
reviewed
Nov 26, 2024
| "--noheading", | ||
| "--real", | ||
| "--uniq", | ||
| "--fstab", |
Owner
There was a problem hiding this comment.
With --fstab, you won’t show disks mounted with systemd mount units.
Owner
|
To be honest, I don’t like displaying the IP address in the banner. You choose to display only one IP address into the many possibles (it may not suite all users) and And I prefer having multiple login showing, with their IP address and time, as:
We may have a config file to change the behavior of the script, like the |
Author
|
Luc Didry ***@***.***> writes:
To be honest, I don’t like displaying the IP address in the banner. You choose
to display only one IP address into the many possibles (it may not suite all
users) and ip route list dev won’t work on IPv6-only machines.
And I prefer having multiple login showing, with their IP address and time, as:
• it allows me to know if I’m already logged
• it allows me to see all the IP addresses of those connections (better for
security)
• if a co-worker has an old session on the server, I can ask them if it’s on
purpose or if they can logout, allowing me, for ex., to reboot the server
We may have a config file to change the behavior of the script, like the
hushlogin file.
That is fair, give me some time to address it.
Concerning the findmnt command, I choose the '--fstab' flag because I
want to keep the output terse by eg, not displaying all bind mount that
can be generated by docker or other software.
I can also revise that and/or address it via configurations options.
|
Initially I used this argument as I work with systems with a lot of bind mounts and it felt unnecessary to list them all, eg: Mount points Disk usage Inodes usage / 49% of 19.3G 12.8% of 1299984 /rw 35% of 20.5G 26.3% of 1373568 /home 35% of 20.5G 26.3% of 1373568 /usr/local 35% of 20.5G 26.3% of 1373568 /var/spool/cron 35% of 20.5G 26.3% of 1373568 /etc/hosts 35% of 20.5G 26.3% of 1373568 /var/lib/systemd/timers 35% of 20.5G 26.3% of 1373568 /var/lib/plocate 35% of 20.5G 26.3% of 1373568 /var/lib/containerd 35% of 20.5G 26.3% of 1373568 /etc/docker 35% of 20.5G 26.3% of 1373568 /var/lib/docker 35% of 20.5G 26.3% of 1373568 /home/user/.emacs.d/elpa 2% of 3.9G 2.4% of 262144 /rw/home/user/.emacs.d/elpa 2% of 3.9G 2.4% of 262144 /proc/xen - of 0 100.0% of 00 However it seems impossible to filter theses mounts in one call, (https://unix.stackexchange.com/questions/430074/how-to-exclude-bind-mounts-from-findmnt-results-list) and --fstab is a bad compromise as mounts points may be declared in many others ways than /etc/fstab.
Author
|
Hello @ldidry,
Finally after following your indication, this pull request become mainly
about using `findmnt` to construct a more compact view of the filesystems.
What do you think ?
|
A filesystem may freeze the script if it is not accessible. This had for effect to block ssh access in case of an indisponible remote filesystem.
apt will output something like 'Listing ... Done' which was counted as a package.
/var/run/reboot-required may be touched for other reasons that a pending kernel update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here we go :)
original message:
I am not sure all will interest you but I have passed a few hours to refactor the sysinfo python script for my own usage :