YaBB SE Community

English User Help => English Help => Topic started by: halebopp on February 13, 2003, 07:08:59 AM

Title: [HowTo] Monitoring YaBB performance
Post by: halebopp on February 13, 2003, 07:08:59 AM
Ever wondered how you YaBB performs, i.e. how fast the pages are created of the day?
Here's an idea I came across some time ago. You can easily monitor you YaBB using MRTG. It can generate nice graphs that show you the load time of your YaBB over days/weeks/month/years.
Examples
Monitoring a YaBB boardindex load time (note that for example "20k" on the y-axis means "20 seconds" needed to generate boardindex) :
(http://bg.eroes.de/temp/yabb-day.png)
This is a very bad performing YaBB on a crappy shared hosting...

(http://bg.eroes.de/temp/yabb2-day.png)
This is a very well performing YaBB on a dedicated server (execpt the few spikes, the load time is always around 0.2 seconds, i.e. 200 milliseconds in the graph)

Here's a small tutorial to setup MRTG to generate such graphs.

Requirements
Install and test MRTG
Get MRTG from http://people.ee.ethz.ch/~oetiker/webtools/mrtg/ (http://people.ee.ethz.ch/~oetiker/webtools/mrtg/) and install it. Instructions for Unix/Windows are available on their website.
Test you installation to be sure MRTG is working properly and add a cron entry to execute MRTG every 5 minutes.

Configure YaBB
Go to your Admin Center -> Installed 'Mods' Settings and Options -> Activate "Display time taken to create every page" -> Save settings
Now check that "Page created in ?? seconds" appears at the bottom of every YaBB page.

Create the monitor script
On the shell, go to the directory where you installed MRTG (for example "cd /usr/local/mrtg-2") and create a new file called "yabb.pl" with the following content:
Code: [Select]
#!/usr/bin/perl

@res = `lynx -cache=0 -source -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;


foreach $res (@res) {
    if ($res =~ /created in (.*) seconds/) { $time = $1; last } else { next }
}

$time=int($time*1000);
print "$time\n";
print "$time";
Be sure to use the correct quotes in the @res = ... line (not ", nor ', but `)!

Replace
Code: [Select]
http://www.yourdomain.com/yabbse/index.php
in this code with the URL to your main page. You can also monitor a different page, of course.
Now make sure that yabb.pl can be executed by typing
Code: [Select]
chmod 755 yabb.pl
on the shell.
Test the script with
Code: [Select]
perl yabb.pl
It shoud output something like this:
Code: [Select]
211
211root: /url/local/mrtg-2#
(The time taken to generate the page in milliseconds, two times)


Configure MRTG
Edit your MRTG config file mrtg.conf (can be found whereever you created it using the cfgmaker while installing MRTG).
Add the following section to your mrtg.conf:
Code: [Select]
Target[yabb]: `/path/to/yabb.pl`
Options[yabb]: growright, gauge, noo, nobanner, nopercent, noinfo
MaxBytes[yabb]: 120000
Title[yabb]: My YaBB performance
YLegend[yabb]: msecs
ShortLegend[yabb]: msecs
Again, be sure to use the correct quotes (not ", nor ', but `)!
You can change the MaxBytes to a higher value if you board takes a lot of time to load. All values higher that MaxBytes will be clipped. Note that that value is in milliseconds (seconds*1000)!

Test your setup
Execute mrtg manually at least 3 times:
Code: [Select]
mrtg /path/to/mrtg.conf
The first two to three times MRTG will complain about missing log files, you can ignore that. No other errors should occure.
Now wait some time and let MRTG gather some data. A HTML file called "yabb.html" will be created in your MRTG workdir.

If that all went fine, you can include the daily/weekly graph in your Admin Center if you like.

Please note:

Possible problems:
Code: [Select]
@res = `lynx -cache=0 -source -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;
in your yabb.pl to
Code: [Select]
@res = `w3m -dump http://www.yourdomain.com/yabbse/index.php| tail -n 3`;

That's all ;) If you have any problems, ask   8)

Chris


Addendum
You can "stress test" you YaBB using ab (http://httpd.apache.org/docs/programs/ab.html) or any other webserver stress tool. If you do that, set the time to stress test you YaBB to a higher value that your MRTG update interval so that MRTG is executes while your YaBB is stress tested.
Title: Re:[HowTo] Monitoring YaBB performance
Post by: Jeff Lewis on February 13, 2003, 09:39:17 AM
Very nice how to! :)
Title: Re:[HowTo] Monitoring YaBB performance
Post by: kurat on December 08, 2003, 09:41:10 AM

mrtg gives that kind errors in a console

ERROR: Target[yabb][_IN_] ''/etc/mrtg/yabb.pl'' evaluated to '/etc/mrtg/yabb.pl' instead of a number
ERROR: Target[yabb][_OUT_] ''/etc/mrtg/yabb.pl'' evaluated to '/etc/mrtg/yabb.pl' instead of a number
WARNING: Skipping Update of yabb, inlast is not defined
WARNING: Skipping Update of yabb, outlast is not defined

can anyone help me???