Skip to content

Commit

Permalink
Add server memory usage monitoring script
Browse files Browse the repository at this point in the history
  • Loading branch information
callaa committed Feb 25, 2015
1 parent 259c1fc commit c5378b6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/srv-mem.sh
@@ -0,0 +1,24 @@
#!/bin/bash

# Print out drawpile-srv's memory usage.
# Output consists of timestamp + process number and the following columns:
# - Maximum resident set size (waterline)
# - Current resident set size
# - Swapped out virtual memory size

PIDS=$(pgrep drawpile-srv)

if [ -z "$PIDS" ]
then
exit
fi

NOW=$(date -Iseconds)

for PID in $PIDS
do
echo -n "$NOW [$PID]; "
egrep "^Vm(HWM|RSS|Swap)" /proc/$PID/status | awk '{ printf "%s %s; ", $2, $3 }'
echo
done

0 comments on commit c5378b6

Please sign in to comment.