- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: CPU utilization measure script
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
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
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
01-14-2013 08:11 PM - last edited on 01-14-2013 11:28 PM by Cathy_xu
01-14-2013 08:11 PM - last edited on 01-14-2013 11:28 PM by Cathy_xu
Cup utilization measure script
HI Experts
for Cup utilization measure we are using the below scrip ,can anyone explain how it work? it im not able to understand this.
usr/bin/sar 1 | /usr/bin/grep -v 'usr' | /usr/bin/grep -v 'HP' | /usr/bin/tr -d '\n'| /usr/bin/awk 'NF==5 {total=$2+$3} END {print total}'
Thanks in advance .Appriciate your help
P.S.This thread has been moved from HP-UX>System Administration to HP-UX > langages- HP Forums Moderator
Ajin.S
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
- Tags:
- sar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2013 10:51 PM - edited 01-15-2013 08:08 PM
01-14-2013 10:51 PM - edited 01-15-2013 08:08 PM
Re: CPU utilization measure script
(It would help if you got rid of those html codes and provided text.)
>sar 1 | grep -v -e 'usr' -e 'HP' | tr -d '\n'| awk 'NF==5 {total=$2+$3} END {print total}'
This takes a sample after 1 second.
Removes lines with usr or HP. (Most likely the title/header lines.)
Deletes all newlines. (I'm not sure why since awk can total up columns?)
If there are 5 fields, add field 2 and 3 (user and sys times) and print a total after reading all of the(1) lines.