Jump to content

new motd for ubuntu/debian


vlad

Recommended Posts

Ok so first a big thanks to Igor for the work he has put into armbian, started using this build when it was still posted on Igor's site

 

anyway i wanted more information out of the motd and here is what i came up with this is running on my cubietruck with the latest kernel 

     _
 ___| |_ ___  _ __ __ _  __ _  ___
/ __| __/ _ \| '__/ _` |/ _` |/ _ \
\__ \ || (_) | | | (_| | (_| |  __/
|___/\__\___/|_|  \__,_|\__, |\___|
                        |___/

Welcome to Ubuntu 14.04.3 LTS (4.3.3-sunxi).

System information as of: Mon Jan 11 21:34:35 EET 2016

System load:       0.14         Memory usage: 97.5%
Local users:       0            Swap usage:   0.0%
IP address:        888.888.88.8 Uptime:       up 6 days, 19 hours, 50 minutes
Usage of root/:    8% of 16G    HDD temp:     43°C
Usage of storage/: 26% of 443G  Board temp:   47°C

0 updates to install.
0 are security updates.

Last login: Mon Jan 11 07:50:37 2016 from 888.888.88.888
root@storage:~#

this should work with both debian and ubuntu versions but has some hard coded values at least for the sensor temp in the cubietruck 

 

upload everything from the archive to the /etc/ folder, make the files inside executable (chmod +x) - the files are taken from https://nickcharlton.net/posts/debian-ubuntu-dynamic-motd.htmlbut 10-sysinfo was updated with more information

 

finally disable default motd by editing the bash.bashrc files (remove/delete) this lines

if [ -f /etc/bash.bashrc.custom ]; then
    . /etc/bash.bashrc.custom
fi 

 after this with every new login you should see the new motd

 

update-motd.d.zip

Link to comment
Share on other sites

yes thanks!

 

from nickcharlton

sudo chmod +x /etc/update-motd.d/

seems enough to work with my config

 

 

 

Using username "xxxxxxxxxxx".
Ubuntu 14.04.3 LTS

***************************************************************************
                            NOTICE TO USERS


This computer system is the private property of its owner, whether
individual, corporate or government.  It is for authorized use only.
Users (authorized or unauthorized) have no explicit or implicit
expectation of privacy.

Any or all uses of this system and all files on this system may be
intercepted, monitored, recorded, copied, audited, inspected, and
disclosed to your employer, to authorized site, government, and law
enforcement personnel, as well as authorized officials of government
agencies, both domestic and foreign.

By using this system, the user consents to such interception, monitoring,
recording, copying, auditing, inspection, and disclosure at the
discretion of such personnel or officials.  Unauthorized or improper use
of this system may result in civil and criminal penalties and
administrative or disciplinary action, as appropriate. By continuing to
use this system you indicate your awareness of and consent to these terms
and conditions of use. LOG OFF IMMEDIATELY if you do not agree to the
conditions stated in this warning.

****************************************************************************

Authenticating with public key "clef_xxxxxxxxxxxxx" from agent
 _           _
| |__  _ __ (_)
| '_ \| '_ \| |
| |_) | |_) | |
|_.__/| .__/|_|
      |_|

Welcome to Ubuntu 14.04.3 LTS (4.4.0-rc8-sunxi).

System information as of: Tue Jan 12 02:24:10 CET 2016

System load:       0.04         Memory usage: 82.7%
Local users:       0            Swap usage:   6.8%
IP address:                     Uptime:       up 4 days, 13 hours, 14 minutes
Usage of root/:    35% of 15G   HDD temp:     43°C
Usage of storage/:  of          Board temp:   37°C

0 updates to install.
0 are security updates.


You have new mail.
Last login: Tue Jan 12 02:24:20 2016 from 192.168.1.2

Load: 0.20, 0.10, 0.06 - Board: 39.1°C - Memory: 508Mb

 

 

Link to comment
Share on other sites

There was something that bugged me since day one, the memory usage calculation is off, because it doesn't take into account the memory used for buffers anyway I will update the archive today to reflect the changes :)

Link to comment
Share on other sites

ok so regarding the memory usage the output of free its a bit misleading (i was before i googled it) if your not familiar with how linux treats ram memory - http://www.linuxatemyram.com/will explain better than i could  

 

ok so here is the updated 10-sysinfo :)

     _
 ___| |_ ___  _ __ __ _  __ _  ___
/ __| __/ _ \| '__/ _` |/ _` |/ _ \
\__ \ || (_) | | | (_| | (_| |  __/
|___/\__\___/|_|  \__,_|\__, |\___|
                        |___/

Welcome to Ubuntu 14.04.3 LTS (4.3.3-sunxi).

System information as of: Tue Jan 12 22:31:17 EET 2016

System load:       0.37                 Memory usage: 7.0%
Local users:       1                    Swap usage:   0.0%
IP address:        192.168.88.4         Uptime:       up 1 week, 20 hours, 46 minutes
Usage of root/:    7% of 16G            HDD temp:     43°C
Usage of storage/: 26% of 443G          Board temp:   49°C

0 updates to install.
0 are security updates.

Last login: Tue Jan 12 22:30:41 2016 from 192.168.88.100
root@storage:~#

10-sysinfo.zip

Link to comment
Share on other sites

cool! next task... adding some colors ;) thanks!

System load:       0.03                 Memory usage: 55.8%
Local users:       1                    Swap usage:   9.8%
IP address:        86.218.14.121        Uptime:       up 5 days, 11 hours, 27 minutes
Usage of root/:    35% of 15G           HDD temp:     43°C
Usage of storage/: 14% of 116G          Board temp:   37°C

Link to comment
Share on other sites

Good work! :)

 

But there's a problem with these sort of 'snap-shot' data collections: while they're easy to collect/implement/display their meaning is pretty irrelevant.

 

As an example: Temperatures -- why should it be interesting to get the actual values? You're more interested in temperature peaks that occured, right? So you would have to collect them permanently and display the highest value since the last time you logged in (can be done but requires some efforts and either reinventing the wheel or the useage of already available monitoring tools)

 

This applies also to average load (that is somewhat problematic anyway -- see below), local users and storage/swap/memory useage. The peak value since last login is interesting and not the current one if you care about identifying problems (like a cronjob that starts at midnight and amoks for hours every night which you will never now by looking at login values).

 

BTW: Very useful to interpret some of the commonly used 'metrics' and their real meanings: http://slideshare.net/brendangregg/qcon-2015-broken-performance-tools

Link to comment
Share on other sites

information is irrelevant only if you consider it irrelevant, and lets not forget this is only a motd.

 

If you have a problem with the temperature it could be cause by a hardware problem in which case no piece of software is going to help you. Actually you can write a piece of code in *insert random programming language here* to regularly check the temperature and if it passed certain threshold shutdown the hardware to prevent damage but at least for A20 chips the datasheet states a recommended ambient temperature of max Ta = 70C, no information given for junction temperature (the temperature inside the IC) but it will work perfectly well above 100C. 

 

If on the other hand the rise in temperature its cause by software, without data logging every event you can't tell why you had a rise in temperature and that is in my opinion irrelevant.

 

regarding your cronjob example, you dont test your code before you start using it on a cronjob ?you controll the hw with the sw you write, why would the code hang if it was written to be robust ?I am sorry but using resource monitor to debug poorly written code you are doing it wrong.

 

returning to motd this is not suppose to replace a real system monitor, it supposed to give you quick information when you login, and for me this is all i want, and if you know you are expecting high loads/usage/temperatures you should look at the hundreds of linux monitors which will work on any board that could run armbian  

 

 

 

Link to comment
Share on other sites

If you have a problem with the temperature

 

Me? Nope, I have neither a problem with real temperatures nor wrong temperature read-outs (the usual 'we trust in numbers blindly' approach). I thought about the people you share your work with. And I'm sorry if you took my remarks as an insult. I just wanted to give a few suggestions.

 

A final one: The sysinfo stuff you promote here only works correctly under certain circumstances therefore most users won't be able to benefit from. Why not doing it right and differentiate between different boards and kernel variants? All the work is already done and just waits to be adopted:

 

https://github.com/igorpecovnik/lib/blob/master/scripts/armhwinfo

 

https://github.com/igorpecovnik/lib/blob/master/scripts/bashrc

Link to comment
Share on other sites

why would i take it as an insult :P

 

i clearly stated in the first post that some values are hard coded and i am using the mainline kernel which makes this not usable for everyone.

 

Surely it could be updated to work with all the boards and different kernels but i only have a cubietruck with the mainline kernel so i can't really test the changes on other boards and since my cubietruck is working as a 24/7 server i dont really want to take it down and check other kernels - but if you or any one else has hardware/time to test and make changes you are more than welcomed to do so, this is why i also posted this here :)

Link to comment
Share on other sites

but if you or any one else has hardware/time to test and make changes you are more than welcomed to do so

 

Definitely not :)

 

There is already code that deals will all boards that Armbian supports so I will never ever start to fix code that totally ignores that (to display even less relevant informations compared to the default one -- missing battery information for example). The way to go is to improve this already existing code instead of reinventing the wheel and introduce new and incompatible code.

 

Currently I'm thinking about extracting the thermal stuff from Armbian's default bashrc (since it's useful for users that use zsh for example or even other more advanced shells), combine it with monitoring to be able to display more interesting read-outs (peak values for the last 24h for example) to be able to also enhance motd: http://forum.armbian.com/index.php/topic/604-rfc-integrating-rpi-monitor-in-armbian

Link to comment
Share on other sites

ok let me put things in a different perspective for you

 

1. I don't really care about other boards, i clearly stated in the first post on what board/kernel this was written for.

2. the battery information is not relevant for me since i don't use a battery.

3. I am not reinventing the wheel I just chose a different way to fix my problem and i certainly did not introduce incompatible code because the code runs on the board/kernel it was written for (i am not quite sure why you refuse to understand that) also i think every one here is old enough to decide for himself/herself if he/she wants to use what i posted or not.

 

I only posted this because i thought it could be helpful for someone else, clearly for your case its not but i don't get why you keep telling me that i am trying to reinvent the wheel as long as this, as it is currently fixes my problem.

 

hope this makes things more easier to understand also i see no reason to keep discussing why i did it like this so you either use it like this propose new changes or go play somewhere else.

Link to comment
Share on other sites

Welcome to Ubuntu 14.04.3 LTS (4.4.0-rc8-sunxi).
...
Usage of storage/:  of          Board temp:   37°C
...
Load: 0.20, 0.10, 0.06 - Board: 39.1°C - Memory: 508Mb

 

Guillaume, may I ask which board you're running this on? Lamobo R1?

 

Do you still get those nice discrepancies between the motd and Igor's bashrc stuff (especially 'Memory')? And aren't you concerned that your board is swapping constantly even if it has plenty amounts of free memory? Care to post the output of this motd stuff immediately followed by the output of 'swapon -s'?

 

Thx

Link to comment
Share on other sites

newmotd.jpg

 

https://github.com/igorpecovnik/lib/tree/master/scripts/update-motd.d

 

I also did some rework based on those ideas. Battery info is also included, but need further testing. One full charge / discharge cycle is needed for auto calibration.

 

- info that is not needed is hidden: if no updates available, if there is only one user logged, if there is no temperature readings, ....

- each info has it's own configurable red point

 

Not included anywhere ... yet. Only testing.

Link to comment
Share on other sites

Thx, Igor!

 

Temperature read-outs will currently fail with sunxi 3.4.x kernel, right? And you're relying directly on i2c -- good.

 

BTW: Anyone able to compare 4.3 vs. 4.4 regarding A20 thermal read-outs? It seems 4.3 provides higher values. Can't remember exactly but with 4.0 or 4.1 we had the problem that thermal values were way too low (even below ambient temperature).

Link to comment
Share on other sites

Guillaume, may I ask which board you're running this on? Lamobo R1?

 

Do you still get those nice discrepancies between the motd and Igor's bashrc stuff (especially 'Memory')? And aren't you concerned that your board is swapping constantly even if it has plenty amounts of free memory? Care to post the output of this motd stuff immediately followed by the output of 'swapon -s'?

 

 

Herr Thomas,

 

As you guessed, yes!

 

in fact, I have set the board to do swap by tweaking the kernel to do it, also I am using zram then the ssd if needed

 

 

 

gr@bpi:~$ swapon -s
Filename                                Type            Size    Used    Priority
/home2/swap                             file            1953120 116624  -1
/dev/zram0                              partition       102560  102556  5
/dev/zram1                              partition       102560  102548  5

 

 

 

 

Also I have plenty of temperature I cannot compare including the picoolfan temp

 

Every 2.0s: df -h / /home2;echo;sudo hddtemp /dev/sda;echo;cat /proc/loadavg;echo;sensors;./fanctl.sh               Thu Jan 14 20:00:57 2016

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  4.9G  9.2G  35% /
/dev/sda1       116G   15G   95G  14% /home2

/dev/sda: SanDisk SDSSDP128G: 42°C

0.75 0.55 0.30 1/205 13040

axp209-isa-0000
Adapter: ISA adapter
ACIN:          +4.97 V
VBUS:          +0.00 V
BATT:          +1.51 V
APS:           +4.81 V
CHIP:          +50.4°C
BATT:         312.93 mW
ACIN:          +1.11 A
VBUS:          +0.00 A
BATT_CHRG:     +0.00 A
BATT_DISCHRG:  +0.11 A

sun4i_ts-isa-0000
Adapter: ISA adapter
SoC temperature:  +39.1°C

PiCoolFan
0       fanmode 0x01    #       sudo i2cset -y 1 0x6C 0 0x0Z b  # 0:off 1:on 2:auto
1       speed   0x02    #       sudo i2cset -y 1 0x6C 1 0x0Z b  # 0:0% 1:100% 2:25% 3:50% 4:75%
2       ctemp   0x0028  #       sudo i2cset -y 1 0x6C 2 0x0Z w  # current temp
4       ttemp   0x0035  #       sudo i2cset -y 1 0x6C 4 0x0Z w  # threshold temp
6       scale   0x00    #       sudo i2cset -y 1 0x6C 6 0x0Z b  # 0:C 1:F
7       fstat   0x01    #       sudo i2cset -y 1 0x6C 7 0x0Z b  # 0:Stop 1:Run
8       vcc_pi  0x0526  #       sudo i2cset -y 1 0x6C 8 0x0Z w  # VCC 5V
10      vcc_upi 0x0530  #       sudo i2cset -y 1 0x6C 10 0x0Z w # VCC HI 0x0ABC
12      vcc_dpi 0x0480  #       sudo i2cset -y 1 0x6C 12 0x0Z w # VCC LO 0x0ABC
14      hwver   0x12    #       sudo i2cset -y 1 0x6C 14 0x0Z b # ver HF - 0x00 DEF 0xEE READ 0xFF STORE
15      rtccf   0x00    #       sudo i2cset -y 1 0x6C 15 0x0Z b # 0x00 0x80 - 0x01 0x79 speed - 0x81 0xFF slow

 

et voilà

Link to comment
Share on other sites

My little motd :P

░█▀▀░▄▀▄░█░█░█▀▀░█▀▀░▀▀█░█▀▀░█▀▄░█▀█░█░█
░▀▀█░█\█░█░█░█▀▀░█▀▀░▄▀░░█▀▀░█▀▄░█░█░▄▀▄
░▀▀▀░░▀\░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀

Welcome to Debian GNU/Linux 8.2 (jessie) (Kernel Version: 4.3.3-sunxi).

ï¼³ï½™ï½“ï½”ï½…ï½ ï¼©ï½Žï½†ï½ï½’ï½ï½ï½”iï½ï½Ž

System load: 0.49 Memory usage: 97.2%
Usage on root: 66% Usage on hdd: 62%
S.M.A.R.T: OK Swap usage: 0.0%
Processes: 108 IP: 10.0.0.53
CPU: 34.1°C HDD: 31°C

ï¼³ï½™ï½“ï½”ï½…ï½ ï¼µï½ï½„ï½ï½”es

1 updates to install.
0 are security updates.
0 npm updates to install.
0 pip updates to install.

ï¼³ï½™ï½“ï½”ï½…ï½ ï¼³ï½…ï½’ï½–ï½‰ï½ƒï½…ï½“

squeezeboxserver: # syncthing: # mysql: #

ï¼³ï½™ï½“ï½”ï½…ï½ ï¼¬ï½ï½‡ï½“

[Mon Jan 11 11:15:13 2016] sun7i-dwmac 1c50000.ethernet eth0: Link is Down
[Mon Jan 11 11:15:36 2016] sun7i-dwmac 1c50000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

ï¼³ï½™ï½“ï½”ï½…ï½ ï¼µï½ï½”iï½ï½…

Current 15 days, 10:29:54 | Linux 4.3.3-sunxi Wed Dec 30 12:01:13 2015
Total 24 days, 01:21:30 | since Sun Dec 20 00:41:11 2015

the squeezebox and syncthing are color coded so that the hashtag displays red if its down and green if its up

Link to comment
Share on other sites

So i got tired of having it spread out and made one file for it all :) feel free to improve upon it :D it adds itself to profile and if its missing tools it displays N/A

 

uses these packages: cpufrequtils, smartmontools, uptimed, toilet

chmod +x /usr/bin/motd

post-36-0-52020700-1456993717_thumb.png

 

motd.zip

Link to comment
Share on other sites

  • Igor unpinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines