/go/mem: mem from the Command Line

/go/mem shows which processes use the most memory, so you can find what is eating the server's RAM. It: The alert looks at one process at a time. It does not measure total memory use across the server. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

/go/mem

Options

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

Examples

# Show the biggest memory users, and alert if one is over 75%
/go/mem

Output

The command prints two tables, each under a line of dashes as wide as the terminal (40 characters if the width is unknown):

Section Sorted by Rows
MEMORY: %MEM, highest first The header row and the top 9 processes
VSIZE (VSZ): VSZ, highest first The header row and the top 9 processes

Each table has the standard ps aux columns: USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, and COMMAND. An illustrative row:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
mysql 1021 2.1 18.4 2850312 1503244 ? Ssl Nov19 41:07 /usr/sbin/mariadbd

The alert

When the condition is met, the administrator gets an email and a WhatsApp message with this text:

High Memory Usage (82 %)
User: mysql
Command (MEM): /usr/sbin/mariadbd
Command (VSZ): /usr/sbin/mariadbd

The percentage is rounded down, and the command is only the program name (the first word of the command line, without its arguments).

Every run is also recorded in /var/log/go/mem.log.

[!NOTE]
The command sends both messages every time it runs while the condition is true. Nothing limits how often alerts repeat.

See the full reference at /go/mem 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 *