Thursday, November 13, 2008

Install Mysql Activity Report on Ubuntu

Install these two packages:

apt-get install librrd2-dev libmysqlclient15-dev

Download the Mysql Report Activity:

wget http://freshmeat.net/redir/mysqlard/...d-1.0.0.tar.gz

tar -xvzf mysqlard-1.0.0.tar.gz
cd mysqlard-1.0.0

./configure
make
make install

Edit /usr/local/share/mysqlard/mysqlar.php and change username and password for your Mysql Database.

Give access right to www-data user for vim /usr/local/share/mysqlard/ :

chown www-data.www-data /usr/local/share/mysqlard/mysqlar.php

Add the alias to apache config file ( I added a new conf file in /etc/apache2/conf.d/ ):

vim /etc/apache2/conf.d/mysqlard.conf

and add these lines to it:

Alias /mysqlard /usr/local/share/mysqlard

"Directory /usr/local/share/mysqlard"

php_flag register_globals off

Options Indexes FollowSymLinks

"IfModule mod_dir.c"

DirectoryIndex mysqlard.php
"/IfModule"

"/Directory"


(change "" with <>).

Create a user in MYSQL:

GRANT USAGE ON *.* TO mysqlar@localhost;

and then change the user in mysqlar.php.

Check too all paths in these files:

mysqlard.server

mysqlard.cnf
mysqlard_graph

Copy the following files in appropriate crontab folders:
mysqlar.daily
mysqlar.weekly
mysqlar.monthly

You need to add a cron job to generate the graphs. For example :
*/5 * * * * root hourly=1 daily=1 weekly=1 monthly=1\
/usr/bin/mysqlar_graph > /dev/null

Restart apache2 service:

/etc/init.d/apache2 restart

You can access Mysql Activity Report with following url:

http://localhost/mysqlard/mysqlar.php

3 comments:

Anonymous said...

cron is running , graphs are showing... but empty

help somebody???

svecpetr said...

please help, I installed it on ubuntu 9.10 and now everything goes ok... but only one thinks didnot work

graphs are empty (updated every 5 minutes, but with no data)

I found, that mysqlar.server initrrd
and mysqlar.server start
goes ok

but still is mysqlar.server status
is server is not running ...

linuxlover said...

Hi Guys,

I have faced the same problem(empty graphs) while implementing the mysqlard in my production env..but after whole day fight i found the solution given below
1. go to the directory where mysqlard.server file is placed and run below given 2 commands

#./mysqlard.server initrrd
#./mysqlard.server start

Thanks!
Sumit