How to check CPU MEM usage (377 Views)
Reply
Occasional Visitor
trisno_1
Posts: 2
Registered: ‎04-10-2011
Message 1 of 5 (377 Views)

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
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,978
Registered: ‎03-06-2006
Message 2 of 5 (377 Views)

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?
Please use plain text.
Occasional Visitor
trisno_1
Posts: 2
Registered: ‎04-10-2011
Message 3 of 5 (377 Views)

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
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,978
Registered: ‎03-06-2006
Message 4 of 5 (377 Views)

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
Please use plain text.
Honored Contributor
Emil Velez
Posts: 1,450
Registered: ‎05-17-2000
Message 5 of 5 (377 Views)

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.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation