View Single Post
  #5  
Old 05-07-2012, 07:47 PM
nullx8 nullx8 is offline
Member
 
Join Date: Nov 2011
Location: Bangkok, Thailand
Posts: 11
Quote:
Originally Posted by webizen View Post
rtreport* get generated by each CPU/core. you have 2-CPU license, so you see .rtreport and .rtreport.2. you should total the numbers from each rtreport for your report.
ah great.. thanks that makes more sense .

here what i have done to put some "use" in this numbers

Code:
PHP
if (is_file("/tmp/lshttpd/.rtreport")) {
	$lsload = file('/tmp/lshttpd/.rtreport');
	$lsload = explode(",",$lsload[4]);
	$Site['health']['http_queue'] = intval(preg_replace("/[^\d]/", "", $lsload[0]));
	$Site['health']['http_requests'] = intval(preg_replace("/[^\d]/", "", $lsload[1]));
	if (is_file("/tmp/lshttpd/.rtreport.2")) { // core 2
		$lsload = file('/tmp/lshttpd/.rtreport');
		$lsload = explode(",",$lsload[4]);
		$Site['health']['http_queue'] = ($Site['health']['http_queue'] + intval(preg_replace("/[^\d]/", "", $lsload[0])));
		$Site['health']['http_requests'] = ($Site['health']['http_queue'] + intval(preg_replace("/[^\d]/", "", $lsload[1])));
	}
}

// redirect to TMP page on other machine if load is too high
if (($Site['health']['http_queue'] > 400 )) {
	header ("Location: ".$Site['paths']['staticserver2']."/pages/v3p/?for=".$_SERVER['REQUEST_URI']);	
}
Reply With Quote