Tag Archives: average

Execute commands if load average is above in linux

Description

I needed this to do some testing with a load problem I had. One of our server would spike in load for a minute or two, but at random times.
I needed to see what was generating these spikes, but did not want to sit around waiting for it to happen and being ready to hit enter on the commands i needed to run when the load was spiking. So I made this simple little script that you can edit to your needs.

It’s a bash script, and requires the package “bc” to be installed (install it using your package manager if you don’t already have it installed.)

I have tested the script on CentOS and Debian.

I have tried commenting everything in the script as good as possible, but if you have any changes feel free to post a comment.

Continue reading