-
-
Save jjtroberts/7e4a6f100753269dc3531a9179ba172d to your computer and use it in GitHub Desktop.
Check average Memory usage of PHP-FPM processes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Average php-fpm process memory usage:" | |
PHPFPM="php-fpm" # it could be just php-fpm or php-fpm-X.X (eg. php-fpm-7.1) depending on configuration | |
AVG=$(ps --no-headers -o "rss,cmd" -C $PHPFPM | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }') | |
QTY=$(ps -ylC $PHPFPM --sort:rss | tail -n +2 | wc -l) | |
echo "$AVG on $QTY processes" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment