LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-17-2012, 08:10 AM   #1
aamerjavaid
Member
 
Registered: Dec 2005
Posts: 53

Rep: Reputation: 15
How to check serverload on a linux box


Hi,

We are currently working on a script which should check the Server load (CPU/Memory), if it hits threshold, please suggest tolls and techniques available on this.

Thanks,
Amir
 
Old 01-17-2012, 09:20 AM   #2
PacMan?
LQ Newbie
 
Registered: Jan 2012
Posts: 18

Rep: Reputation: Disabled
Quote:
Originally Posted by aamerjavaid View Post
Hi,

We are currently working on a script which should check the Server load (CPU/Memory), if it hits threshold, please suggest tolls and techniques available on this.

Thanks,
Amir

assuming you are using linux mate so...

hmmm...use TOP? or "free -m"


i wrote a script a while back...1 sec...lemme see if i can find it?
 
Old 01-17-2012, 09:22 AM   #3
PacMan?
LQ Newbie
 
Registered: Jan 2012
Posts: 18

Rep: Reputation: Disabled
here you go budd:

cat /home/server_check.php
<?php
$myfile = file("/proc/loadavg"); //reads load avevrage(s)

$five = explode(" ", $myfile[0]); //5 minute load avevrage

if (($five[1] > 100) && ($five[0] > 25)) //if the 5 minute load average is above 100, email admin!
{
$to = "admin@domain.com";
$message = "Server #1 Load = $five[1]";
mail($to, "ALERT!", $message, "From: server1@domain.com");
}
?>
 
Old 01-18-2012, 07:10 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Nowadays the Linux kernel also counts processes in state D as running. Hence the load maybe above 100%, but not by plain CPU load.

@aamerjavaid: how do you define threshold and toll in your context, what do you want to achieve? Do you want to free memory then for any additional process, or suspend processes, or kill them to start them later again? Is it a computing server, file server, web server, ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check qmail version on my box? ramesh_india2020 Linux - Newbie 2 10-12-2010 02:35 AM
LXer: Check if Compiz will run well on your Linux Box with Compiz Check LXer Syndicated Linux News 0 05-05-2008 01:20 AM
Obtaining check box value in PHP/HTML woodpecka_04 Programming 3 07-11-2007 01:52 PM
Can I ue my Linux to check for viri on my Windows box? lucktsm General 7 03-13-2006 12:48 PM
How many total TCP sockets can my linux box have? how can I check the number used? abefroman Linux - Networking 2 11-09-2005 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration