04-07-2005 12:04 AM - last edited on 01-01-2013 07:06 PM by Cathy_xu
I've see posts asking similar questions, I figured I'd share. I found one similar post and that got me going. I used inline perl.
I wrote code to collect inventory across our enterprise, at some point I'll post the inventory source for AIX, Solaris, Linux, and HP-UX, likely to sourceforge. I can get 3+ machines a minute without any agent code, well other than SSH. I prefer to work without privilege when possible, thus I needed a solution. I have worked towards threading my code so I can collect across 300 machines in under 5 mintes. I am collectiong performance information, kernel parameters, software packages, patches, LVM, filesystems, ..etc.
We've seen cstm hang, and frankly it takes too long when it works right.
I got tired of trying to work around the issue, this works on 11.00, 11.11, and 11.22.
Please note on IA64 you'll have to use the perl out of /opt/perl_64/bin, on PARISC it seems you can use the 32 bit perl.
perl -e 'local($PSTAT,$PSTAT_STATIC,$mem_info,$PSTAT_STRUC
for CPU speeds:
perl -e 'local($PSTAT, $PSTAT_PROCESSOR)=(239,10);
$cpu_info = "\0" x 120;
syscall($PSTAT, $PSTAT_PROCESSOR, $cpu_info, length($cpu_info), 1, 0);
Tom Ferony - Union Pacific Railroad email@example.com
P.S.This thread has been moved from HP-UX>System Administration to HP-UX > languages- HP Forums Moderator
04-07-2005 12:13 AM
It takes into account that you might not be root, and leaves out what it cannot fetch
Enjoy, Have FUN! H.Merijn
04-07-2005 12:14 AM
Quite cool, but I have 2560 MB's of ram and your script returned 2550 MB - Not a big deal. The CPU speed hit the nail on the head!
live free or die
harry d brown jr
04-07-2005 12:40 AM
I'm using this great script:
04-07-2005 01:22 AM
As far as memory goes, the attached c program runs a lot quicker then yuor perl script - and doesn't need root.
Memory Stat total used avail %used
physical 10080.0 8445.1 1634.9 84%
active virtual 7313.6 1179.7 6133.9 16%
active real 5818.8 569.8 5248.9 10%
memory swap 7707.8 1715.5 5992.2 22%
device swap 28080.0 6852.3 21227.7 24%
04-07-2005 02:33 AM
Inventory - I'm not distributing any code at all to any box on five different UNIX platforms (Zero Code Deployment), all I have is secure shell access via keys. The data is stored in a database to allow for cross referencing, comparisions, change history, graphing of sar data, ..etc. I'll try to attach a little sample of the "output".
Recovery - Upon the same framework I have built a failover/disaster recovery system that allows us to recover 300GB databases to off site boxes in less than 10 minutes. No volume groups defined on the target at all, but I do have full audits if PVIDs are on disks on the remote boxes. Here I have to deploy a little code, a tiny program called sudo to escalate my privileges.
I feel that this approach scales much better.
I have permission to post all of my code I just need to clean it up, well and get the time. ;)
Tom Ferony - Union Pacific Railroad