mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
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>
This commit is contained in:
parent
bd77d783db
commit
e1c60adaf1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=174477
14 changed files with 333 additions and 0 deletions
|
@ -149,6 +149,7 @@
|
||||||
SUBDIR += mysql51-scripts
|
SUBDIR += mysql51-scripts
|
||||||
SUBDIR += mysql51-server
|
SUBDIR += mysql51-server
|
||||||
SUBDIR += mysql_last_value
|
SUBDIR += mysql_last_value
|
||||||
|
SUBDIR += mysqlard
|
||||||
SUBDIR += mysqlcc
|
SUBDIR += mysqlcc
|
||||||
SUBDIR += mysqlcppapi
|
SUBDIR += mysqlcppapi
|
||||||
SUBDIR += mysqlman
|
SUBDIR += mysqlman
|
||||||
|
|
40
databases/mysqlard/Makefile
Normal file
40
databases/mysqlard/Makefile
Normal file
|
@ -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>
|
3
databases/mysqlard/distinfo
Normal file
3
databases/mysqlard/distinfo
Normal file
|
@ -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
|
184
databases/mysqlard/files/mysqlard.sh.in
Normal file
184
databases/mysqlard/files/mysqlard.sh.in
Normal file
|
@ -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 $?
|
8
databases/mysqlard/files/patch-aa
Normal file
8
databases/mysqlard/files/patch-aa
Normal file
|
@ -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 $
|
||||||
|
#
|
8
databases/mysqlard/files/patch-ab
Normal file
8
databases/mysqlard/files/patch-ab
Normal file
|
@ -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 $
|
||||||
|
#
|
8
databases/mysqlard/files/patch-ac
Normal file
8
databases/mysqlard/files/patch-ac
Normal file
|
@ -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 $
|
||||||
|
#
|
8
databases/mysqlard/files/patch-ad
Normal file
8
databases/mysqlard/files/patch-ad
Normal file
|
@ -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
|
8
databases/mysqlard/files/patch-ae
Normal file
8
databases/mysqlard/files/patch-ae
Normal file
|
@ -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 $
|
||||||
|
#
|
11
databases/mysqlard/files/patch-af
Normal file
11
databases/mysqlard/files/patch-af
Normal file
|
@ -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 */
|
8
databases/mysqlard/files/patch-ag
Normal file
8
databases/mysqlard/files/patch-ag
Normal file
|
@ -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 $
|
||||||
|
#
|
25
databases/mysqlard/files/pkg-message.in
Normal file
25
databases/mysqlard/files/pkg-message.in
Normal file
|
@ -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>
|
||||||
|
|
||||||
|
==============================================================================
|
6
databases/mysqlard/pkg-descr
Normal file
6
databases/mysqlard/pkg-descr
Normal file
|
@ -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/
|
15
databases/mysqlard/pkg-plist
Normal file
15
databases/mysqlard/pkg-plist
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue