• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Server load script not working since plesk 8 upgrade

J

jubbs

Guest
Hi guys,
We have a server load script written in php that was/is working on our Plesk 7.5 servers. We upgraded one server to Plesk 8 and that same script now doesnt work.

Is there an alternative load script, or modification we can make to get it working?

Here is the code:

PHP:
<?php

// Get The Server Load
function get_ServerLoad()
	{
	    if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
	        if(file_exists('/proc/loadavg') ) {
	            if ($fh = @fopen( '/proc/loadavg', 'r' )) {
	                $data = @fread( $fh, 6 );
	                @fclose( $fh );
	                $load_avg = explode( " ", $data );
	                $server_load = trim($load_avg[0]);
	            }
	        } else {
	            $data = @system('uptime');
	            preg_match('/(.*):{1}(.*)/', $data, $matches);
	            $load_arr = explode(',', $matches[2]);
	            $server_load = trim($load_arr[0]);
	        }
	    }
	    if(!$server_load) {
	        $server_load = 'N/A';
	    }
	    return $server_load;
	} 

echo get_ServerLoad();

?>
 
Plesk8 has enabled php safemode for all domains. With safe mode on you can't access /proc/ . Disable safe mode or add /proc to the openbasedirpath.
 
Back
Top