2013-02-07 19:32:06 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Sorry, you must currently manually edit the regexp to make this work
|
|
|
|
# on your machine.
|
|
|
|
|
|
|
|
master_pid=$(ps xa | grep windshaft | grep -v local | grep -v grep | awk '{print $1}')
|
|
|
|
|
|
|
|
# TODO: use pid files
|
|
|
|
worker_pids=$(ps xa | grep windshaft | grep local | awk '{print $1}' |
|
|
|
|
python -c "import sys; print ','.join((x.strip() for x in sys.stdin.readlines()))")
|
|
|
|
|
|
|
|
if test -z "${worker_pids}"; then
|
|
|
|
echo "No workers found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Master: $master_pid"
|
|
|
|
echo "Workers: $worker_pids"
|
|
|
|
|
|
|
|
for pid in $(echo $worker_pids | tr ',' ' '); do
|
2013-02-07 20:26:11 +08:00
|
|
|
|
|
|
|
pidrep="/tmp/checkfd.$pid.txt"
|
|
|
|
|
|
|
|
lsof -p $pid > "${pidrep}"
|
|
|
|
|
2013-02-07 19:32:06 +08:00
|
|
|
echo -n "worker $pid postgres: "
|
2013-02-07 20:26:11 +08:00
|
|
|
cat "${pidrep}" | grep ':6432 .EST' | wc -l;
|
2013-02-07 19:32:06 +08:00
|
|
|
|
|
|
|
echo -n "worker $pid redis: "
|
2013-02-07 20:26:11 +08:00
|
|
|
cat "${pidrep}" | grep ':6379 .EST' | wc -l;
|
2013-02-07 19:32:06 +08:00
|
|
|
|
|
|
|
echo -n "worker $pid incoming http: "
|
2013-02-07 20:26:11 +08:00
|
|
|
cat "${pidrep}" | grep ':8181' | wc -l;
|
2013-02-07 19:32:06 +08:00
|
|
|
|
|
|
|
echo -n "worker $pid total: "
|
2013-02-07 20:26:11 +08:00
|
|
|
cat "${pidrep}" | wc -l;
|
|
|
|
|
2013-02-07 19:32:06 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
echo -n "master $master_pid total: "
|
|
|
|
lsof -p $master_pid | grep node | wc -l;
|