Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

How to check CPU MEM usage

Occasional Visitor

How to check CPU MEM usage

Dear master,

how to make script to check list cpu usage, memory usage, hard disk usage in all my hp server once in every day ? i can do by crontab , but how to make the script ?
thank you
bangun
4 REPLIES
Acclaimed Contributor Acclaimed Contributor

Re: How to check CPU MEM usage

How detailed do you want?
You could ask top(1) to send out one pass.
For memory (actually swap) usage, you could use "swapinfo -tam".
For disk usage you can use "bdf -l".
Is this detailed enough for you?
Occasional Visitor

Re: How to check CPU MEM usage

hi denis,

tks you for your feedback, i know that command. But i want to put it all command in one script and the output in one file ?

tks

bangun
Acclaimed Contributor Acclaimed Contributor

Re: How to check CPU MEM usage

>But I want to put it all command in one script and the output in one file?

You can have each of these commands append their output to that one file.
> $OUTFILE
top -f $OUTFILE -n 50
swapinfo -tam >> $OUTFILE
bdf -l >> $OUTFILE
Honored Contributor Honored Contributor

Re: How to check CPU MEM usage

do a man sa1

in that man page it will give you sa1 commands you can put in a cron file to cause sar to collect data every hour on your system.