- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script to capture cpu and memory utilization e...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2009 08:17 PM
тАО04-28-2009 08:17 PM
Really need your help to write a script so that I can capture cpu and memory utilization every hour.
TQ
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2009 08:23 PM
тАО04-28-2009 08:23 PM
Solution#!/bin/ksh
#######Script start########
dt=$(date +%d%m%Y_%H%M)
hname=$(hostname)
touch ~/$hname.$dt
echo "######VMSTAT outputs###########" >> ~/$hname.$dt
vmstat 1 5 >> ~/$hname.$dt
echo "######sar -u 5 5###############" >> ~/$hname.$dt
sar -u 5 5 >> ~/$hname.$dt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2009 09:04 PM
тАО04-28-2009 09:04 PM
Re: Script to capture cpu and memory utilization every hour
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2009 10:24 PM
тАО04-28-2009 10:24 PM
Re: Script to capture cpu and memory utilization every hour
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1017127
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 12:19 AM
тАО04-29-2009 12:19 AM
Re: Script to capture cpu and memory utilization every hour
top -n 1 > output_file.txt
This should print the top page 1 time then exit.
Then use crontab to execute it every hour :)
Best regards
Fredrik Eriksson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 11:33 PM
тАО04-29-2009 11:33 PM
Re: Script to capture cpu and memory utilization every hour
I use glance to collect data about cpu, disk, mem, swap.
res-cop.ksh:
#---BEGIN
#/usr/bin/ksh
GlnCmd=/opt/perf/bin/glance
WrkDir=
GlnSyn=$WrkDir/gln_syntax_file
GlnOpt="-j60 -adviser_only -nosort -iterations 2 -bootup -syntax $GlnSyn"
ResLog=$(date +%Y%m)-res-cop.log
#echo -- MM/DD/YY HH:MM:SS CPU DSK MEM SWA
$GlnCmd $GlnOpt 2>/dev/null |tail +2 >>$WrkDir/$ResLog
#---END
gln_syntax_file:
print "-- ",
gbl_statdate,
" ",
gbl_stattime,
" ",
gbl_cpu_total_util|3|0,
" ",
gbl_disk_util_peak|3|0,
" ",
gbl_mem_util|3|0,
" ",
gbl_swap_space_util|3|0
It creates a yyyymm-res-cop-log file which contains data collected.
HTH.
Rgds,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-15-2011 05:04 AM
тАО03-15-2011 05:04 AM