logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Webmaster Tools & Utilities View previous topic :: View next topic
Reply to topic   Topic: MySQL query Statistics for Apache MRTG statistics available
Author
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Wed 26 Mar '08 22:25    Post subject: MySQL query Statistics for Apache MRTG statistics available Reply with quote

I made a MySQL Add-on available for the ApacheStats on the download page.

It creates pretty MySQL Query graphs. You can have Queries per second and/or per hour. With per hour you have more accurate graphs when you have not many queries. See the included Install.txt

I also updated the Readme.txt in ApacheStats.zip with the following notes:
    The first time you start, you get warnings about reading
    and updating log files. This warnings you can ignore.

    When there are high peaks in the graph,
    which are disturbing the graph,
    you can lower the value of the option MaxBytes[xxx]:

    When a graph is capped at a certain value or no graph line,
    you can try a higher value of the option MaxBytes[xxx]:
    Note: a number higher than MaxBytes is ignored

    You can remove/add the peak 5 minute values in a graph
    with the option in mrtg.ini WithPeak[xxx]: wmy
    [w]eekly,[m]onthly,[y]early


Enjoy,

Steffen Idea
Back to top
djc



Joined: 04 Dec 2007
Posts: 37

PostPosted: Sat 29 Mar '08 6:59    Post subject: Reply with quote

thanks for another great tool!

I did a quick setup and am getting 'could not connect'. user/pw are correct. Will troubleshoot and return when more info.
Back to top
bentogoa



Joined: 09 Feb 2007
Posts: 66
Location: GOA

PostPosted: Sat 29 Mar '08 7:49    Post subject: Reply with quote

Added it yesterday, works fine for me, thanks Steffen.

Bento Fernandes
http://www.goanwap.com
Webmaster
Back to top
djc



Joined: 04 Dec 2007
Posts: 37

PostPosted: Sun 06 Apr '08 8:08    Post subject: Reply with quote

still having no luck.. Sad
Back to top
djc



Joined: 04 Dec 2007
Posts: 37

PostPosted: Mon 14 Apr '08 10:46    Post subject: Reply with quote

Got it to work...

thanks Steffen for making this available!
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Mon 14 Apr '08 21:26    Post subject: Reply with quote

Where did you have trouble ? Just curious, maybe the readme is not clear.

Steffen
Back to top
fingers



Joined: 21 Apr 2008
Posts: 7

PostPosted: Mon 21 Apr '08 3:41    Post subject: tweaks Reply with quote

just let you know to get it running on my system i edited a file and added a line to httpd.conf
Edit: as well as adding to mod_security2.conf file
Code:

SecRule REMOTE_ADDR "^127\.0\.0\.1" "nolog,noauditlog,allow,phase:2"


Edited line in mysql.php for backward compatability!
from
Code:

$result = mysql_query('SHOW GLOBAL STATUS', $link);

to
Code:

$result = mysql_query('SHOW /*!50002 GLOBAL */STATUS', $link);


Needs also this line Added to install readme
*** You are Required to copy/move this file to the WebRoot of your Server ***

In httpd.conf
after adding
Code:

<Location /server-status>
...
</Location>

to httpd.conf you need to add
Code:
ExtendedStatus On


after these changes all is working well
Very Happy
thanks for the code

EDIT:
also to stop the logfile filling with the auto script access'
added to httpd.conf in the logging area
eg
Code:

SetEnvIf Request_URI "^/server-status" stats
SetEnvIf Request_URI "^/mysql\.php$" stats
CustomLog logs/statsaccess.log combined env=stats
SetEnvIf stats 1 dontlogaccess
CustomLog logs/access.log combined env=!dontlogaccess

END EDIT
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Tue 22 Apr '08 21:46    Post subject: Reply with quote

Thanks very much.

I changed the readme in Apachestats.zip:
Code:
8  Configure mod_status:

   For 2.0.x in /conf/httpd.conf or for 2.2.x in /conf/extra/httpd-info.conf
   
   ExtendedStatus On

   <Location /server-status>
   SetHandler server-status
   Order Deny,Allow
   Deny from all
   Allow from localhost
   </Location>

   For 2.2.x in /conf/httpd.conf uncomment the line:
   #Include conf/extra/httpd-info.conf


Changed in readme in ApacheStats-MySQL-Add-on.zip:
Code:
3. Copy mysql.php to your Apache web space (WebRoot of your Server),
   this php file is called with the host and port as
   specified in Apache.ini, default is http://localhost:80/mysql.php


You said : Edited line in mysql.php for backward compatability!
Can you explain ?

Good tip for supressing the logging for the calls.

Thanks again,

Steffen
Back to top
fingers



Joined: 21 Apr 2008
Posts: 7

PostPosted: Wed 23 Apr '08 2:23    Post subject: Reply with quote

Hi Steffen;
Quote:
You said : Edited line in mysql.php for backward compatability!
Can you explain ?


I am still using mysql4 and the data displayed by
'SHOW GLOBAL STATUS' in v5+
is the same as
'SHOW STATUS' in v4
of MySQL


Editing the query to /*!50002 GLOBAL */ is what is recomended on the MySQL Home site for compatability ie below version 5 (i am not sure abot v3 though?

Quote:
Good tip for supressing the logging for the calls.

No worries, It was something I have been looking at doing (MRTG) for a number of years but have been avoiding the learning curve!

thanks again Dave
Back to top


Reply to topic   Topic: MySQL query Statistics for Apache MRTG statistics available View previous topic :: View next topic
Post new topic   Forum Index -> Webmaster Tools & Utilities