vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Microstats - load times, server loads, queries, uncached templates (https://vborg.vbsupport.ru/showthread.php?t=82900)

ShiningArcanine 06-10-2005 10:00 PM

Microstats - load times, server loads, queries, uncached templates
 
This is a derivative of Erwin's microstats hack for vBulletin 3.5.0's plugin system. The main difference is that by default it shows the page generation time and query count to the public. Server loads and Uncached Queries are shown only to administrators.

I had sent this to Erwin so he could release if he wanted to but instead he told me that I had permission to release it; hence why I am releasing it.

This should work with vBulletin 3.5.0 RC 1 through vBulletin 3.6.1 and later.

Installation is very simple. Just import the plugin via vBulletin's "Download / Upload Plugins" page in the Plugin System in the Admin Control Panel and you're done.

I'll try to correct any bugs that you find. Let me know if you like this plugin and don't forget to click the install link if you install this.

Optional config.php Variables


$config['Microstats']['replacementvariable']

Setting this variable will make microstats place its data before any instance of whatever you set this variable to. Be careful with this as you might see microstats in mutiple places. My suggestion is to use a unique comment in the HTML source to prevent any issues.

E.g. $config['Microstats']['replacementvariable'] = '<!-- display microstats here -->';

$config['Microstats']['adminonly']

Setting this variable to anything will make microstats display itself only to administrators.

E.g. $config['Microstats']['adminonly'] = true;

Update History


Product File: Uploaded a product file that replaced the plugin file.
Version 1.2.1: Fixed a bug that broke optional config.php settings
Version 1.2.0: Added OpenBSD, FreeBSD and NetBSD support; added Replacement variable setting in config.php; added Display only to Administrators Setting in config.php; fixed bug affecting Linux/Unix servers that have exec('uptime') support and not /proc/loadavg support
Version 1.1.0: Added names of uncached templates, included a bugfix for people who don't have proc avaliable on their system and made the code look a little nicer as well
Version 1.0.1: Bugfix for Windows users, sanitized the code to make it look nicer
Version 1.0.0: Initial Release

WiBu 06-11-2005 11:43 AM

I don't like the way the public see the stats, even if it is only queries and page load. Oh well, edited it to my liking.

Logikos 06-11-2005 01:28 PM

Good work ShiningArcanine!

FleaBag 06-11-2005 01:41 PM

Nice work!

RMS-Chef 06-11-2005 01:48 PM

Even as admin I am only seeing:
Page generated in 0.06230 seconds with 9 queries

All other versions of MS have worked out of the box on my server. Any ideas?

Svenna 06-11-2005 02:00 PM

nice job ShiningArcanine

mOdEtWo 06-11-2005 03:16 PM

I was waiting for this one. :)

ShiningArcanine 06-11-2005 03:26 PM

Quote:

Originally Posted by RMS-Chef
Even as admin I am only seeing:
Page generated in 0.06230 seconds with 9 queries

All other versions of MS have worked out of the box on my server. Any ideas?

Is that your primary usergroup? Does the administrator usergroup have 6 as its id on your forums? This is probably a stupid question but what version of vBulletin are you running?

Jenta 06-11-2005 05:51 PM

gj, this is one hack i have installed on 3.0.7
now i need about 5 more converted so i can upgrade :)

im really starting to like this plugin idea

RMS-Chef 06-11-2005 06:46 PM

Quote:

Originally Posted by ShiningArcanine
Is that your primary usergroup? Does the administrator usergroup have 6 as its id on your forums? This is probably a stupid question but what version of vBulletin are you running?

It's just a fresh install of v3.5 beta 1. Nothing other than this plugin has been done except for some styles I have ported over. I get the same result on the untouched default style as well as the 3 I have moved over to 3.5.
I as the admin am the only member and yes, Admin is default group 6.

EDIT:
I even took out
Code:

if ($vbulletin->userinfo['usergroupid']==6)
and still get the same result. Wierd. It must have something to do with my server config? I have the vB3x version running fine on 2 other boards www.StaticServer.com (only admins can view) and my main board at www.Chefhost.com where you should see limited stats as unregistered.

eXtremeTim 06-11-2005 10:11 PM

Are you on windows? Windows wont show server loads. Also can we get debug info and gzip level in here for admins?

ShiningArcanine 06-12-2005 02:04 AM

Quote:

Originally Posted by eXtremeTim
Are you on windows? Windows wont show server loads. Also can we get debug info and gzip level in here for admins?

Debug Information? What debug information are you proposing?

As for gzip, I'm not sure if it can be accurately detected as it can be enabled via .htaccess.

RMS-Chef 06-12-2005 04:04 AM

Quote:

Originally Posted by RMS-Chef
Are you on windows? Windows wont show server loads.

No, it's a Linux machine.
Like I said, I have the vB3.x.x version running fine on my public board.

eXtremeTim 06-12-2005 04:23 AM

You need to redo this part right here.

PHP Code:

if ($vbulletin->userinfo['usergroupid']==6) {
    
$loadavg = @file_get_contents("/proc/loadavg");
    if (
$loadavg) {
        
$regs explode(" ",$loadavg);
        
$serverload=' [Server Loads: <b>'.$regs[0].'</b> '.$regs[1].' : '.$regs[2].']';
        
$debughtml .= iif($_TEMPLATEQUERIES" (<b>" sizeof($_TEMPLATEQUERIES) . "</b> queries for uncached templates)"'') . "$serverload";
    }


Like me im on windows so I dont have proc meaning that I dont get to see any of the admin stats becuase of the way you have it laid out.

mholtum 06-12-2005 04:34 AM

Works like a charm! Thanks

neocorteqz 06-12-2005 11:16 AM

Quote:

Originally Posted by ShiningArcanine
Debug Information? What debug information are you proposing?

As for gzip, I'm not sure if it can be accurately detected as it can be enabled via .htaccess.

he's talking like Teck's hack.

Dan 06-12-2005 11:18 AM

Yea it's a nice plugin but it just makes me feel like it's lacking a bit of info.

/me clicks install

ShiningArcanine 06-12-2005 01:04 PM

Quote:

Originally Posted by eXtremeTim
You need to redo this part right here.

PHP Code:

if ($vbulletin->userinfo['usergroupid']==6) {
    
$loadavg = @file_get_contents("/proc/loadavg");
    if (
$loadavg) {
        
$regs explode(" ",$loadavg);
        
$serverload=' [Server Loads: <b>'.$regs[0].'</b> '.$regs[1].' : '.$regs[2].']';
        
$debughtml .= iif($_TEMPLATEQUERIES" (<b>" sizeof($_TEMPLATEQUERIES) . "</b> queries for uncached templates)"'') . "$serverload";
    }


Like me im on windows so I dont have proc meaning that I dont get to see any of the admin stats becuase of the way you have it laid out.

I've released version 1.0.1 so Windows users will get to see the queries for uncached templates.

Quote:

Originally Posted by neocorteqz
he's talking like Teck's hack.

That would require file edits and I like having this as a plugin.

neocorteqz 06-12-2005 01:48 PM

Quote:

Originally Posted by ShiningArcanine
That would require file edits and I like having this as a plugin.

It works great, and it's a quick 2 second upload. :)

For the lot of us that want something more advanced, i'm sure it'll be around, but this works fine for the ones not looking for the extra functionality.

Again, Nice work, thanks for the release. :)

Dan 06-12-2005 11:03 PM

Is it possible to move where the stats show up?

ShiningArcanine 06-13-2005 11:54 PM

Quote:

Originally Posted by Dan
Is it possible to move where the stats show up?

Yes, just modify the plugin to place its code next to something other than </body>. I might make it possible to write this into config.php in a future version so it isn't necessary to have custom versions of the plugin.

jancarlo 06-14-2005 12:35 PM

Warning: xml_get_error_code(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 235

Warning: xml_get_current_line_number(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 225

:surprised: :surprised: :surprised:

ShiningArcanine 06-16-2005 09:45 PM

Quote:

Originally Posted by jancarlo
Warning: xml_get_error_code(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 235

Warning: xml_get_current_line_number(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 225

:surprised: :surprised: :surprised:

What version of vBulletin are you running, can you tell me how to reproduce that and are you sure that it was caused by the microstats plugin?

Tomek 06-16-2005 10:31 PM

It doesn't display the load average, when you have activated and not correct the PHP settings open_basedir and/or safe_mode. Please take a look at the PHP manuals.

The old microstats hack for vBulletin 3.0 has used the command uptime to read the load average, but the new microstats plugin for vBulletin 3.5 uses cat /proc/loadavg like vBulletin itself does.

dreck 06-18-2005 07:07 AM

Quote:

Originally Posted by jancarlo
Warning: xml_get_error_code(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 235

Warning: xml_get_current_line_number(): 31 is not a valid XML Parser resource in /includes/class_xml.php on line 225

:surprised: :surprised: :surprised:

I got the same error when I copy & paste.
Try just saving the file from IE.

Nice plugin!

ShiningArcanine 06-18-2005 12:25 PM

Quote:

Originally Posted by WiBu
I don't like the way the public see the stats, even if it is only queries and page load. Oh well, edited it to my liking.

I've released version 1.1.0. This should display uncached template names, load averages on Linux systems when /proc is not available and makes the code look a little nicer.

Tomek 06-18-2005 12:41 PM

Nice. :)

But I would do a little cosmetic change.

Find:
PHP Code:

$serverload ' [Server Loads: <b>' $regs[0] .'</b> ' $regs[1] . ' : ' $regs[2] . ']'

Replace with:
PHP Code:

$serverload ' [Server Loads: <b>' $regs[0] .'</b> : ' $regs[1] . ' : ' $regs[2] . ']'

You have to change this two times.

sHORTYWZ 06-18-2005 01:04 PM

Getting this now on one of my boards..

Page generated in 0.14820 seconds with 9 queries [Server Loads: average: 0.04, 0.20, 0.25 0.04 : 0.20]

However, the other board is showing it just fine.

Snake 06-19-2005 01:18 PM

Screenshot! Screenshot! Where is it?! :D lol

dreck 06-20-2005 05:16 AM

screen shot! :banana:

Snake 06-20-2005 10:11 AM

Oh great. Thanks for that. :D

Chris M 06-20-2005 10:49 AM

Jesus that is a high server load :eek:

Take a look at mine :)

Satan

Snake 06-20-2005 05:15 PM

That is nice!!!

ShiningArcanine 06-20-2005 08:30 PM

Quote:

Originally Posted by sHORTYWZ
Getting this now on one of my boards..

Page generated in 0.14820 seconds with 9 queries [Server Loads: average: 0.04, 0.20, 0.25 0.04 : 0.20]

However, the other board is showing it just fine.

It probably has something to do with your server. I'm not sure what I can do about it. Tell me, did the earlier versions work for you or were you one of the people affected by the no server loads issue?

sHORTYWZ 06-21-2005 12:45 AM

Earlier version worked for me.

Get this though, I have two forums - both on the same box. One of them displays the double, one of them is perfectly fine. Both running same everything.

ShiningArcanine 06-22-2005 02:43 AM

Quote:

Originally Posted by sHORTYWZ
Earlier version worked for me.

Get this though, I have two forums - both on the same box. One of them displays the double, one of them is perfectly fine. Both running same everything.

That is peculiar. I'll think it over a bit more and examine the code in the morning but I'm not sure what is causing the problem.

By the way, are there any configuration differences between the two forums PHP wise or is everything the same?

sHORTYWZ 06-22-2005 12:08 PM

100% the same.

ShiningArcanine 06-22-2005 11:27 PM

Have you tried deleting the plugin and then reuploading it via the xml file?

Edit: Also, could you give me some specifics on your server's configuration? To be specific, I'd like to know your Operating System, PHP Version and MySQL Version.

sHORTYWZ 06-22-2005 11:30 PM

Yup.

ShiningArcanine 06-22-2005 11:34 PM

Quote:

Originally Posted by sHORTYWZ
Yup.

Wow, that was a quick response. You responded before I edited my post. ^_^;;

Would you be able to give me me those specifics? They might be helpful in figuring out why you're seeing what you're seeing.


All times are GMT. The time now is 04:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01600 seconds
  • Memory Usage 1,845KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete