<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://cooker.wbitt.com/skins/common/feed.css?207"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cooker.wbitt.com/index.php?action=history&amp;feed=atom&amp;title=LoadMonitoringScript</id>
		<title>LoadMonitoringScript - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://cooker.wbitt.com/index.php?action=history&amp;feed=atom&amp;title=LoadMonitoringScript"/>
		<link rel="alternate" type="text/html" href="http://cooker.wbitt.com/index.php?title=LoadMonitoringScript&amp;action=history"/>
		<updated>2026-06-20T05:39:48Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.15.1</generator>

	<entry>
		<id>http://cooker.wbitt.com/index.php?title=LoadMonitoringScript&amp;diff=670&amp;oldid=prev</id>
		<title>Kamran:&amp;#32;/* Load monitoring script */</title>
		<link rel="alternate" type="text/html" href="http://cooker.wbitt.com/index.php?title=LoadMonitoringScript&amp;diff=670&amp;oldid=prev"/>
				<updated>2010-10-16T06:56:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Load monitoring script&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 06:56, 16 October 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;HOSTNAME=$(hostname)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;HOSTNAME=$(hostname)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAXLOAD=1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAXLOAD=1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAILINGLIST=&amp;quot;kamran@&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wbitt&lt;/del&gt;.com &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kamranazeem&lt;/del&gt;@&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gmail&lt;/del&gt;.com&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;MAILINGLIST=&amp;quot;kamran@&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;example&lt;/ins&gt;.com &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;administrator&lt;/ins&gt;@&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;example&lt;/ins&gt;.com&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# ACTUALLOAD=$(uptime | awk '{print $11}' | cut -f 1)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# ACTUALLOAD=$(uptime | awk '{print $11}' | cut -f 1)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-11.html&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-11.html&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-06-20 05:39:48 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kamran</name></author>	</entry>

	<entry>
		<id>http://cooker.wbitt.com/index.php?title=LoadMonitoringScript&amp;diff=59&amp;oldid=prev</id>
		<title>Kamran:&amp;#32;Load average monitoring script</title>
		<link rel="alternate" type="text/html" href="http://cooker.wbitt.com/index.php?title=LoadMonitoringScript&amp;diff=59&amp;oldid=prev"/>
				<updated>2010-02-21T10:14:51Z</updated>
		
		<summary type="html">&lt;p&gt;Load average monitoring script&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Load monitoring script =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[root@www ~]# cat /root/checkload.sh &lt;br /&gt;
#!/bin/bash                          &lt;br /&gt;
# Author: Muhammad Kamran Azeem      &lt;br /&gt;
# Created: Long ago                  &lt;br /&gt;
# Last revised: 2010-01-24           &lt;br /&gt;
&lt;br /&gt;
HOSTNAME=$(hostname)&lt;br /&gt;
MAXLOAD=1&lt;br /&gt;
MAILINGLIST=&amp;quot;kamran@wbitt.com kamranazeem@gmail.com&amp;quot;&lt;br /&gt;
# ACTUALLOAD=$(uptime | awk '{print $11}' | cut -f 1)&lt;br /&gt;
# http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-11.html&lt;br /&gt;
# Or :-&lt;br /&gt;
# uptime |  grep -o 'load.*' | awk '{print $3}' | awk -F, '{print $1}'&lt;br /&gt;
# Or :-&lt;br /&gt;
# uptime |  grep -o 'load.*' | awk '{print $3}' | cut -d, -f1&lt;br /&gt;
&lt;br /&gt;
ACTUALLOAD=$(uptime | sed -e &amp;quot;s/.*load average: \(.*\...\), .*\..., .*\.../\1/&amp;quot; -e &amp;quot;s/ //g&amp;quot;)&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
  ACTUALLOAD=$1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
INTEGERLOAD=$(echo ${ACTUALLOAD} | cut -d. -f 1)&lt;br /&gt;
&lt;br /&gt;
if [ ${INTEGERLOAD} -lt ${MAXLOAD} ]; then&lt;br /&gt;
  uptime&lt;br /&gt;
  echo &amp;quot;5 minute load average is: ${ACTUALLOAD}, which is normal. (Below defined max value: ${MAXLOAD}.)&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;5 minute load avaerage is high: ${ACTUALLOAD}. Generating report of top 30 processes. (CPU and MEM.)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
## ps -eo &amp;quot;%C %p %u %U %c %x&amp;quot; |sort -r | head -n 10 &amp;gt; /tmp/load_report&lt;br /&gt;
&lt;br /&gt;
ps -eo pcpu,pmem,pid,ruser,user,comm,stat,time --sort -pcpu,-pmem |  head -n 30 &amp;gt; /tmp/load_report.txt&lt;br /&gt;
SUBJECT=&amp;quot;High load: ${ACTUALLOAD} , on ${HOSTNAME}&amp;quot;&lt;br /&gt;
cat /tmp/load_report.txt&lt;br /&gt;
cat /tmp/load_report.txt | /bin/mail -s &amp;quot;${SUBJECT}&amp;quot; ${MAILINGLIST}&lt;br /&gt;
exit 0&lt;br /&gt;
&lt;br /&gt;
[root@www ~]#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kamran</name></author>	</entry>

	</feed>