Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Microstats - load times, server loads, queries, uncached templates Details »
Microstats - load times, server loads, queries, uncached templates
Mod Version: 1.2.1, by ShiningArcanine (Member) ShiningArcanine is offline
Developer Last Online: Oct 2008 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.5.4 Rating: (28 votes - 4.68 average) Installs: 680
Released: 11 Jun 2005 Last Update: 09 Jun 2006 Downloads: 1450
Not Supported Uses Plugins  

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

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Microstats (only for admin) - load times, server loads, queries, uncached templates! Erwin vBulletin 3.0 Full Releases 270 02 Mar 2009 11:16

  #361  
Old 06 Apr 2009, 06:10
Xencored Xencored is offline
 
Join Date: Sep 2008
Real name: Mike
i get

Uncached templates: awards_postbit_display (1)
Uncached templates: im_msn (1)
Uncached templates: postbit_legacy (1)
Uncached templates: postbit_onlinestatus (1)
Uncached templates: postbit_reputation (3)
Uncached templates: postbit_wrapper (1)

is this bad?
Reply With Quote
  #362  
Old 06 Apr 2009, 08:15
Icy Icy is offline
 
Join Date: Nov 2007
Real name: Icy
Yes it is! You're having 8 extra queries just for these uncached queries!
Reply With Quote
  #363  
Old 06 Apr 2009, 19:17
Xencored Xencored is offline
 
Join Date: Sep 2008
Real name: Mike
Originally Posted by Icy View Post
Yes it is! You're having 8 extra queries just for these uncached queries!
How can i fix this than mate

Cheers
Reply With Quote
  #364  
Old 06 Apr 2009, 19:30
Icy Icy is offline
 
Join Date: Nov 2007
Real name: Icy
I guess one of your modification cause this though I'm not sure which one. Try disabling one by one and test
Reply With Quote
  #365  
Old 06 Apr 2009, 19:33
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Or read the article in the article section about how to cache your templates.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #366  
Old 06 Apr 2009, 19:54
Icy Icy is offline
 
Join Date: Nov 2007
Real name: Icy
But Lynne these are the default templates which should be cached by default unless he changed something from the core vBulletin code right?
Reply With Quote
  #367  
Old 06 Apr 2009, 20:17
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by Icy View Post
But Lynne these are the default templates which should be cached by default unless he changed something from the core vBulletin code right?
You are right. I just looked at the first one (awards_) and knew that was not default. So yes, you are right in guessing some modification is causing the problem.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #368  
Old 09 Apr 2009, 02:40
jw00dy's Avatar
jw00dy jw00dy is offline
 
Join Date: Dec 2004
I use this free caching mod from Ziki: http://www.vbulletin.org/forum/showthread.php?p=1784393 Works great on 3.8 and 3.7
__________________
Just another squirrel trying to get a nut
Reply With Quote
  #369  
Old 30 May 2009, 18:14
ubcforums's Avatar
ubcforums ubcforums is offline
 
Join Date: Apr 2009
working on 3.82 as well !!
Reply With Quote
  #370  
Old 22 Aug 2009, 12:49
David_R David_R is offline
 
Join Date: Mar 2005
Real name: David RutherFord
Originally Posted by zefyx View Post
Go to Plugin & Products System -> Product Manager -> Microstats.

Remove the current code, replace with..

$pageendtime = microtime();
$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);
$totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
$debughtml = '<center><span class="smallfont">Page generated in <b>' . $totaltime . '</b> seconds with <b>' . $vbulletin->db->querycount . '</b> queries';
$usergroupid = $vbulletin->userinfo['usergroupid'];

if ($usergroupid == 5 || $usergroupid == 6 || $usergroupid == 7) {

if ($loadavg = @file_get_contents("/proc/loadavg")) {

$regs = explode(" ",$loadavg);
$serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']';

}elseif ($stats=@exec('uptime')) {

preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload = ' [Server Loads: <b>' . $regs[1] .'</b> ' . $regs[2] . ' : ' . $regs[3] . ']';

}elseif ($loadavg = @`sysctl vm.loadavg|cut -d" " -f3-5`) {

$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";

ksort($tempusagecache);

foreach ($tempusagecache AS $tempname => $times) {
if ($_TEMPLATEQUERIES["$tempname"]){
$debughtml .= '<center><span class="smallfont">Uncached templates: <font color="red"><b>' . $tempname . '</b></font> (' . $times . ')</span></center>';
}
}

}

$debughtml .= "</span></center>";

if (!$vbulletin->config['Microstats']['replacementvariable']) {

$vbulletin->config['Microstats']['replacementvariable'] = '</body>';

}

if (($vbulletin->config['Microstats']['adminonly'] and $vbulletin->userinfo['usergroupid'] == 5 || $usergroupid == 6 || $usergroupid == 7) or !$vbulletin->config['Microstats']['adminonly']){

$output = str_replace($vbulletin->config['Microstats']['replacementvariable'], $debughtml . $vbulletin->config['Microstats']['replacementvariable'], $output);

}


Where you see the usergroupid = 5, 6 & 7, replace those numbers with whatever your usergroup id's are that you want to see the microstats.

Hope this helps
I try to use this code, it works proper for super-admin, admin and moderator groups.
but super-admin and moderators cannot see server loads.
i have also placed this line in my config.php
if (($vbulletin->config['Microstats']['adminonly'] = true ;

this my code in plugin manager for microstats

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #371  
Old 26 Sep 2009, 10:53
EidolonAH EidolonAH is offline
 
Join Date: May 2009
Real name: Eidolon
Thumbs up

Originally Posted by Moparx View Post
make sure you have the following in config.php:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

then add <!-- display microstats here --> at the very bottom of the footer template
Life saver, the instructions just weren't making any sense to me, thanks for making it clearer.
Reply With Quote
  #372  
Old 29 Oct 2009, 20:27
Scalemotorcars's Avatar
Scalemotorcars Scalemotorcars is offline
 
Join Date: Mar 2006
Real name: Daniel
Works perfectly on 3.8.4 with VBSEO and VBA

Thanks
__________________
ScaleMotorcars.com Large scale model building at its best. Check it out.
Reply With Quote
  #373  
Old 02 Nov 2009, 06:21
Keesa Keesa is offline
 
Join Date: Oct 2007
How do I understand and interpret the results?

Page generated in 0.12721 seconds with 24 queries [Server Loads: 0.57 0.50 : 0.47]
Reply With Quote
  #374  
Old 07 Nov 2009, 12:08
David_R David_R is offline
 
Join Date: Mar 2005
Real name: David RutherFord
I still have problems this is the code for microstats:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And this are the lines in my config.php

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now the problem is noone is able to view microstats.
I only want that microstats should display for Administrator and Super-Moderator group, it should not be visible to any other group

Adminstrator usergroup = 6
super-mod group = 5

Please help.
Reply With Quote
  #375  
Old 03 Dec 2009, 18:29
Speysider's Avatar
Speysider Speysider is offline
 
Join Date: Apr 2009
Is it possible to move the microstats wording to another location?
Great mod.
__________________
vBulletin is down the drain. IB ruined it by attacking XenForo.
I am a MyBB and XF modder only.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 20:19.

Layout Options | Width: Wide Color: