-   SUSE / openSUSE (
-   -   script to monitor memory and cpu usage (

s_linux 07-22-2009 02:16 PM

script to monitor memory and cpu usage
Im just trying to write some script to caputre memory and cpu usage on SLES servers, I just wanna use "top |grep Mem" and "top |grep Cpu". when I ran the above command, it just keep going. i just want to get one line each for memory and cpu. Any one have an idea. Thanks

ramram29 07-22-2009 03:30 PM

Better yet you can graph the result using a combination of SNMP and rddtools

David1357 07-22-2009 04:10 PM


Originally Posted by s_linux (Post 3616720)
Any one have an idea.


[user@machine:~] top -b -n 1 | grep Mem
[user@machine:~] top -b -n 1 | grep Cpu

From the man page:

      -b : Batch mode operation
            Starts  top  in  'Batch  mode', which could be useful for
            sending output from top to other programs or to a file.
            In this mode, top will not accept input and runs until the
            iterations limit you've set with the '-n' command-line
            option or until killed.

s_linux 07-23-2009 03:03 PM

Thanks it works!!

All times are GMT -5. The time now is 12:23 AM.