Solved

get hardware information of HP-UX

Posted on 2006-06-28
10
25,288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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
 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

635 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