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)
-   -   My Server Info in AdminCP (https://vborg.vbsupport.ru/showthread.php?t=92416)

Dream 07-17-2005 10:00 PM

My Server Info in AdminCP
 
This is a script that I used outside the admincp, that shows some server info.

- Shows server time with exec(date)
- Shows server load with file_get_contents("/proc/loadavg") (same as microstats plugin)
- Shows memory usage with exec(free)
- Shows free disk space with exec(df)
- phpinfo() link
- Shows MySQL Stats with mysql_stat()
- Shows MySQL Status with "SHOW STATUS" query
- Shows MySQL Vars with "SHOW VARIABLES" query

Its superadmin only.

Installation
- Upload "server_info.php" to your admincp
- Upload "cpnav_serverinfo.xml" to your includes/xml
- Reload your AdminCP, its under "Server Info"

jesus likes pie 07-18-2005 01:51 PM

ooooh

jesus likes pie 07-18-2005 03:26 PM

O.K works fine. One question..


Quote:

Server Load file_get_contents("/proc/loadavg")

failed
whats that mean? Is something wrong with my server?

MrNase 07-18-2005 08:58 PM

Are you running Linux?

Are you sure the 'loadavg' in the folder 'proc' exists?

Chris M 07-18-2005 11:22 PM

If you don't have proc, replace in server_info.php:
PHP Code:

    $loadavg = @file_get_contents("/proc/loadavg");
    if (
$loadavg) {
        
$regs explode(" ",$loadavg);
        
$serverload='Server Loads: <b>' $regs[0] .'</b> ' $regs[1] . ' : ' $regs[2];
    } else {
        
$serverload 'failed';
    } 

with:
PHP Code:

    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[0] .'</b> ' $regs[1] . ' : ' $regs[2];
 
    } 

That should work :)

Edit: Yes that does work :)

Satan

Dream 07-19-2005 12:11 AM

thanks satan can I use that in an update?

and does anyone know the best way to get "server memory usage" and "disk space used/free"?

Chris M 07-19-2005 12:47 AM

Quote:

Originally Posted by Dream
thanks satan can I use that in an update?

and does anyone know the best way to get "server memory usage" and "disk space used/free"?

Sure you can - You may want to play about with it though :)

For server memory usage, try looking at the php function "memory_get_usage" :)

Satan

utw-Mephisto 08-17-2005 06:24 AM

Works smoothly :)

Chrissicom 10-18-2005 07:53 AM

Any way to make this work on Windows 2003??

gsm4arab1 10-18-2005 09:52 AM

thanks jesus likes pie


All times are GMT. The time now is 10:00 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.01076 seconds
  • Memory Usage 1,745KB
  • 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
  • (2)bbcode_php_printable
  • (2)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
  • (10)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