memoryavg with the /go/memoryavg Command

/go/memoryavg watches how much of the server's memory is in use over time, so a short spike doesn't cause an alert but steady heavy use does. Each time it runs, it: For a single moment in time and the processes behind it, use mem instead. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

/go/memoryavg

Options

This command has no options. Arguments are only written to the log file.

Examples

# Add a sample and show the average
/go/memoryavg

# Reset the average by deleting the samples
sudo rm -f /var/log/memory.log

# See the recorded samples
tail -n 20 /var/log/memory.log

Output

The command prints one whole number: the average memory use in percent, without a % sign. The decimals are cut off, not rounded.

42

Each run adds a sample, so the first run after the file is cleared shows the current memory use itself.

The alert

When the average is above 70 (71 or more), the administrator gets an email and a WhatsApp message. Both say:

High Memory Usage Averages (73 %)

[!NOTE]
The command sends both messages every time it runs while the average stays above 70. Nothing limits how often alerts repeat.

Files

File Use
/var/log/memory.log One sample per line, in percent.
/var/log/go/memoryavg.log A record of each time the command ran.

See the full reference at /go/memoryavg and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *