Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 25301
  • Last Modified:

get hardware information of HP-UX

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
wesly_chen
Asked:
wesly_chen
  • 5
  • 5
2 Solutions
 
wesly_chenAuthor Commented:
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
 
JulieBouillonCommented:
Hi,

If memory serve me well, you should try dmesg. At least for CPU info.
0
 
wesly_chenAuthor Commented:
As a regular user, dmesg get the following error:
-----------
$ dmesg

Jun 28 11:34
Can't read kernel memory
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JulieBouillonCommented:
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
 
wesly_chenAuthor Commented:
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
 
JulieBouillonCommented:
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
 
wesly_chenAuthor Commented:
it needs root previlege to run. I've that for sys admin.
0
 
JulieBouillonCommented:
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
 
wesly_chenAuthor Commented:
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
 
JulieBouillonCommented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now