Add --sleep-collect, default 1.

This commit is contained in:
Daniel Nichter
2013-07-24 11:53:08 -07:00
parent 8f78050570
commit 50301e51d5
2 changed files with 11 additions and 5 deletions

View File

@@ -1992,6 +1992,12 @@ from triggering continuously, which might be a problem if the collection process
It also prevents filling up the disk or gathering too much data to analyze It also prevents filling up the disk or gathering too much data to analyze
reasonably. reasonably.
=item --sleep-collect
type: int; default: 1
How long to sleep between collection loop cycles.
=item --socket =item --socket
short form: -S; type: string short form: -S; type: string

View File

@@ -147,15 +147,15 @@ collect() {
$CMD_SYSCTL -a >> "$d/$p-sysctl" & $CMD_SYSCTL -a >> "$d/$p-sysctl" &
fi fi
if [ "$CMD_VMSTAT" ]; then if [ "$CMD_VMSTAT" ]; then
$CMD_VMSTAT 1 $OPT_RUN_TIME >> "$d/$p-vmstat" & $CMD_VMSTAT $OPT_SLEEP_COLLECT $OPT_RUN_TIME >> "$d/$p-vmstat" &
$CMD_VMSTAT $OPT_RUN_TIME 2 >> "$d/$p-vmstat-overall" & $CMD_VMSTAT $OPT_RUN_TIME 2 >> "$d/$p-vmstat-overall" &
fi fi
if [ "$CMD_IOSTAT" ]; then if [ "$CMD_IOSTAT" ]; then
$CMD_IOSTAT -dx 1 $OPT_RUN_TIME >> "$d/$p-iostat" & $CMD_IOSTAT -dx $OPT_SLEEP_COLLECT $OPT_RUN_TIME >> "$d/$p-iostat" &
$CMD_IOSTAT -dx $OPT_RUN_TIME 2 >> "$d/$p-iostat-overall" & $CMD_IOSTAT -dx $OPT_RUN_TIME 2 >> "$d/$p-iostat-overall" &
fi fi
if [ "$CMD_MPSTAT" ]; then if [ "$CMD_MPSTAT" ]; then
$CMD_MPSTAT -P ALL 1 $OPT_RUN_TIME >> "$d/$p-mpstat" & $CMD_MPSTAT -P ALL $OPT_SLEEP_COLLECT $OPT_RUN_TIME >> "$d/$p-mpstat" &
$CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" & $CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
fi fi
@@ -165,7 +165,7 @@ collect() {
# get and keep a connection to the database; in troubled times # get and keep a connection to the database; in troubled times
# the database tends to exceed max_connections, so reconnecting # the database tends to exceed max_connections, so reconnecting
# in the loop tends not to work very well. # in the loop tends not to work very well.
$CMD_MYSQLADMIN $EXT_ARGV ext -i1 -c$OPT_RUN_TIME >>"$d/$p-mysqladmin" & $CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$OPT_RUN_TIME >>"$d/$p-mysqladmin" &
local mysqladmin_pid=$! local mysqladmin_pid=$!
local have_lock_waits_table="" local have_lock_waits_table=""
@@ -189,7 +189,7 @@ collect() {
|| break || break
# Synchronize ourselves onto the clock tick, so the sleeps are 1-second # Synchronize ourselves onto the clock tick, so the sleeps are 1-second
sleep $(date +%s.%N | awk '{print 1 - ($1 % 1)}') sleep $(date +%s.%N | awk '{print $OPT_SLEEP_COLLECT - ($1 % $OPT_SLEEP_COLLECT)}')
local ts="$(date +"TS %s.%N %F %T")" local ts="$(date +"TS %s.%N %F %T")"
# ##################################################################### # #####################################################################