-
-
Save blak3r/d470a4254059acca926a to your computer and use it in GitHub Desktop.
Output the number of files used by several processes to the command line every 5 seconds.
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
while true; do | |
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` | |
x1=`ps aux | grep "[v]ar.www.bin.asteriskPhoneEventProducer.js" | pcregrep -o1 "^root\s+(\d+)\s"` | |
x2=`ps aux | grep "[v]ar.www.bin.phoneEventProcessor.js" | pcregrep -o1 "^root\s+(\d+)\s"` | |
x3=`ps aux | grep "[v]ar.www.bin.phoneEventCoordinator.js" | pcregrep -o1 "^root\s+(\d+)\s"` | |
x4=`ps aux | grep "[v]ar.www.bin.app.js" | pcregrep -o1 "^root\s+(\d+)\s"` | |
x5=`ps aux | grep "[v]ar.www.bin.http.phone.event.producer.js" | pcregrep -o1 "^root\s+(\d+)\s"` | |
all=`lsof -i -n -P | grep "nodejs" | wc -l` | |
c1=`lsof -i -n -P | grep "nodejs.*$x1" | wc -l` | |
c2=`lsof -i -n -P | grep "nodejs.*$x2" | wc -l` | |
c3=`lsof -i -n -P | grep "nodejs.*$x3" | wc -l` | |
c4=`lsof -i -n -P | grep "nodejs.*$x4" | wc -l` | |
c5=`lsof -i -n -P | grep "nodejs.*$x5" | wc -l` | |
echo "$TIMESTAMP -- Total: $all AstFor: $c1 Producer0: $c2 Coord: $c3 App: $c4 HttpEv: $c5" | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created to monitor which of my node processes was leaking sockets over time...
Output looks like this:
Just edit the name of processes asteriskPhoneEventProducer, and potentially set root to the name of the user that runs the process.