Load not being shown in web ui on freebsd

Forum for questions and support relating to the 1.25.x releases only.
Locked
aleatorvb
Posts: 5
Joined: Fri Aug 03, 2012 2:35 pm

Load not being shown in web ui on freebsd

Post by aleatorvb »

Load not being shown in web ui on freebsd.

On ubuntu the uptime string is ... load average: ...
On freebsd the uptime string is ... load averages: ...

Modified file functions.php and replaced getLoad() with

Code: Select all

function getLoad()
{
    $uptime = shell_exec( 'uptime' );
    $load = '';
    if ( preg_match( '/load average: ([\d.]+)/', $uptime, $matches ) ){
        $load = $matches[1];
    }elseif(preg_match( '/load averages: ([\d.]+)/', $uptime, $matches ) ){
        $load = $matches[1];
    }
    return( $load );
}
aleatorvb
Posts: 5
Joined: Fri Aug 03, 2012 2:35 pm

Re: Load not being shown in web ui on freebsd

Post by aleatorvb »

Shorter (and better) version of getLoad()

Code: Select all

function getLoad()
{
    $uptime = shell_exec( 'uptime' );
    $load = '';
    if ( preg_match( '/load average[s]{0,1}: ([\d.]+)/', $uptime, $matches ) )
        $load = $matches[1];
    return( $load );
}
Locked