MOTD - show memory usage, 50-landscape-sysinfo without swap info
Matthew Harrington
I would like to display the MOTD without swap info, because my machine does not have swap.
I have found the link ls /etc/update-motd.d/50-landscape-sysinfo which points to the file /usr/bin/landscape-sysinfo which displays the following message:
System load: 7.5 Processes: 434
Usage of /: 84.2% of 9.72GB Users logged in: 1
Memory usage: 5% IP address for eth0: 10.9.8.161
Swap usage: 0%
Graph this data and manage this system at: I have added the contents of both ls /etc/update-motd.d/50-landscape-sysinfo and /usr/bin/landscape-sysinfo here on pastebin. I would like to remove Swap usage: 0% from this message, as it could cause confusion. I don't know what is the best way to go about doing this, any suggestions?
1 Answer
One way to do so would be to disable the sysinfo plugin that handles swap usage. Unfortunately, the plugin that shows swap usage also handles the memory usage, so disabling it disabled both:
$ landscape-sysinfo --exclude-sysinfo-plugins=Memory System load: 0.0 Users logged in: 3 Usage of /: 56.0% of 15.62GB IP address for eth0: 10.1.1.1 Processes: 202 Graph this data and manage this system at: This can be set for the MOTD using the /etc/landscape/client.conf configuration file:
[sysinfo]
exclude_sysinfo_plugins = MemoryThe other way would be to process the output of /usr/bin/landscape-sysinfo by editing /etc/update-motd.d/50-landscape-sysinfo (which is actually a symlink to a file in /usr/lib, so your changes may be lost when you upgrade). Something like:
/usr/bin/landscape-sysinfo | sed 's/Swap usage: *[0-9]+%//'This would also lead to ugly output if there's one more item in the list (like a second network interface).
As Kevin points out, for the specific case of no swap, the output can be tidied up and the expression simplified:
/usr/bin/landscape-sysinfo | sed 's/Swap usage: *0% *//'This should shift any entry next to Swap entry to where the Swap entry was.
1