<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Monitor cpu abusers with this simple script</title>
	<atom:link href="http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/feed" rel="self" type="application/rss+xml" />
	<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html</link>
	<description>Learn the UNIX/Linux command line</description>
	<lastBuildDate>Mon, 06 Jun 2011 01:35:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Tony</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-36912</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Mon, 08 Feb 2010 21:35:01 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-36912</guid>
		<description>Can&#039;t you just multiply the usage by 100 to sum and divide later or does it not do that well either? IE Does &#039;100 * .9&#039; == 0?</description>
		<content:encoded><![CDATA[<p>Can&#8217;t you just multiply the usage by 100 to sum and divide later or does it not do that well either? IE Does &#8217;100 * .9&#8242; == 0?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yinon</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-21772</link>
		<dc:creator>Yinon</dc:creator>
		<pubDate>Thu, 11 Sep 2008 08:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-21772</guid>
		<description>thanks for the script, it&#039;s great !
however, I found two un-covered cases:
1. defunct process (got &quot;&#124;Ú@: cum = cum +  : syntax error: operand expected&quot; ...)
2. dual core CPUs (got &quot;Process cc1plus is using 120% cpu.&quot; and even &quot;Process cc1plus is using 208% cpu.&quot; I have only dual-core, not quad-core...)</description>
		<content:encoded><![CDATA[<p>thanks for the script, it&#8217;s great !<br />
however, I found two un-covered cases:<br />
1. defunct process (got &#8220;|Ú@: cum = cum +  : syntax error: operand expected&#8221; &#8230;)<br />
2. dual core CPUs (got &#8220;Process cc1plus is using 120% cpu.&#8221; and even &#8220;Process cc1plus is using 208% cpu.&#8221; I have only dual-core, not quad-core&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: papah</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-21578</link>
		<dc:creator>papah</dc:creator>
		<pubDate>Wed, 03 Sep 2008 05:06:44 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-21578</guid>
		<description>I replaced your sum function with float_eval:

float_scale=2
function float_eval()
{
    local stat=0
    local result=0.0
    if [[ $# -gt 0 ]]; then
        result=$(echo &quot;scale=$float_scale; $*&quot; &#124; bc -q 2&gt;/dev/null)
        stat=$?
        if [[ $stat -eq 0  &amp;&amp;  -z &quot;$result&quot; ]]; then stat=1; fi
    fi
    echo $result
    return $stat
}
source: http://www.linuxjournal.com/content/floating-point-math-bash

and changed calls to sum to use float_eval (note the extra operator required):

cumUsage=$( sum $cumUsage $cpu )

to:

cumUsage=$( float_eval $cumUsage + $cpu )</description>
		<content:encoded><![CDATA[<p>I replaced your sum function with float_eval:</p>
<p>float_scale=2<br />
function float_eval()<br />
{<br />
    local stat=0<br />
    local result=0.0<br />
    if [[ $# -gt 0 ]]; then<br />
        result=$(echo &#8220;scale=$float_scale; $*&#8221; | bc -q 2&gt;/dev/null)<br />
        stat=$?<br />
        if [[ $stat -eq 0  &amp;&amp;  -z "$result" ]]; then stat=1; fi<br />
    fi<br />
    echo $result<br />
    return $stat<br />
}<br />
source: <a href="http://www.linuxjournal.com/content/floating-point-math-bash" rel="nofollow">http://www.linuxjournal.com/content/floating-point-math-bash</a></p>
<p>and changed calls to sum to use float_eval (note the extra operator required):</p>
<p>cumUsage=$( sum $cumUsage $cpu )</p>
<p>to:</p>
<p>cumUsage=$( float_eval $cumUsage + $cpu )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: papah</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-21576</link>
		<dc:creator>papah</dc:creator>
		<pubDate>Wed, 03 Sep 2008 04:32:27 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-21576</guid>
		<description>Really useful script, thanks.  Though it doesn&#039;t seem to be accurate because the sum() function only uses the integer part of the CPU usage, not the fractional part, therefore the accuracy of cumulative CPU usage for a group of processes (or users).  and gets worse as the size of the group increases  eg.

sum 0.9 0.9 returns 0
sum 1.9 1.9 returns 2
etc.

ie. consider 125 httpd processes with 0.8 CPU usage.  This is actually 100% CPU usage, but your script would still return 0%...

from my googling I&#039;m seeing that bash doesn&#039;t handle floats very well.  Anyone have a solution?  I&#039;ll post if I work it out...</description>
		<content:encoded><![CDATA[<p>Really useful script, thanks.  Though it doesn&#8217;t seem to be accurate because the sum() function only uses the integer part of the CPU usage, not the fractional part, therefore the accuracy of cumulative CPU usage for a group of processes (or users).  and gets worse as the size of the group increases  eg.</p>
<p>sum 0.9 0.9 returns 0<br />
sum 1.9 1.9 returns 2<br />
etc.</p>
<p>ie. consider 125 httpd processes with 0.8 CPU usage.  This is actually 100% CPU usage, but your script would still return 0%&#8230;</p>
<p>from my googling I&#8217;m seeing that bash doesn&#8217;t handle floats very well.  Anyone have a solution?  I&#8217;ll post if I work it out&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-9958</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 04 Jun 2008 18:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-9958</guid>
		<description>I was doing something similar until I discovered that the CPU usage is since the process started it is not a current value. The documentation is very misleading on this topic (in AIX). I was hoping to send an email if CPU usage on some of our processes remained too high for too long but since they are almost always running they remain at or near 0 even if in topas they are showing 50% utilization</description>
		<content:encoded><![CDATA[<p>I was doing something similar until I discovered that the CPU usage is since the process started it is not a current value. The documentation is very misleading on this topic (in AIX). I was hoping to send an email if CPU usage on some of our processes remained too high for too long but since they are almost always running they remain at or near 0 even if in topas they are showing 50% utilization</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-3140</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 06 Feb 2008 13:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-3140</guid>
		<description>i am using this script in solaris.
It is always giving CPU usage 0%. 

I have modified the following 

Before - if [ $id -ge $startAtUid ]

Modified
- Before - if [[ $id -ge $startAtUid ]]

Anyproblem.</description>
		<content:encoded><![CDATA[<p>i am using this script in solaris.<br />
It is always giving CPU usage 0%. </p>
<p>I have modified the following </p>
<p>Before &#8211; if [ $id -ge $startAtUid ]</p>
<p>Modified<br />
- Before &#8211; if [[ $id -ge $startAtUid ]]</p>
<p>Anyproblem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-2383</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 22 Jan 2008 17:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-2383</guid>
		<description>I don&#039;t have access to a Solaris host I can test on. Where is the script having trouble?</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have access to a Solaris host I can test on. Where is the script having trouble?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manual</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-2382</link>
		<dc:creator>Manual</dc:creator>
		<pubDate>Tue, 22 Jan 2008 16:27:13 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-2382</guid>
		<description>Hi ,

Can you please provide script for solaris?

I am using solaris.

Regards
Manual</description>
		<content:encoded><![CDATA[<p>Hi ,</p>
<p>Can you please provide script for solaris?</p>
<p>I am using solaris.</p>
<p>Regards<br />
Manual</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuvi</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-1312</link>
		<dc:creator>Yuvi</dc:creator>
		<pubDate>Tue, 01 Jan 2008 19:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-1312</guid>
		<description>Is this script can be used in Solaris ?</description>
		<content:encoded><![CDATA[<p>Is this script can be used in Solaris ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Bash cures cancer, aprendiendo Shell script &#124; Inform&#225;tica Pr&#225;ctica &#124;</title>
		<link>http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html/comment-page-1#comment-76</link>
		<dc:creator>&#187; Bash cures cancer, aprendiendo Shell script &#124; Inform&#225;tica Pr&#225;ctica &#124;</dc:creator>
		<pubDate>Fri, 19 Oct 2007 18:36:12 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/monitor-cpu-abusers-with-this-simple-script.html#comment-76</guid>
		<description>[...] Bash cures cancer es un completo blog dedicado a los scripts en sistemas Unix/Linux. Aprender script de Unix es bastante interesante, y puede resultar muy útil bajo éstos entornos a la hora de planificar backups, generar queries, etc. Si estás interesado en éste tema no puedes perderte éste blog, ya que encontrarás montones de interesantes scripts. Un interesante script que he encontrado es éste, para poder ver qué procesos gastan demasiada cuota de cpu. [...]</description>
		<content:encoded><![CDATA[<p>[...] Bash cures cancer es un completo blog dedicado a los scripts en sistemas Unix/Linux. Aprender script de Unix es bastante interesante, y puede resultar muy útil bajo éstos entornos a la hora de planificar backups, generar queries, etc. Si estás interesado en éste tema no puedes perderte éste blog, ya que encontrarás montones de interesantes scripts. Un interesante script que he encontrado es éste, para poder ver qué procesos gastan demasiada cuota de cpu. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.229 seconds -->
<!-- Cached page served by WP-Cache -->

