I figured that it would be a good idea to compile in an article some tips and tricks, notably related to monitoring your server.
It is an opportunity to learn or re-learn to use the tools included in any good self-respecting distribution, but also how to complete these tools.
What I call “monitoring on site” is how to monitor its system from a shell. A number of commands exist to enable us to diagnose the operation of our server.
For starters, nothing beats the newspapers. Regarding our server, here are the ones that are mainly to monitor:
/var/log/syslog, Probably the most important of all,
/var/log/fail2ban.log, To monitor what fail2ban does,
/var/log/mail.log, To monitor the mail server,
/var/www/*/*/log/, To monitor access and errors on all of your websites.
To view a log in real time, use the following command:
Tail - f / var / log / syslog
To view the last X lines of a newspaper:
Tail - X / var / log / syslog
On-site monitoring also involves process monitoring. The following command:
Will tell you the state of the processes at the time you run the command. To view the status of the processes in real time, use the command:
There is another command, more graphic, which gives the same information. This one is not installed by default on our distributions, it is
htop. You will first need to install it as follows:
Apt - get install htop # Then to use it: htop
These commands also inform you of memory status, CPU usage, and more.
If you host your “home” server yourself, you may also need some temperature sensors:
Apt - get install lm - sensors sensors - detect
Likewise for hard drives:
Apt - get install hddtemp Hddtemp / dev / sd *
Other information about your hardware can be extracted from the pseudo file system
Cat / proc / cpuinfo Cat / proc / meminfo
If you benefit from a software raid, you can check its status in several ways:
Cat / proc / mdstat Mdadm - detail / dev / md0
Did you find this helpful and what other methods are you using? Join the discussion and contribute to this.