<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scripting CPU and memory usage in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193602#M51124</link>
    <description>allrighty then..&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;&lt;BR /&gt;cpuidle=`top -n 1 | grep ^Cpu | cut -d"," -f4| cut -d"%" -f1|cut -d" " -f2`&lt;BR /&gt;cpuused=`echo 100-$cpuidle | bc`&lt;BR /&gt;&lt;BR /&gt;memtotal=`top -n 1 | grep ^Mem |awk {'print $3'}|cut -d"k" -f1`&lt;BR /&gt;memused=`top -n 1 | grep ^Mem |awk {'print $5'}|cut -d"k" -f1`&lt;BR /&gt;mempct=`echo "(${memused}*100)/${memtotal}"| bc`&lt;BR /&gt;&lt;BR /&gt;echo "CPU Used: ${cpuused}%"&lt;BR /&gt;echo "Memory Used: ${mempct}%")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you putt all of the above in a script, run it and pipe it to your mailer, you will receive the desired output</description>
    <pubDate>Tue, 18 Aug 2009 12:13:54 GMT</pubDate>
    <dc:creator>Mel Burslan</dc:creator>
    <dc:date>2009-08-18T12:13:54Z</dc:date>
    <item>
      <title>Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193598#M51120</link>
      <description>Hey gang,&lt;BR /&gt;&lt;BR /&gt;Does anyone have a nice universal script (meaning no special software needed like glance, etc) that will give a nice quick summary of percentage of memory and CPU usage that can be emailed?  Thanks.</description>
      <pubDate>Mon, 17 Aug 2009 16:11:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193598#M51120</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2009-08-17T16:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193599#M51121</link>
      <description>top is available with any new system installation and command &lt;BR /&gt;&lt;BR /&gt;$ top -n 1 | grep -e ^Cpu -e ^Mem&lt;BR /&gt;&lt;BR /&gt;provides this output:&lt;BR /&gt;&lt;BR /&gt;Cpu(s):  0.2% us,  0.7% sy,  0.0% ni, 98.6% id,  0.2% wa,  0.0% hi,  0.3% si&lt;BR /&gt;Mem:   1024248k total,   990548k used,    33700k free,   130372k buffers&lt;BR /&gt;&lt;BR /&gt;which can be piped into your mail agent to send via email or can be further massaged with combination of awk/sed/cut commands to make the output you wish to see.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Mon, 17 Aug 2009 17:52:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193599#M51121</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-17T17:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193600#M51122</link>
      <description>I guess I'm looking for something a bit more than that.  Something yielding a percentage used in a neat output like so...&lt;BR /&gt;&lt;BR /&gt;CPU used:  23%&lt;BR /&gt;Memory used:  23%&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Aug 2009 18:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193600#M51122</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2009-08-17T18:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193601#M51123</link>
      <description>Mel answered your question, I want just to suggest you to use some NMS (Zenoss, Ganglia, ...) for storing/analyzing historical data.&lt;BR /&gt;&lt;BR /&gt;Getting email reports once per minute/hour/day seems me almost useless - you don't see any trends in this way.</description>
      <pubDate>Tue, 18 Aug 2009 06:55:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193601#M51123</guid>
      <dc:creator>Vitaly Karasik_1</dc:creator>
      <dc:date>2009-08-18T06:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193602#M51124</link>
      <description>allrighty then..&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;&lt;BR /&gt;cpuidle=`top -n 1 | grep ^Cpu | cut -d"," -f4| cut -d"%" -f1|cut -d" " -f2`&lt;BR /&gt;cpuused=`echo 100-$cpuidle | bc`&lt;BR /&gt;&lt;BR /&gt;memtotal=`top -n 1 | grep ^Mem |awk {'print $3'}|cut -d"k" -f1`&lt;BR /&gt;memused=`top -n 1 | grep ^Mem |awk {'print $5'}|cut -d"k" -f1`&lt;BR /&gt;mempct=`echo "(${memused}*100)/${memtotal}"| bc`&lt;BR /&gt;&lt;BR /&gt;echo "CPU Used: ${cpuused}%"&lt;BR /&gt;echo "Memory Used: ${mempct}%")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you putt all of the above in a script, run it and pipe it to your mailer, you will receive the desired output</description>
      <pubDate>Tue, 18 Aug 2009 12:13:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193602#M51124</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-18T12:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193603#M51125</link>
      <description>Oh, I fatfingered and put an extra right paranthesis at the end of the last line of the script, which should not be there. Please remove it.</description>
      <pubDate>Tue, 18 Aug 2009 12:18:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193603#M51125</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-18T12:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting CPU and memory usage</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193604#M51126</link>
      <description>Mel...that is PERFECT!!!!  Thank you so much for your help!!!</description>
      <pubDate>Tue, 18 Aug 2009 13:29:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-cpu-and-memory-usage/m-p/5193604#M51126</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2009-08-18T13:29:18Z</dc:date>
    </item>
  </channel>
</rss>

