Server info mods?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Ideas Centre
Locked
RebirthSephiroth
Registered User
Posts: 208
Joined: Sun Jul 27, 2003 3:39 am
Location: Saratoga Springs, New York
Contact:

Server info mods?

Post by RebirthSephiroth »

I run a shell/web host for various friends and I was wondering if anyone could recommend some mods that would be useful to have.

Something like mods to show the Linux uptime or any info that http://zeno.biyg.org/phpsysinfo/ has.
-Zeno McDohl aka RebirthSephiroth
http://www.biyg.org/forums/

RebirthSephiroth
Registered User
Posts: 208
Joined: Sun Jul 27, 2003 3:39 am
Location: Saratoga Springs, New York
Contact:

Re: Server info mods?

Post by RebirthSephiroth »

Hm, I did a search in the mod database for like "server" and related stuff, didn't see anything.
-Zeno McDohl aka RebirthSephiroth
http://www.biyg.org/forums/

stephen_a
Registered User
Posts: 103
Joined: Thu Mar 18, 2004 12:52 pm

Re: Server info mods?

Post by stephen_a »

If you are on linux then you can do this quite easily.

Edit functions.php and at the end of the function page_footer defintion add (before the closing } ) :

Code: Select all

$uptime = @exec('uptime');
if ( strstr($uptime, 'day') )
{
	if ( strstr($uptime, 'min') )
	{
		preg_match("/up\s+(\d+)\s+(days,|days|day,|day)\s+(\d{1,2})\s+min/", $uptime, $times);
		$days = $times[1];
		$hours = 0;
		$mins = $times[3];
	}
	else
	{
		preg_match("/up\s+(\d+)\s+(days,|days|day,|day)\s+(\d{1,2}):(\d{1,2}),/", $uptime, $times);
		$days = $times[1];
		$hours = $times[3];
		$mins = $times[4];
	}
}
else
{
	if ( strstr($uptime, 'min') )
	{
		preg_match("/up\s+(\d{1,2})\s+min/", $uptime, $times);
		$days = 0;
		$hours = 0;
		$mins = $times[1];
	}
	else
	{
		preg_match("/up\s+(\d+):(\d+),/", $uptime, $times);
		$days = 0;
		$hours = $times[1];
		$mins = $times[2];
	}
}
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $uptime, $avgs);
$load = $avgs[1].", ".$avgs[2].", ".$avgs[3]."";

$template->assign_vars(array(
	'SERVER_UPTIME' => "Server Uptime : ".$days." day(s) ".$hours." hour(s) and ".$mins." minutes(s) ",
	'SERVER_LOAD' => "Average Server load :".$load)
);
and then in the overall_footer.html file for your theme add below the Powered By line:

Code: Select all

<br /><br /><span class="gensmall">{SERVER_UPTIME} <br>{SERVER_LOAD}</span><br><br>
>

Locked

Return to “[3.0.x] MOD Requests”