Browse code

Add pidstat support

pidstat is a script that comes from sysstat, but will give us
per-process information. Allow enabling "pidstat" that will run pidstat
to give info every 5 seconds by default.

Change-Id: I5ec7d5abce81125b55985bba3ccaf8073ccdfa2a

Russell Bryant authored on 2014/01/24 02:41:18
Showing 1 changed files
... ...
@@ -291,6 +291,9 @@ SYSLOG_PORT=${SYSLOG_PORT:-516}
291 291
 SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
292 292
 SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
293 293
 
294
+PIDSTAT_FILE=${PIDSTAT_FILE:-"pidstat.txt"}
295
+PIDSTAT_INTERVAL=${PIDSTAT_INTERVAL:-"5"}
296
+
294 297
 # Use color for logging output (only available if syslog is not used)
295 298
 LOG_COLOR=`trueorfalse True $LOG_COLOR`
296 299
 
... ...
@@ -874,6 +877,16 @@ if is_service_enabled sysstat; then
874 874
     fi
875 875
 fi
876 876
 
877
+if is_service_enabled pidstat; then
878
+    # Per-process stats
879
+    PIDSTAT_OPTS="-l -p ALL -T ALL"
880
+    if [[ -n ${SCREEN_LOGDIR} ]]; then
881
+        screen_it pidstat "cd $TOP_DIR; pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL > $SCREEN_LOGDIR/$PIDSTAT_FILE"
882
+    else
883
+        screen_it pidstat "pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL"
884
+    fi
885
+fi
886
+
877 887
 
878 888
 # Start Services
879 889
 # ==============