[Commits] Rev 80: Added scripts for simple monitoring and graphing with gnuplot. in file:///home/hakan/work/monty_program/mariadb-tools/

Hakan Kuecuekyilmaz hakan.kuecuekyilmaz at t-online.de
Tue Jan 11 03:48:25 EET 2011


At file:///home/hakan/work/monty_program/mariadb-tools/

------------------------------------------------------------
revno: 80
revision-id: hakan at askmonty.org-20110111014825-b1azjmzmp269ie47
parent: hakan at askmonty.org-20110110131022-qc8isiarr9di6xb4
committer: Hakan Kuecuekyilmaz <hakan at askmonty.org>
branch nick: mariadb-tools
timestamp: Tue 2011-01-11 02:48:25 +0100
message:
  Added scripts for simple monitoring and graphing with gnuplot.
-------------- next part --------------
=== added directory 'monitoring'
=== added file 'monitoring/README.txt'
--- a/monitoring/README.txt	1970-01-01 00:00:00 +0000
+++ b/monitoring/README.txt	2011-01-11 01:48:25 +0000
@@ -0,0 +1,1 @@
+Collection of tools for monitoring various aspects of the server.

=== added file 'monitoring/com_commit_monitor.sh'
--- a/monitoring/com_commit_monitor.sh	1970-01-01 00:00:00 +0000
+++ b/monitoring/com_commit_monitor.sh	2011-01-11 01:48:25 +0000
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Simple COM_COMMIT monitor
+#
+# Hakan Kuecuekyilmaz, <hakan at askmonty dot org>, 2010-12-16.
+
+if [ $# != 2 ]; then
+    echo "[ERROR]: Please use exactly two arguments"
+    echo "  Usage: $0 [time interval] [absolute | delta]"
+    echo "  Example: $0 10 delta"
+
+    exit 1
+else
+    INTERVALL="$1"
+    MODE="$2"
+fi
+
+# Adjust this patch to match your path to the mysql client.
+MYSQL="/usr/local/mysql/bin/mysql"
+
+COMMIT_COUNT_QUERY="SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'COM_COMMIT'"
+PROCESSES_COUNT_QUERY="SELECT count(*) FROM INFORMATION_SCHEMA.PROCESSLIST"
+
+while true
+    do
+    DATE=$(date +%s)
+    PROCESSES_COUNT=$(echo $PROCESSES_COUNT_QUERY | $MYSQL -uroot --column-names=false)
+    COMMIT_COUNT=$(echo $COMMIT_COUNT_QUERY | $MYSQL -uroot --column-names=false)
+
+    sleep $INTERVALL
+
+    if [  x"$MODE" = x"absolute" ]; then
+        echo "$DATE $PROCESSES_COUNT $COMMIT_COUNT"
+    else
+        DATE=$(date +%s)
+
+        COMMIT_COUNT2=$(echo $COMMIT_COUNT_QUERY | $MYSQL -uroot --column-names=false)
+        DELTA=$(($COMMIT_COUNT2 - $COMMIT_COUNT))
+
+        echo "$DATE $PROCESSES_COUNT $DELTA"
+    fi
+done

=== added file 'monitoring/gnuplot_com_commit.sh'
--- a/monitoring/gnuplot_com_commit.sh	1970-01-01 00:00:00 +0000
+++ b/monitoring/gnuplot_com_commit.sh	2011-01-11 01:48:25 +0000
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Write out gnuplot script for graphing data
+# generated by com_commit_monitor.sh.
+#
+# Redirect the output of this script and run it
+# through gnuplot to get the resulting graphic.
+#
+# Hakan Kuecuekyilmaz, <hakan at askmonty dot org>, 2010-12-16.
+#
+
+if [ $# != 3 ]; then
+    echo "[ERROR]: Please use exactly three arguments"
+    echo "  Usage: $0 [title] [data series file name] [output file name]"
+    echo "  Example: $0 'COM_COMMIT Rate' com_commit.log com_commit_64.png"
+
+    exit 1
+else
+    TITLE="$1"
+    DATA_SERIES_FILE="$2"
+    OUTPUT_FILE="$3"
+fi
+
+echo "set terminal png size 640, 370"
+echo "set output \"$OUTPUT_FILE\""
+
+echo "set term png font verdana 7"
+
+echo "set xtics rotate by -45"
+echo "set grid ytics"
+
+echo "set tmargin  2"
+echo "set rmargin  9"
+echo "set bmargin  5"
+echo "set lmargin  8"
+
+echo "set xdata time"
+echo "set timefmt \"%s\""
+echo "set format x \"%H:%M:%S\""
+
+echo "plot '$DATA_SERIES_FILE' using 1:3 title '$TITLE' with lines"



More information about the commits mailing list