Solved

get hardware information of HP-UX

Posted on 2006-06-28
10
25,251 Views
Last Modified: 2013-12-06
Dear experts,

   I would like to know as a regular unix user, how what commands can get the information of HP-UX system
CPU clock speed (in MHz or GHz),
memory size (in MB or GB),
swap size (in MB or GB),
hard disk volume (in GB, not filesystem size)
System model (Such as J6700)
System Serial number (if possible)

   I want to put those commands into a script so end users can run it to get the information for the HP-UX they are login.
As root, I can get those information and I would like to know the commands for regular user.
Most important information is the CPU speed, physical memory size, swap size, and disk volume.

Thanks in advance.
0
Comment
Question by:wesly_chen
  • 5
  • 5
10 Comments
 
LVL 38

Author Comment

by:wesly_chen
ID: 17003483
I got the C program to get the physical memory size and compiled it for regular users.
http://www.faqs.org/faqs/hp/hpux-faq/section-284.html
0
 
LVL 4

Expert Comment

by:JulieBouillon
ID: 17003566
Hi,

If memory serve me well, you should try dmesg. At least for CPU info.
0
 
LVL 38

Author Comment

by:wesly_chen
ID: 17003727
As a regular user, dmesg get the following error:
-----------
$ dmesg

Jun 28 11:34
Can't read kernel memory
0
 
LVL 4

Expert Comment

by:JulieBouillon
ID: 17005345
Could you try with getconf ? It works for non root users.
eg.; getconf CPU_CHIP_TYPE

Unfortunatelly, the output is not very user friendly... See the man page for the list of available infos.
At the following address, you will find a script to show you how to determine the CPU -> http://unix.derkeiler.com/Mailing-Lists/HP-UX-Admin/2003-04/0003.html

Other command you can also use are:
 - model -> gives the model of your server
 - lsdev -> list device driver in the system
 - ioscan -> Won't work as non root -> scan I/O system and output a map

The last way that I can think of would be to extract the informations from /var/adm/syslog/syslog.log (default location). You should find ther part of what you are looking for.

I hope it helps.
0
 
LVL 38

Author Comment

by:wesly_chen
ID: 17005732
getconf CPU_CHIP_TYPE
or the script based on "getconf CPU_CHIP_TYPE"
is showing the CPU type, not CPU clock speed.

>  /var/adm/syslog/syslog.log
I can see physical memory size and the swap size. But not CPU clock speed.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Expert Comment

by:JulieBouillon
ID: 17007946
From the following site http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=54007&admit=-682735245+1151571433409+28353475

Could you try this:
 echo $(echo itick_per_tick/D | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2/10000}')

I can't try it at the moment, so I'm not sure if it will run as non root user, especially since we access the kernel...
0
 
LVL 38

Author Comment

by:wesly_chen
ID: 17011957
it needs root previlege to run. I've that for sys admin.
0
 
LVL 4

Assisted Solution

by:JulieBouillon
JulieBouillon earned 300 total points
ID: 17014226
Ok, I got it now !
I wrote a small C program to obtain the numbers of CPU and the speed. You just need to compile it!
I only tested it under 11.11. I have not use pstat() since it is deprecated, but if your version is too old for this program, you should be able to modify it quite easilly by looking at pstat()'s man page.

------8<------
#include <sys/param.h>
#include <sys/pstat.h>

int main()
{
 struct pst_dynamic psd;
 int num_cpus = 0;
 struct pst_processor psp;
 int clock = 0;

 /* Determine how many processors are online and available */
 if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) != -1)
        num_cpus = psd.psd_proc_cnt;

 /* Report the speed of the first processor */
 if (pstat_getprocessor(&psp, sizeof(psp),1,0)) {
        clock = psp.psp_iticksperclktick / 10000;
 }

 printf("There is %d CPU(s) running at %d Mhz\n", num_cpus, clock);
}
------>8------
0
 
LVL 38

Author Comment

by:wesly_chen
ID: 17014904
This program works great for me.

I just wonder whether there is the similar system commands/scripts in HP-UX like
/usr/sbin/prtconf in IBM AIX
or
/usr/platform/`uname -m`/sbin/prtdiag  in Sun Solaris
or
/usr/sbin/dmidecode in Linux
(/usr/share/rhn/up2date_client/hardware.py in RedHat Enterprise Linux)

By the way, besides "/usr/sbin/swapinfo" (root only) or /var/adm/syslog/syslog.log , is there any command can show the swap size as regular user?
0
 
LVL 4

Accepted Solution

by:
JulieBouillon earned 300 total points
ID: 17015049
To find out what AIX or Solaris is on HP-UX or on Linux or on whatever Unix you're using, just go to -> http://bhami.com/rosetta.html

For the swap as non root user here is another small C program... You can have a look at all the info you can get with man pstat

------8<------
#include <sys/param.h>
#include <sys/pstat.h>

int main()
{
 struct pst_swapinfo pss;
 unsigned long swapsize = 0;
 unsigned long swapfree = 0;
 int i = 0;

 for (i = 0; pstat_getswap(&pss, sizeof(pss), (size_t)1, i); i++) {
        swapsize += pss.pss_nblksenabled;
        swapfree += pss.pss_nfpgs * 4;
 }

 printf("Swap size is %d (%d free)\n", swapsize, swapfree);
}
------>8------
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
AIX print queues constantly going down 11 453
Shell script errors 10 98
how to check for shares on aix 1 50
Convert OverPunch 25 57
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now