vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [Linux] loadsock (retrieve server load from remote server) (https://vborg.vbsupport.ru/showthread.php?t=36108)

fastforward 03-13-2002 10:00 PM

[Linux] loadsock (retrieve server load from remote server)
 
This little daemon will listen on a given IP/port and simply dump the load average and mysql processes to any TCP connection that connects to the listening port. The MySQL process list is also sent if a mysql username and password is specified using the --mysql-user and --mysql-pwd options.

Output is sent as 'as is' with no formatting. The first line is the load average as shown by /proc/loadavg. Everything following, is the is the output of 'mysqladmin processlist'. You will need to parse the output yourself using PHP or whatever client language you happen to use.

To limit output to a specific IP, you should add additional rules to your firewall configuration. By default, this daemon listens on all IP addresses and port 6666.
Code:

Usage: loadsock [OPTION]...
Example: loadsock --ip db.host.com --port 1287 --mysql-user paul --mysql-pwd topsecretword
loadsock with no parameters will listen on all IP addresses on port 6666

--ip              IP Address on which to listen
                  (defaults to all available addresses)
                  Can be numerical IP or hostname
--port            Port on which to listen (defaults to 6666)
--mysql-user      MySQL username if you want to include the mysql process
                  list in the output.
--mysql-pwd        MySQL password if necessary.

Below is some example client PHP code that connects and echoes the output:
PHP Code:

 <?php
   $remote_ip 
"your.db_server.com";
   
$remote_port "6666"// or whatever port you daemon is on
   
$fp fsockopen($remote_ip$remote_port$errno$errstr30);
   if (
$fp) {
     while (!
feof($fp)) {
       echo 
$line// change this to process the output and do what you need
       
echo $line;
     }
     
fclose($fp);
   }           
 
?>


Bane 03-14-2002 01:40 AM

I'm gonna try this, thanks :)

nuno 03-14-2002 06:51 AM

may Overgrow jump here now and add his HTML :D
thx Paul :)
i'll give it a go again, still not working :(

nuno 03-14-2002 08:38 PM

all done
up and running
awesome hack :cool:
many thx Paul ;)

Psychdrone 03-18-2002 12:12 AM

What dose this do again??

nuno 03-18-2002 09:55 AM

this is intended for dual cpu's
it measures db load and web load and shuts off search function if one of the loads goes too high.
read this thread
http://www.vbulletin.com/forum/showt...threadid=41401


All times are GMT. The time now is 01:32 AM.

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.01399 seconds
  • Memory Usage 1,723KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete