- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Detect number of CPUs as non-root user
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-25-2004 06:13 PM
тАО04-25-2004 06:13 PM
when writing a perl script that should run on several Unix platforms, I came to a problem when trying to detect the number of CPUs installed in our HP rx2600 server (HP-UX 11.23).
When logged in as root this could be easily done using "/opt/ignite/bin/print_manifest" however, this utility can only be run as root.
Is there any way of detecting the number of CPUs directly (without workarounds like cronjobs run by root etc.) as non-root user?
Thanks in advance!
Peter
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:20 PM
тАО04-25-2004 06:20 PM
Re: Detect number of CPUs as non-root user
# sar -M 2 2
HP-UX macerp B.11.11 U 9000/800 04/26/04
14:14:44 cpu %usr %sys %wio %idle
14:14:46 0 30 12 12 46
1 29 7 1 63
system 29 9 7 54
14:14:48 0 62 10 1 26
1 62 7 6 25
system 62 9 4 25
Average 0 46 11 7 36
Average 1 46 7 4 44
Average system 46 9 5 40
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:21 PM
тАО04-25-2004 06:21 PM
Re: Detect number of CPUs as non-root user
UNIX95= ps -o cpu | sort -un
That will report all CPU's running processes. But it is not reliable. You might need to run it at least a couple of times to get all available CPU numbers. I think it is better to do it this way:
top -d 1 | awk '/^CPU/,/^avg/ { print $1 }'
It will report the first columns of your CPU part of top, which will show what you want, I guess.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:28 PM
тАО04-25-2004 06:28 PM
Re: Detect number of CPUs as non-root user
top and sar -M can be used.
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:28 PM
тАО04-25-2004 06:28 PM
Re: Detect number of CPUs as non-root user
You can find with top command.
$top
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:29 PM
тАО04-25-2004 06:29 PM
Re: Detect number of CPUs as non-root user
TERM=ansi top -d 1 | awk '/^CPU.*LOAD/,/^---.*----/ {print $1}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2004 06:45 PM
тАО04-25-2004 06:45 PM
Re: Detect number of CPUs as non-root user
Thanks to all for your quick help!
I think I will go for the "sar"-solution as it seems to be the easiest for me.
Rgs,
Peter