au Qua Station - Part 7 - Configuring utilities for a headless server
Basically, I am using these machines for file syncing, so I don't need to access them directly very often, but sometimes I might need to check the status, delete files, update the system, etc. I can do this via SSH (or, preferably, MOSH), but typing passwords over and over every time is a pain - so we shoudl automate this.
The first thing to do is to go to the laptop/desktop you want to use to connect from, and run:
ssh-copy-id user@destination
for each machine you want to be able to log into automatically.
(You may have to generate an SSH key first if you haven't already by running ssh-keygen).
with the login automated.
Enter dsh
Distributed Shell is a tool that allows you to run the same SSH command on multiple machines at once, instead of logging into each machine separately to issue the command.
In Ubuntu, installation is straightforward:
sudo apt-get install dsh
Next, edit the config file which defines the hosts that dsh knows about:
sudo nano /etc/dsh/machines.list
Once this is SSH keys are set up to allow for automatic login, and the hosts are defined in the configuration file, then we are ready to go:
As an example, let's check the free space on the home partition of all of our machines.
console@quastation1:~$ dsh -aM -c df -h | grep home
localhost: /dev/sda2 917G 219G 698G 24% /home
quastation5.local: /dev/sda2 917G 342G 575G 38% /home
quastation6.local: /dev/sda2 917G 155G 762G 17% /home
quastation4.local: /dev/sda2 916G 476G 439G 53% /home
quastation2.local: /dev/sda2 917G 330G 587G 36% /home
quastation3.local: /dev/sda3 868G 122G 745G 15% /home
quastation7.local: /dev/satab3 853G 686G 166G 81% /home
quastation8.local: /dev/sataa2 867G 452G 413G 53% /home
As you can see, dsh will run your command on each machine and return the results together.
For quick commands like df, etc., dsh is great.
if you are interested in a GUI solution for Unix, then clusterssh might be more your speed. A great alternative for Windows is Mobaxterm.
But sometimes a web interface is better - luckily, there is a nifty lightweight utility for general maintenance and reporting called "cockpit".
sudo apt-get -y install cockpit cockpit-machines
sudo systemctl start cockpit
You only need run the commands above and then visit http://your-machines-hostname:9090/
The server uses SSL, so you will probably have to select to ignore the self-signed certificate in your browser.
With this utility, you can view all sorts of data about your server(s):
You can also get a command prompt from this page:The emulation is much better than I expected.
Best of all, though, instead of logging into each server, you can link them so that you log into one machine and it will show you the statistics of the other machines overlaid on the same graph.
For example, you can monitor real time network traffic:
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bashDownloading File Browser for linux/arm64...
https://github.com/filebrowser/filebrowser/releases/download/v2.15.0/linux-arm64-filebrowser.tar.gz
Extracting...
Putting filemanager in /usr/local/bin (may require password)
Successfully installed
Update: The installation has changed, it should now be:
It can be run with:
nohup filebrowser -a 0.0.0.0 -r/home/share/ &
This basic interface allows:
Upon accessing the link, a page like the following will appear:
Comments
Post a Comment