Saturday, 8 October 2016

Monitoring Load Average


The easiest way to monitor the load average is by using the output o the uptime command and a small awk script that will run as a cron job to store your data into a text file.

The awk script is the following :

cat /usr/local/src/uptime.sh
#!/bin/bash
uptime | awk  {'print $9 $10 $11'} | awk -F, {'print $1 " " $2 " " $3'}

sh /usr/local/src/uptime.sh
0.68 0.86 1.48

crontab -l
*/5 * * * * /usr/local/src/uptime.sh >> /var/log/uptime.data

head -5 /var/log/uptime.data
0.61 1.40 1.96
0.47 1.33 1.92
0.49 0.94 1.68
0.64 0.80 1.41
0.45 0.61 1.16

       
The Linux system we used has only one CPU, so any load average greater than 1.00 indicates a performance issue.

The first number shows the load average during the last minute, the second during the last five minutes and the third during the last 15 minute,. The three values can show you if the load is increasing, decreasing or steady.

No comments:

Post a Comment