Welcome, Guest. Please Login or Register.
September 27, 2023, 02:44:06 AM
Home Help Search Login Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  English Help  |  Topic: [HowTo] Monitoring YaBB performance « previous next »
Pages: [1] Reply Ignore Print
Author Topic: [HowTo] Monitoring YaBB performance  (Read 45798 times)
Posts: 21

It's better to burn out that to fade away

[HowTo] Monitoring YaBB performance
« on: February 13, 2003, 07:08:59 AM »
Reply with quote

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.
Monitoring a YaBB boardindex load time (note that for example "20k" on the y-axis means "20 seconds" needed to generate boardindex) :

This is a very bad performing YaBB on a crappy shared hosting...

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.

  • Shell access on a server (not necessarily the server you're running your board on)
  • YaBB 1.5+
Install and test MRTG
Get MRTG from 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]

@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 }

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

Code: [Select]
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]
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:
  • The scaling of thy y-axis in the MRTG graph will convert any number higher that 1000 to 1k (1 kilo, with 1k= 1000). As we are measurng the time in milliseconds this means that a value of 10k is equal to 10 seconds.
  • As MRTG is executed only every 5 minutes (default) the graph will NOT show you what's happening in between this 5 minute update interval! It should be enough to get an overview how you YaBB performs, though.
  • You can monitor other pages that the BoardIndex, of course, but do not monitor a thread as the view count of the thread will be incremented by MRTG! I'd recommend monitoring either the BoardIndex or the Recent Posts page.

Possible problems:
  • If you dont have lynx installed on your system, you can also use w3m. Change
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`;
  • The script requires that the "Page created in" string is found within the last 3 lines of your HTML page. If that's different in your case, you can either increase the lines parsed by increasing the number after the "-n" in the above quoted yabb.pl line or remove the "| tail -n 3" from that line (actually it's only a small performance tuning).
  • Your running Windows... -> Install Linux  ;D

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


You can "stress test" you YaBB using ab 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.
« Last Edit: February 13, 2003, 07:16:42 AM by halebopp » Logged
Jeff Lewis
Global Moderator
YaBB God
Posts: 10149

I'm a llama!

Re:[HowTo] Monitoring YaBB performance
« Reply #1 on: February 13, 2003, 09:39:17 AM »
Reply with quote

Very nice how to! :)

Posts: 2

I'm a llama!

Re:[HowTo] Monitoring YaBB performance
« Reply #2 on: December 08, 2003, 09:41:10 AM »
Reply with quote

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???
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Topic: [HowTo] Monitoring YaBB performance « previous next »

Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.0.19 | SMF © 2021, Simple Machines
Valid XHTML 1.0! Valid CSS!
Page created in 0.074 seconds with 28 queries.