Operating System - HP-UX
1747984 Members
4693 Online
108756 Solutions
New Discussion

Re: collecting basic information from OS

 
tempsample
Frequent Advisor

collecting basic information from OS

I am in progres of collecting basic OS information.

 

I refered to the nickel script,but it was last modified on 2006.

 

any nickel script that was modified recently ?

10 REPLIES 10
Torsten.
Acclaimed Contributor

Re: collecting basic information from OS

It depends on your understanding of "basic information".

 

Consider to try ignite's "print_manifest".


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
tempsample
Frequent Advisor

Re: collecting basic information from OS

Hi Torsten,

 

Thanks for the information.

 

first let me check with nickel.

 

I have a small doubt in nickel script working.

 

after executing nickel,each output are saved in a seperate file.

 

some thing like crontab -l,cmviewcl,lvdisplay . each has its own seperate output.

 

but I need to have all in a single output.

 

some thing like in the attachement with the name "sample output"

 

so in which line  the modification is needed in nickel script.

 

Patrick Wallek
Honored Contributor

Re: collecting basic information from OS

Try CFG2HTML:

 

http://cfg2html.com/

 

The download for HP-UX is at the bottom of the page.  

 

The CFG2HTML output is in one single large file.

tempsample
Frequent Advisor

Re: collecting basic information from OS

Hi Patrick,

 

if [ ! -x $PLUGINS/get_ministat.sh ]
then
    banner "Error"
    line
    echo "Installation Error, the plug-in directory is missing or execution bit is not set"
    echo "You MUST install cfg2html via swinstall or tar xvf"
    echo "Plugin-Dir = $PLUGINS"
    exit 5
fi

 

------------->

 

 

I don't want those plugins to be installed . just I want the script to be placed as a normal execution script in server.

 

what all are the changes need to done to solve this problem.

Patrick Wallek
Honored Contributor

Re: collecting basic information from OS

>>I don't want those plugins to be installed .

 

Why not?  Those plugins are what enables CFG2HTML to gather iformation about the server.  Without them you will not get what you require.

Bill Hassell
Honored Contributor

Re: collecting basic information from OS

Not sure why you included some pictures of a Linux screen. HP-UX is not Linux (or AIX or Solaris, etc).

 

cfg2html is a single script. But like most collectors of information there are many additional commands to be run and formatted. Whether these commands are additional scripts is irrelevant.  If you install it with swinstall, then you can run the complete tool with a single command.

 

Now ministat is just the summary at the top of the listing.

If that is all you want, then just run it (after installing all of cfg2html):

 

/opt/cfg2html/plugins/get_ministat.sh

It is one of many useful scripts that are part of the cfg2html package.

If you want a different output, you can modify the script.

 

If you want just the summary in order to collect server details, you can use hostinfo which is attached.

It looks like this:

 

##       Hostname:           atl1
##       HP-UX version:      11.23
##       HP model:           9000/800/L1500-6x
##       Product Number:     A6797B
##       Processor cores     2
##       Processor speed:    650 Mhz
##       System memory:      4.096 GB
##       Serial Number:      SGH4235LNV

or blades:

##       Hostname:           bladei2
##       HP-UX version:      11.31
##       HP model:           ia64 hp Integrity BL860c i2
##       Product Number:     AD399A
##       Processor cores     16
##       Processor speed:    1600 Mhz
##       System memory:      98.202 GB
##       Serial Number:      USE123AYMA

or for vPars:


##       vPar environment:   "vpar0"
##       Hostname:           atl5vp0
##       HP-UX version:      11.31
##       HP model:           9000/800/rp7410
##       Product Number:     A6752A
##       Processor cores     1 (nPar total = 4)
##       Processor speed:    875 Mhz
##       System memory:      2.048 GB
##       Serial Number:      USR43216XD

 

I use this script as a replacement for /etc/motd so it shows at every login.

 

 

 



Bill Hassell, sysadmin
tempsample
Frequent Advisor

Re: collecting basic information from OS

Hi Bill,

 

Thanks for the input.

 

I have atatched my basic design .

 

I have to add other details below to that.

 

>>from the attachement :

 

after to this line I have to add other details

 

section "1.System Hardware Specifications"
<br>
subsection "1.1 Server product and Model"
echo " "
echo  "Model                   : `model`" >> $PAGEDETAIL
echo  "System Name             : `uname -n`" >> $PAGEDETAIL
echo  "Operating System Name   : `uname -s`" >> $PAGEDETAIL
echo  "OS version              : `uname -r`" >> $PAGEDETAIL
echo  "Kernel version          : `getconf KERNEL_BITS`" >> $PAGEDETAIL
echo  "OS Base Version         : `swlist | grep -i oe`" >> $PAGEDETAIL

 

 

-----------> from your example from hostinfo script related to ## Product number:

## look for Original and Current Product Number
## I2 or I4 must use cprop

              if [[ $IA24 = false ]]
              then
                 PROD="$(echo "$CSTMTXT" | grep -e "Current Product Number" | awk '{print $NF}')"
                 [[ "$PROD" = "" || "$PROD" = "N/A" ]]  &&
                    PROD="$(echo "$CSTMTXT" | grep -e "Original Product Number" | awk '{print $NF}')"
              else
                 CPROP="$(/opt/propplus/bin/cprop -summary -c "System Summary")"
                 PROD="$(echo "$CPROP" | awk '/Product Number/{print $NF}')"                
              fi
           fi

 

 


## Product number from file

  PROD="$(awk -F: '/prod/{print $NF}' $HOSTINFOTXT)"
  echo "##       Product Number:     $PROD"

 

 

 

How Can I add those to my script in attachement.

 

 

 

Bill Hassell
Honored Contributor

Re: collecting basic information from OS

The script has a lot of code to handle a very wide range (some 20 years of HP-UX versions) of code. Rather than explain all the different variations and how to obtain details without being root, I will just show the code to run on just the supported versions of HP-UX, that is 11.11 and later. It appears that you are just looking for the Product Number so here is code to provide it:

 

[[ "$(uname -m)" = "ia64" ]] && IA64=true || IA64=false
CSTMTXT="$(echo "sc product system;il" | cstm 2>&1)"
if [[ $IA64 = false ]]
then
   PROD="$(echo "$CSTMTXT" | grep -e "Current Product Number" | awk '{print $NF}')"
   [[ "$PROD" = "" || "$PROD" = "N/A" ]]  &&
      PROD="$(echo "$CSTMTXT" | grep -e "Original Product Number" | awk '{print $NF}')"
else
   CPROP="$(/opt/propplus/bin/cprop -summary -c "System Summary")"
   PROD="$(echo "$CPROP" | awk '/Product Number/{print $NF}')"
fi

echo "$PROD"

 

 



Bill Hassell, sysadmin
tempsample
Frequent Advisor

Re: collecting basic information from OS

I am running system with security type standard and trusted.

 

I am trying to acheive two points .

 

first point :

 

script needs to check if system is using standard or trusted,then it need to list the user that don't expire.

 

for trusted ,Is my understanding is correct  ?

------------------------------------------------------

for i in `cat /etc/passwd|cut -f1 -d:`
 do
 if [ 'getprpw -l mintm=0,exptm=0,lftm=0,expwarn=0 $i `]    ----> I think here i am making mistake.
 then
 echo "passwd never expire for user  $i:"
 fi
 done

--------------------------------------------------------------

for standard

 

passwd -sa $i  ---> but in this output How  can I list the Non -expire user.

 

how can I check for both trusted and standard type in a single script ?