aboutsummaryrefslogtreecommitdiffstats
path: root/databases/mysqlard
diff options
context:
space:
mode:
authoralepulver <alepulver@FreeBSD.org>2006-10-05 04:00:40 +0800
committeralepulver <alepulver@FreeBSD.org>2006-10-05 04:00:40 +0800
commit3b8cd24a0ac942d1b0b21476c6a3a54786e694a7 (patch)
tree4bb0132b028a1bd7adab71f125192b2153a8b537 /databases/mysqlard
parentf26de80fc480e83b65ae812262f8e20e780a2b17 (diff)
downloadfreebsd-ports-gnome-3b8cd24a0ac942d1b0b21476c6a3a54786e694a7.tar.gz
freebsd-ports-gnome-3b8cd24a0ac942d1b0b21476c6a3a54786e694a7.tar.zst
freebsd-ports-gnome-3b8cd24a0ac942d1b0b21476c6a3a54786e694a7.zip
The MySQL Activity Report package is a tool to help MySQL database
administrators to collect several database parameters and variables. These collected values can be used for server monitoring or performance tuning purposes. WWW: http://gert.sos.be/en/projects/mysqlar/ PR: ports/101217 Submitted by: Greg Albrecht <gregoryba at gmail.com>
Diffstat (limited to 'databases/mysqlard')
-rw-r--r--databases/mysqlard/Makefile40
-rw-r--r--databases/mysqlard/distinfo3
-rw-r--r--databases/mysqlard/files/mysqlard.sh.in184
-rw-r--r--databases/mysqlard/files/patch-aa8
-rw-r--r--databases/mysqlard/files/patch-ab8
-rw-r--r--databases/mysqlard/files/patch-ac8
-rw-r--r--databases/mysqlard/files/patch-ad8
-rw-r--r--databases/mysqlard/files/patch-ae8
-rw-r--r--databases/mysqlard/files/patch-af11
-rw-r--r--databases/mysqlard/files/patch-ag8
-rw-r--r--databases/mysqlard/files/pkg-message.in25
-rw-r--r--databases/mysqlard/pkg-descr6
-rw-r--r--databases/mysqlard/pkg-plist15
13 files changed, 332 insertions, 0 deletions
diff --git a/databases/mysqlard/Makefile b/databases/mysqlard/Makefile
new file mode 100644
index 000000000000..fc50ef605729
--- /dev/null
+++ b/databases/mysqlard/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: mysqlard
+# Date created: 31 July 2006
+# Whom: Greg Albrecht <gregoryba@gmail.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= mysqlard
+PORTVERSION= 1.0.0
+CATEGORIES= databases www
+MASTER_SITES= http://gert.sos.be/downloads/mysqlar/
+
+MAINTAINER= gregoryba@gmail.com
+COMMENT= A tool to collect and graph database statistics from mysql
+
+BUILD_DEPENDS= rrdtool:${PORTSDIR}/net/rrdtool
+RUN_DEPENDS:= ${BUILD_DEPENDS}
+
+USE_APACHE= 1.3+
+USE_GETOPT_LONG=yes
+USE_MYSQL= yes
+
+MYSQLARD_DIR?= ${PREFIX}/www/mysqlard
+
+USE_RC_SUBR= mysqlard.sh
+
+MAN1= mysqlar_graph.1
+MAN8= mysqlard.8
+
+GNU_CONFIGURE= yes
+CONFIGURE_TARGET= --build=${ARCH}-portbld-freebsd${OSREL}
+CONFIGURE_ARGS= --with-rrd="${LOCALBASE}" --datadir="${PREFIX}/www" \
+ --sysconfdir="${PREFIX}/etc"
+
+SUB_FILES= pkg-message
+
+post-install:
+ @${ECHO_CMD}; ${CAT} ${PKGMESSAGE}; ${ECHO_CMD}
+
+.include <bsd.port.mk>
diff --git a/databases/mysqlard/distinfo b/databases/mysqlard/distinfo
new file mode 100644
index 000000000000..21a38f80484f
--- /dev/null
+++ b/databases/mysqlard/distinfo
@@ -0,0 +1,3 @@
+MD5 (mysqlard-1.0.0.tar.gz) = 693ef6f36ca232131b22db7063cae940
+SHA256 (mysqlard-1.0.0.tar.gz) = 07f333110c8fbb0174a534570884471139b00c96950f56a55fdbbd4683aef7f4
+SIZE (mysqlard-1.0.0.tar.gz) = 109656
diff --git a/databases/mysqlard/files/mysqlard.sh.in b/databases/mysqlard/files/mysqlard.sh.in
new file mode 100644
index 000000000000..6db84303808e
--- /dev/null
+++ b/databases/mysqlard/files/mysqlard.sh.in
@@ -0,0 +1,184 @@
+#!/usr/local/bin/bash
+#
+# $Id: mysqlard.server.sh 40 2006-01-20 20:26:11Z dewitge $
+#
+# MySQL Activity Report
+# mysqlard Start script for the MySQL Activity Report Daemon
+#
+# Copyright 2004 Gert Dewit <gert.dewit@sos.be>
+#
+# chkconfig: - 79 11
+# description: MySQL Activity Report Daemon
+# processname: mysqlard
+# config: %%PREFIX%%/etc/mysqlard.cnf
+# pidfile: /var/run/mysqlard.pid
+
+. %%RC_SUBR%%
+
+# Source the config script
+if [[ "$datadir" == "" ]] ; then
+ echo Loading defaultsettings
+ . %%PREFIX%%/etc/mysqlard.cnf
+fi
+
+########################################################################
+# Options, change them in %%PREFIX%%/etc/mysqlard.cnf or you can override
+# them here, but that's not recommended. Read the comments in
+# %%PREFIX%%/etc/mysqlard.cnf if you want to know what you're changing.
+
+step=${step:="60"}
+minsamples=${minsamples:="720"}
+datadir=${datadir:="%%PREFIX%%/www/mysqlard"}
+pidfile=/var/run/mysqlard.pid
+RRDTOOL=${RRDTOOL:="%%PREFIX%%/bin/rrdtool"}
+MYSQLARD=${MYSQLARD:="%%PREFIX%%/sbin/mysqlard"}
+MYSQLUSER=${MYSQLUSER:="mysqlar"}
+MYSQLHOST=${MYSQLHOST:=""}
+########################################################################
+
+# don't change anything below this line, but heck, I can't stop you ;-)
+confile=${confile:="${datadir}/connections.rrd"}
+tabfile=${tabfile:="${datadir}/table_cache.rrd"}
+keyfile=${keyfile:="${datadir}/key_cache.rrd"}
+queryfile=${queryfile:="${datadir}/queries.rrd"}
+slavefile=${slavefile:="${datadir}/slave.rrd"}
+
+slaveopt=
+if [[ "$slave" != "" ]]; then
+ slaveopt=-L
+fi
+
+if [[ "$MYSQLHOST" != "" ]] ; then
+ MYSQLHOST=--host=$MYSQLHOST
+fi
+
+# functions
+avgsamps () {
+ avg=$(($1 / $2))
+ if [ ${avg} -lt 1 ]
+ then
+ avg=1
+ fi
+ echo ${avg}
+}
+archives () {
+ arch=$(($1 / $2))
+ if [[ $(($2 * ${arch} * $3)) -lt $4 ]]
+ then
+ arch=$((${arch} + 1))
+ fi
+ echo ${arch}
+}
+
+# calculated values
+heartbeat=$((${step} * 2))
+hoursamps=$((3600 / ${step}))
+houravgs=$(avgsamps ${hoursamps} ${minsamples})
+hourarchives=$(archives ${hoursamps} ${houravgs} ${step} 3600)
+daysamps=$((86400 / ${step}))
+dayavgs=$(avgsamps ${daysamps} ${minsamples})
+dayarchives=$(archives ${daysamps} ${dayavgs} ${step} 86400)
+weeksamps=$((604800 / ${step}))
+weekavgs=$(avgsamps ${weeksamps} ${minsamples})
+weekarchives=$(archives ${weeksamps} ${weekavgs} ${step} 604800)
+monthsamps=$((2678400 / ${step}))
+monthavgs=$(avgsamps ${monthsamps} ${minsamples})
+montharchives=$(archives ${monthsamps} ${monthavgs} ${step} 2678400)
+yearsamps=$((31622400 / ${step}))
+yearavgs=$(avgsamps ${yearsamps} ${minsamples})
+yeararchives=$(archives ${yearsamps} ${yearavgs} ${step} 31622400)
+
+# calculated RRA's
+hourrra="RRA:AVERAGE:0.5:${houravgs}:${hourarchives}"
+dayrra="RRA:AVERAGE:0.5:${dayavgs}:${dayarchives}"
+weekrra="RRA:AVERAGE:0.5:${weekavgs}:${weekarchives}"
+monthrra="RRA:AVERAGE:0.5:${monthavgs}:${montharchives}"
+yearrra="RRA:AVERAGE:0.5:${yearavgs}:${yeararchives}"
+allrras="${hourrra} ${dayrra} ${weekrra} ${monthrra} ${yearrra}"
+
+initrrd () {
+if [ ! -f ${confile} ]
+then
+ ${RRDTOOL} create ${confile} --step ${step} \
+ DS:threads_connected:GAUGE:${heartbeat}:0:U \
+ DS:max_connections:GAUGE:${heartbeat}:0:U \
+ ${allrras}
+fi
+
+if [ ! -f ${tabfile} ]
+then
+ ${RRDTOOL} create ${tabfile} --step ${step} \
+ DS:open_tables:GAUGE:${heartbeat}:0:U \
+ DS:table_cache:GAUGE:${heartbeat}:0:U \
+ DS:created_tmp_tables:COUNTER:${heartbeat}:0:U \
+ DS:created_tmp_disk_t:COUNTER:${heartbeat}:0:U \
+ ${allrras}
+fi
+
+if [ ! -f ${keyfile} ]
+then
+ ${RRDTOOL} create ${keyfile} --step ${step} \
+ DS:key_reads:COUNTER:${heartbeat}:0:U \
+ DS:key_read_requests:COUNTER:${heartbeat}:0:U \
+ DS:key_buffer_size:GAUGE:${heartbeat}:0:U \
+ DS:key_blocks_used:GAUGE:${heartbeat}:0:U \
+ DS:select_full_join:COUNTER:${heartbeat}:0:U \
+ DS:select_range_check:COUNTER:${heartbeat}:0:U \
+ DS:handler_read_key:COUNTER:${heartbeat}:0:U \
+ DS:handler_read_rnd:COUNTER:${heartbeat}:0:U \
+ DS:slow_queries:COUNTER:${heartbeat}:0:U \
+ ${allrras}
+fi
+
+if [ ! -f ${queryfile} ]
+then
+ ${RRDTOOL} create ${queryfile} --step ${step} \
+ DS:questions:COUNTER:${heartbeat}:0:U \
+ DS:com_select:COUNTER:${heartbeat}:0:U \
+ DS:com_insert:COUNTER:${heartbeat}:0:U \
+ DS:com_update:COUNTER:${heartbeat}:0:U \
+ DS:com_delete:COUNTER:${heartbeat}:0:U \
+ ${allrras}
+fi
+
+if [ ! -f ${slavefile} ]
+then
+ ${RRDTOOL} create ${slavefile} --step ${step} \
+ DS:read_master_log_pos:COUNTER:${heartbeat}:0:U \
+ DS:exec_master_log_pos:COUNTER:${heartbeat}:0:U \
+ ${allrras}
+fi
+}
+
+status() {
+if [ -f $pidfile ]
+then
+ echo $0 is running. PID `cat ${pidfile}`
+else
+ echo $0 is not running.
+fi
+
+}
+
+case "$1" in
+ start)
+ initrrd
+ ${MYSQLARD} --step=${step} --datadir=${datadir} --user=${MYSQLUSER}
+$MYSQLHOST --pidfile=${pidfile} ${slaveopt}
+ ;;
+ stop)
+ kill `cat ${pidfile}`
+ rm -f ${pidfile}
+ ;;
+ initrrd)
+ initrrd
+ ;;
+ status)
+ status
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|initrrd}"
+ exit 1
+esac
+
+exit $?
diff --git a/databases/mysqlard/files/patch-aa b/databases/mysqlard/files/patch-aa
new file mode 100644
index 000000000000..8d64bfa71e9d
--- /dev/null
+++ b/databases/mysqlard/files/patch-aa
@@ -0,0 +1,8 @@
+--- src/mysqlard.server.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlard.server.sh Tue Aug 1 11:11:29 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # $Id: mysqlard.server.sh 40 2006-01-20 20:26:11Z dewitge $
+ #
diff --git a/databases/mysqlard/files/patch-ab b/databases/mysqlard/files/patch-ab
new file mode 100644
index 000000000000..982111d17c75
--- /dev/null
+++ b/databases/mysqlard/files/patch-ab
@@ -0,0 +1,8 @@
+--- src/mysqlar.monthly.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlar.monthly.sh Tue Aug 1 11:10:54 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # $Id: mysqlar.monthly.sh 35 2004-03-10 15:48:41Z dewitge $
+ #
diff --git a/databases/mysqlard/files/patch-ac b/databases/mysqlard/files/patch-ac
new file mode 100644
index 000000000000..568144396da2
--- /dev/null
+++ b/databases/mysqlard/files/patch-ac
@@ -0,0 +1,8 @@
+--- src/mysqlar.weekly.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlar.weekly.sh Tue Aug 1 11:11:09 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # $Id: mysqlar.weekly.sh 35 2004-03-10 15:48:41Z dewitge $
+ #
diff --git a/databases/mysqlard/files/patch-ad b/databases/mysqlard/files/patch-ad
new file mode 100644
index 000000000000..ff136162a11b
--- /dev/null
+++ b/databases/mysqlard/files/patch-ad
@@ -0,0 +1,8 @@
+--- src/mysqlard.cnf.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlard.cnf.sh Tue Aug 1 11:11:22 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ # $Id: mysqlard.cnf.sh 40 2006-01-20 20:26:11Z dewitge $
+ #
+ # MySQL Activity Report
diff --git a/databases/mysqlard/files/patch-ae b/databases/mysqlard/files/patch-ae
new file mode 100644
index 000000000000..3f71255d6425
--- /dev/null
+++ b/databases/mysqlard/files/patch-ae
@@ -0,0 +1,8 @@
+--- src/mysqlar.daily.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlar.daily.sh Tue Aug 1 11:10:47 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # $Id: mysqlar.daily.sh 35 2004-03-10 15:48:41Z dewitge $
+ #
diff --git a/databases/mysqlard/files/patch-af b/databases/mysqlard/files/patch-af
new file mode 100644
index 000000000000..24fa7a805a53
--- /dev/null
+++ b/databases/mysqlard/files/patch-af
@@ -0,0 +1,11 @@
+--- src/mysqlar.php.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlar.php.sh Tue Aug 1 11:13:32 2006
+@@ -15,7 +15,7 @@
+ * and has only usage permissions, no grants on any databases or tables.
+ */
+ $sqlhost = "localhost";
+- $sqluser = "";
++ $sqluser = "mysqlar";
+ $sqlpassword = "";
+
+ /* sort a matrix using column as key */
diff --git a/databases/mysqlard/files/patch-ag b/databases/mysqlard/files/patch-ag
new file mode 100644
index 000000000000..47a4ed9461d3
--- /dev/null
+++ b/databases/mysqlard/files/patch-ag
@@ -0,0 +1,8 @@
+--- src/mysqlar_graph.sh.orig Tue Aug 1 11:23:19 2006
++++ src/mysqlar_graph.sh Tue Aug 1 12:53:48 2006
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # $Id: mysqlar_graph.sh 40 2006-01-20 20:26:11Z dewitge $
+ #
diff --git a/databases/mysqlard/files/pkg-message.in b/databases/mysqlard/files/pkg-message.in
new file mode 100644
index 000000000000..72ccc0f3e11e
--- /dev/null
+++ b/databases/mysqlard/files/pkg-message.in
@@ -0,0 +1,25 @@
+==============================================================================
+
+1) Add the 'mysqlar' user with USAGE privileges to your mysql server:
+
+$ mysql -u root -p mysql
+mysql> GRANT USAGE ON *.* TO mysqlar@localhost;
+mysql> FLUSH PRIVILEGES;
+
+2) Add the mysqlard crontab to root's crontab:
+
+*/5 * * * * hourly=1 daily=1 weekly=1 monthly=1 \
+%%PREFIX%%/bin/mysqlar_graph > /dev/null
+
+3) Add a line like this to your apache's httpd.conf:
+
+Alias /mysqlar/ %%PREFIX%%/www/mysqlard/
+<Directory "%%PREFIX%%/www/mysqlard">
+ Options Indexes FollowSymLinks MultiViews ExecCGI
+ AllowOverride All
+ Order allow,deny
+ Allow from all
+ DirectoryIndex mysqlar.php
+</Directory>
+
+==============================================================================
diff --git a/databases/mysqlard/pkg-descr b/databases/mysqlard/pkg-descr
new file mode 100644
index 000000000000..d9a49aa94e0f
--- /dev/null
+++ b/databases/mysqlard/pkg-descr
@@ -0,0 +1,6 @@
+The MySQL Activity Report package is a tool to help MySQL database
+administrators to collect several database parameters and variables.
+These collected values can be used for server monitoring or
+performance tuning purposes.
+
+WWW: http://gert.sos.be/en/projects/mysqlar/
diff --git a/databases/mysqlard/pkg-plist b/databases/mysqlard/pkg-plist
new file mode 100644
index 000000000000..944f55af2476
--- /dev/null
+++ b/databases/mysqlard/pkg-plist
@@ -0,0 +1,15 @@
+@unexec if cmp -s %D/etc/mysqlard.cnf %D/www/mysqlard/mysqlard.cnf; then rm -f %D/etc/mysqlard.cnf; fi
+@exec [ -f %D/etc/mysqlard.cnf ] || cp %D/www/mysqlard/mysqlard.cnf %D/etc
+bin/mysqlar_graph
+sbin/mysqlard
+www/mysqlard/mysql.gif
+www/mysqlard/mysqlar.daily
+www/mysqlard/mysqlar.monthly
+www/mysqlard/mysqlar.php
+www/mysqlard/mysqlar.weekly
+www/mysqlard/mysqlard.cnf
+www/mysqlard/mysqlard.server
+www/mysqlard/rrdtool.gif
+www/mysqlard/sos.gif
+www/mysqlard/style.css
+@dirrm www/mysqlard