~ overflow ~

Server overload warning

by z3n on Dec.27, 2011, under Linux Happyness, Tips & Hints

Problem:

So i have this shitty server that keeps overloading, although i have all sort of monitors around, many screens, etc I really can’t keep looking at the graphs all day long, but yet i’m almost of the time on the computer.

So why not have a sound trigger when server load go over 10?

Solution:

This php script solves it:

// (c) z3n - R1V1@111227 - www.overflow.biz - rodrigo.orph@gmail.com

while (true) {
	$output = explode(" ", trim(substr(strstr(exec("uptime"), "load average:"), 13)));
        if (substr($output[0], 0, -1) > 10)
		@ passthru("echo -e -n \\\\a");

	echo "\r[" . date("Y-m-d H:i:s") . "] " . implode(" ", $output);
	sleep(5);
}
:, , , ,


1 comment for this entry:
  1. Dominick Cavender

    Great post, I conceive website owners should acquire a lot from this website its very user pleasant. So much wonderful information on here :D.

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!