browbeat/pbench/mariadb-track.sh
Joe Talerico cbef1ccacd Graphing - Updated. browbeat now able to kick off connmon and pbench
with user-script to monitor database
2015-10-19 15:21:16 -04:00

18 lines
580 B
Bash
Executable File

#!/bin/bash
CONNECTIONS=$(mysql -u root -e "select count(*), db from information_schema.processlist group by db")
DATA_FILE=./pbench-maraidb-connections.csv
INTERVAL=10
while true; do
TIME=$(date "+%y-%m-%d %H:%M:%S")
echo "${CONNECTIONS}" | while IFS= read -r line ; do
if [[ "$line" =~ .*count.* ]] ; then continue ; fi
if [[ "$line" =~ .*NULL.* ]] ; then continue ; fi
count=$(echo $line | awk '{print $1}')
service=$(echo $line | awk '{print $2}')
echo "$TIME,$service,$count"
echo "$TIME,$service,$count" >> ${DATA_FILE}
done
sleep $INTERVAL
done