Tips and Tricks site for advanced HP-UX Engineers

24 Feb 15 Server backplane layout for rx class servers

HP-UX hardware is a bit Byzantine in nature. The following script demystifies things a bit and allows us to work at remote data centers with accuracy on cable issues both fiber and copper.

If you want to use this script, use the contact form to reach out to me. Most people will find cutting and pasting from the website very frustrating.

I am also reaching out to the community, dare I say fan base for assistance. I am fairly certain that the fiber side accurately reports status of hba connections. I am fairly certain that the copper side needs to be improved.

This is tested on rx7640 and rx8640 systems. I am fairly confident that it will work on superdomes. I just do not happen to have any around to test on.

Script includes an environment plugin called .scriptenv . I will provide relevant code from it as some of what it does is customer specific and can not be released into the wild. If functionality is needed everywhere, I try to provide it via a centrally managed file. I provide functionality to both command prompts and scripting this way. It allows me to make the scripts generic and change one file with environment customizations.

Script is based on olrad -q output. It uses several deprecated utilities such as lanadmin and lanscan. Since I currently doubt HP-UX v4 is in the works, this should not be a problem.

The output then the script:

IP addresses and mac addresses have been changed to protect the innocent:

Executing HP-UX specific environment parameters…
m rx8640
ml ia64 hp server rx8640
Valid model found: rx8640
8-0-1-1 3/0/8/1
Nework info:
info lan3: 3/0/8/1/0/6/0 0x0025B3E86088 UP up(1) up(1)
info lan4: 3/0/8/1/0/6/1 0x0025B3E86089 UP up(1) up(1)
HBA info:
hba dev: /dev/fcd2
drviver state: ONLINE
fcms device: 3/0/8/1/0/4/0
WWN sys: 0x500143800542b4f9
WWP sys: 0x500143800542b4f8
Switch port: 0x20280027f8a26cd4
Switch node: 0x10000027f8a26cd4
hba dev: /dev/fcd3
drviver state: ONLINE
fcms device: 3/0/8/1/0/4/1
WWN sys: 0x500143800542b4fb
WWP sys: 0x500143800542b4fa
Switch port: 0x20a80027f8a09ff8
Switch node: 0x10000027f8a09ff8
8-0-1-7 3/0/2/1
Nework info:
info lan1: 3/0/2/1/0/6/0 0x0025B3E86066 UP up(1) up(1)
info lan2: 3/0/2/1/0/6/1 0x0025B3E86067 UP up(1) up(1)
HBA info:
hba dev: /dev/fcd0
drviver state: AWAITING_LINK_UP
fcms device: 3/0/2/1/0/4/0
WWN sys: 0x500143800542b4b5
WWP sys: 0x500143800542b4b4
Switch port: 0000000000000000
Switch node: 0000000000000000
hba dev: /dev/fcd1
drviver state: AWAITING_LINK_UP
fcms device: 3/0/2/1/0/4/1
WWN sys: 0x500143800542b4b7
WWP sys: 0x500143800542b4b6
Switch port: 0000000000000000
Switch node: 0000000000000000
8-0-1-5 3/0/6/0/0/0
Nework info:
ifconfig: no such interface
info lan7: 3/0/6/0/0/0/0/2/0/0/0 0x001E0B5186F0 UP up(1) up(1)
info lan8: 3/0/6/0/0/0/0/2/0/0/1 0x001E0B5186F1 UP up(1) up(1)
HBA info:
hba dev: /dev/fclp6
drviver state: ONLINE
fcms device: 3/0/6/0/0/0/0/4/0/0/0
WWN sys: 0x5001438001314ad5
WWP sys: 0x5001438001314ad4
Switch port: 0x20260027f8a09ff8
Switch node: 0x10000027f8a09ff8
hba dev: /dev/fclp7
drviver state: ONLINE
fcms device: 3/0/6/0/0/0/0/4/0/0/1
WWN sys: 0x5001438001314ad7
WWP sys: 0x5001438001314ad6
Switch port: 0x20950027f8a26cd4
Switch node: 0x10000027f8a26cd4
8-0-1-6 3/0/4/0/0/0
Nework info:
info lan5: 3/0/4/0/0/0/0/2/0/0/0 0x001E0B5186B4 UP up(1) up(1)
info lan6: 3/0/4/0/0/0/0/2/0/0/1 0x001E0B5186B5 UP up(1) up(1)
HBA info:
hba dev: /dev/fclp4
drviver state: ONLINE
fcms device: 3/0/4/0/0/0/0/4/0/0/0
WWN sys: 0x5001438001314a99
WWP sys: 0x5001438001314a98
Switch port: 0x200f0027f8a09ff8
Switch node: 0x10000027f8a09ff8
hba dev: /dev/fclp5
drviver state: ONLINE
fcms device: 3/0/4/0/0/0/0/4/0/0/1
WWN sys: 0x5001438001314a9b
WWP sys: 0x5001438001314a9a
Switch port: 0x20140027f8a09ff8
Switch node: 0x10000027f8a09ff8

Key output is this:
This is how the backplane is actually labeled.

cat backplane.layout.ksh
# vgfiberswitch.ksh
# Steven “Shmuel” Protter
. /var/adm/bin/.scriptenv
# binary location

echo “m ${modinfo}”
echo “ml ${modinfol}”
echo “——————————————————————–”
if [ “${modinfo}” = “rx8640” ] ||[ “${modinfo}” = “rx7640” ]
echo “Valid model found: ${modinfo}”
echo “INVALID model found: ${modinfo}”
echo “Exiting return code 1 ………”
exit 1
## determine number of multifunction cards to expect
ncards=$(olrad -n);
olrad -q| awk ‘/Yes/{ printf “%s %s\n”,$1,$2 }’ | while read -r slot hwp
echo “${slot} ${hwp}”
echo “Nework info:”
## network info
${LS} | grep “${hwp}” | awk ‘{ printf “%s %s %s %s %s\n”,$1,$2,$3,$4,$5 }’ | while read -r fwp mad nn st ln
### echo “hwp: ${fwp} mad: ${mad} netnum: ${nn} status ${st} lan:${ln}”
ipady=$(ifconfig ${ln} |awk ‘/inet/{print $2}’);
last1=$(lanadmin -g $nn |awk ‘/Administration Status/{ print $NF}’);
last2=$(lanadmin -g $nn |awk ‘/Operation Status/{ print $NF}’);
echo “info ${ln}: ${ipady} ${fwp} ${mad} ${st} ${last1} ${last2}”
echo “HBA info:”
ioscan -fnCfc -H ${hwp} | awk ‘/dev/{print $NF}’ |while read -r dv
nnwwn=$(${FU} ${dv}|awk ‘/N_Port Node World Wide Name/{print $NF}’);
npwwn=$(${FU} ${dv}|awk ‘/N_Port Port World Wide Name/{print $NF}’);
spwwn=$(${FU} ${dv}|awk ‘/Switch Port World Wide Name/{print $NF}’);
snwwn=$(${FU} ${dv}|awk ‘/Switch Node World Wide Name/{print $NF}’);
drst=$(${FU} ${dv}|awk ‘/Driver state/{print $NF}’);
fchw=$(${FU} ${dv}|awk ‘/Hardware Path is/{print $NF}’);
echo “hba dev: ${dv}”
echo “drviver state: ${drst}”
echo “fcms device: ${fchw}”
echo “WWN sys: ${nnwwn}”
echo “WWP sys: ${npwwn}”
echo “Switch port: ${spwwn}”
echo “Switch node: ${snwwn}”

echo “——————————————————————–”

relevant parts of .scriptenv

OSM=$(uname -s);
OSV=$(uname -r);

# determine the third octet

## /Depots/B.11.31/2014midyear_depot
## /Depots/B.11.23/2014midyear_depot

if [ “${OSM}” = “HP-UX” ]
echo “Executing HP-UX specific environment parameters…”
modinfo=$(model | awk ‘{print $NF}’);
modinfol=$(model | awk ‘{printf “%s %s %s %s\n”,$1,$2,$3,$4}’);
isvirt=$(model | awk ‘/Virtual/{print $NF}’ | wc -l);

Script is provided without warranty.

Link to script..

Tags: , , ,

06 Nov 13 Getting EMC disk ID’s.

We want storage to check performance on three possibly problematic LUNS.

Need to get the 4 character LUN ID’s on three disks:

disk82 disk83 and disk123

/usr/bin/inq -nodots -sym_wwn | egrep “disk82|disk83|disk123″| awk ‘{print $3}’ |awk ‘{ print substr( $0, length($0) – 3, length($0) ) }’





HP-UX 11.31 September 2011 OE.

A good day is an awkful day.

Tags: , , , , ,

11 Jul 12 Online JFS filesystem expansion without umount

This requires add in software from Veritas/Symmantec that can be expensive on HP-UX.

Lets say we want to extend /var which is lvol8.

It was originally 600 LE and we extended it as follows.

lvextend -l 800 /dev/vg00/lvol8 /dev/disk/disk25_p2

The 800 refers to LE logical extents. I prefer to use this rather than MB because it corresponds to the values displayed by most lvm utilities. -L <value in megabytes> can be used. I assume you can do the math here.

[system099]/root # lvdisplay /dev/vg00/lvol8
— Logical volumes —
LV Name                     /dev/vg00/lvol8
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            12800
Current LE                  800
Allocated PE                1600
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  non-strict
IO Timeout (Seconds)        default

It was originally 600 LE and we extended it as follows.

lvextend -l 800 /dev/vg00/lvol8 /dev/disk/disk25_p2


fsadm -F vxfs -b 12800M /var

This command will use online JFS to extend the filesystem. The alternative is extendfs. But that requires a umount.  Or perhaps xvumount -o force. Your choice, I don’t recommend it, but did test it the other day in the sandbox.

Now if you want to be cute and use all your space, try this.

SIZE=$(lvdisplay /dev/vg00/lvol8 | awk ‘/LV Size/ {print $NF}’);


fsadm -F vxfs -b $ESIZE /var

You can get more cute and do it with a single command line but I’m not going to do that. I have not broken any systems this week and am trying to avoid that.

Tags: ,

07 Jun 12 awk trick of the day(month?) parsing bdf output. awk with if else logic

Ever try and do system reporting based on bdf?

Annoying as all heck that sometimes the output is two line and sometimes one? I was forced to solve that problem today.


if [ “$OS” = “HP-UX” ]


exec $dcmd | egrep -v “%used|/dev/deviceFileSystem” | awk ‘{lvn=$1;v=$2;if (v==””) {getline;cap=$1;ucap=$2;acap=$3;puse=$4;mp=$5;printf “%s %s %s %s %s %s\n”, lvn,cap,ucap,acap,puse,mp} else {printf “%s %s %s %s %s %s\n”, $1,$2,$3,$4,$5,$6} }’ | while read -r  p1 p2 p3 p4 p5 p6

   #### calculations


Typical bdf output:

/dev/vg00/lvol9    4096000 3140019  896285   78% /var/adm/crash
1572765696 1382813225 178080447   89% /steven05stgb

More when the script is done

Tags: , , , ,

06 Apr 11 setboot hardware path to legacy hardware path. A converter.

HP-UX 11.23

setboot provides output only including the hardware path (ioscan -H).

When calculating DRD clone targets and such you need the regular legacy device path.

Here is a converter, built with a little help from JRF on the ITRC forums.

First get the setboot path. Might want to use the full path of the setboot command in practice.

pboot=$(setboot | grep ^Primary | awk ‘{ print $NF }’);
aboot=$(setboot | grep ^Alternate |awk ‘{ print $NF}’);

abootdisk=$(ioscan -kfnCdisk | awk -v aboot=${aboot} ‘/aboot/ $0~aboot {getline;print aboot,$2}’ | awk ‘{ print $2 }’);

pbootdisk=$(ioscan -kfnCdisk | awk -v aboot=${pboot} ‘/pboot/ $0~pboot {getline;print pboot,$2}’ | awk ‘{ print $2 }’);

The slick part is getting the variable in and out of awk.

Uses ioscan.

Tags: , , ,

30 Nov 10 awk trick of the day. Parsing comma delimited input to a sequential file

Lets say I have a list of servers a mile long to visit.  Got a help desk request with the servers listed separated by commas.


Lets say It is actually about 30 or 40 servers and I’m too lazy to edit the list

echo “server1,server2,server3” > olist

awk -F, -v nr=1 ‘{ for (x=nr; x<=NF; x++) {printf $x ” \n”; }; print ” ” }’ olist





Plug and play time here, you can take care of any delimited format like this.

Spaces input by wordpress (thanks)

Tags: , ,

29 Oct 10 HP-UX APA help guide

HP APA Commands using lanadmin and nwmgr

Task Legacy Command nwmgr Command
Display command help lanadmin -X -H 900 nwmgr –help -S apa
View link aggregate status lanadmin -x -v 900 nwmgr -c lan900
Create a MANUAL mode link aggregate lanadmin -X -a 1 2 900 nwmgr -a -A links=1,2 -A mode=MANUAL -I 900 -S apa
Create a failover group lanapplyconf nwmgr -a -A links=1,2 -A mode=LAN_MONITOR -I 900 -S apa
Remove all ports from a link aggregate lanadmin -X -c 900 nwmgr -d -A links=all -I 900 -S apa
Remove all ports from a failover group landeleteconf -g lan900 nwmgr -d -A links=all -c lan900
Remove specific ports from a link aggregate lanadmin -X -d 1 2 900 nwmgr -d -A links=1,2 -I 900 -S apa
Update the load balancing algorithm and group
capability for a link aggregate
lanadmin -X -l LB_MAC 900
lanadmin -X -g 900 900 900
nwmgr -s -A lb=LB_MAC, gc=900 -I 900 -S apa
Update the group capability and configuration
mode for a port
lanadmin -X -p 3 900 900
lanadmin -X -p 3 FEC_AUTO 900
nwmgr -s -A gc=900, mode=FEC_AUTO -I 3 -S apa
Update the group capability for a link aggregate lanadmin -X -g 900 900 900 nwmgr -s -A gc=900 -I 900 -S apa
Update the administrative key and load
balancing for a link aggregate
lanadmin -X -k 900 900 900
lanadmin -X -l LB_IP 900
nwmgr -s -A key=900 -A lb=LB_IP -I 900 -S apa
Update the administrative key and
configuration mode for a port
lanadmin -X -k 4 900 900
lanadmin -X -p 4 LACP_AUTO 900
nwmgr -s -A key=900 -A mode=LACP_AUTO -I 4 -S apa
Update the administrative key for a port lanadmin -X -k 4 900 900 nwmgr -s -A key=900 -I 4 -S apa
Update the load balancing lanadmin -X -l LB_IP 900 nwmgr -s -A lb=LB_IP -I 900 -S apa
Set the configuration mode on a port lanadmin -X -p 5 MANUAL 900 nwmgr -s -A mode=MANUAL -I 5 -S apa
Set the system priority on a port lanadmin -X -s 5 10 900 nwmgr -s -A sys_pri=10 -I 5 -S apa
Display the MAC address lanadmin -a 900 nwmgr -A mac -c lan900
Display the speed lanadmin -s 900 nwmgr -A speed -c lan900
Display the MTU, MAC address, and speed lanadmin -m -a -s 900 nwmgr -A mtu,mac,speed -c lan900
nwmgr -A all -c lan900
Display group capability lanadmin -x -g 5 900 nwmgr -A gc -I 5 -S apa
Display aggregate port status lanadmin -x -i 900 nwmgr -A all -c lan900
Display administrative key lanadmin -x -k 5 900 nwmgr -A key -I 5 -S apa
Display load balancing algorithm lanadmin -x -l 900 nwmgr -A lb -c lan900 -S apa
Display port status lanadmin -x -p 5 900 nwmgr -A mode -I 5 -S apa
Display system priority lanadmin -x -s 5 900 nwmgr -A sys_pri -I 5 -S apa
Display current port priority lanadmin -x -t 5 900 nwmgr -A port_pri -I 5 -S apa
Display aggregate status lanadmin -x -v 900 nwmgr -v -c lan900
Check network connectivity linkloop -i 900 0xaabbccddeeff nwmgr –diag -A dest=0xaabbccddeeff -c lan900
Get statistics lanadmin -g 900 nwmgr –st -c lan900
Monitoring statistics apa-monitor -p 5 nwmgr –st monitor -S apa -I 900
Reset an APA interface lanadmin -r 900 nwmgr -r -c lan900
Reset statistics lanadmin -c 900 nwmgr -r –st -c lan900
View basic help lanadmin -x -h 900 nwmgr -h -S apa
View verbose help lanadmin -X -H 900 nwmgr -h -v -S apa
Clear data flows on a link aggregate lanadmin -X -o 900 nwmgr -r -q data_flow -c lan900
List all interfaces on the system lanscan nwmgr
List all APA interfaces lanscan -q nwmgr -S apa

nwmgr -s -f -c lan1 -A mtu=1500 –cu

### change mtu on lan1 to 1500 (lanadmin -M 1 1500)

Found some really useful information on APA. So good I won’t risk it disappearing. Pretty much here for my own reference.

Tags: ,

01 Jul 10 Quick and dirty awk trick to see all Fiber Channel status

I needed to update documentation and I needed more information that my prior script provided on fiber.

# Improvement by JRF on the ITRC forums.

ioscan -kfnC fc | awk ‘/fcd/ {getline;fcd=$NF;print fcd,$2}’ | while read -r fdev

fcmsutil ${fdev} | awk ‘/Hardware / {print $5};/World / { print $7}’


Ouput looks like this:





Second, new improved version (Girsah Chadash)
ioscan -kfnC fc | awk ‘/fcd/ {getline;fcd=$NF;print fcd,$2}’ | while read -r fde

fcmsutil ${fdev} | awk ‘/Hardware / {print $5};/World / { print $7}’ | awk’ {printf “%s %s %s %s %s”,$1, $2, $3, $4, $5;}’
fcmsutil ${fdev} | awk ‘/Hardware Path/ {PATH=$5};
/N_Port Node/ {NNODE=$7};
/N_Port Port/ {NPORT=$7};
/Switch Port/ {SPORT=$7};
/Switch Node/ {SNODE=$7};


Next innovation would be to combine the awk statements in the while loop and pull off the output with a single awk command. I may do this, but I might need help from an awk guru.

The ioscan output is multi line, so the real innovation is using the getline function of awk to get the second line of data and ignore the first. The filter /fcd gets rid of the column format information.

Yes it could be done with grep, but it is more AWKFUL this way.

Updated document to provide some indentation. Trying to make the code easier to read. That may force me to add formatted scripts to download, which I will get to as time permits.


Tags: , ,

09 Jun 10 System I/O layout (EMC specific)

This is a script designed to document the layout of a system. It is EMC specific and requires the output of the inq command, which I store in /tmp/inq.txt

It can however be adapted to non EMC disk systems. It correctly shows the port/lba layout and status of network and fiber I/O the way it appears on the outside of the system. Two tables are included to permit lookups of the port/lba information. It has worked on blades, and is certified for rp8420 and superdome systems.

It has only been tested on HP-UX 11.31.

… please stand by….update in progress…


typeset MYDIR=/var/tmp/syslayout
typeset MYPAGE=mypage
typeset MYDATA=mydata
typeset IDX_HTML=syslayout.html

writehtml (){
while [ $# -gt 0 ]
echo “<td>${1}</td>” >> ${IDX_HTML}

echo “<tr>” >> ${IDX_HTML}

cat -<<!EOF > ${IDX_HTML}
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<title>Dana IT Unix System documentation</title>
<TABLE style=”WIDTH: 100%; COLOR: rgb(0,0,0); TEXT-ALIGN: left” cellSpacing=2
cellPadding=2 border=0>
<td width=”200″><img
style=”border-width: 0px; margin: 0px; padding: 0px;” alt=”Dana”
src=”dana_logo.jpg”> </td>
<td style=”font-weight: bold;”><big><big>Dana

<TD style=”VERTICAL-ALIGN: top; TEXT-ALIGN: center” colSpan=7><BIG
style=”FONT-FAMILY: helvetica,arial,sans-serif”><BIG>Dana IT system I/O Layout.</BIG></BIG><BR></TD></TR>

# colum layout # Path       slot MAC Address    lan  ipaddress      vlan   linkstatus

sysname=$(uname -n)
this_cell=$(vparstatus -p $sysname -v |awk ‘/Boot processor/ {print $4}’ |awk -F’\.’ ‘{print $1}’)

# echo $this_cell

this_par=$(parstatus -c 0 |awk ‘/cell’$this_cell’/ {print $9}’)

nparname=$(/usr/sbin/parstatus -P |awk “/^$this_par/ {if(pname == 1) {print}};/Partition Name/ {pname=1}”|awk ‘/’$this_par’ / {print $6}’)

#echo “Diag nparname: ${nparname}”

complexname=$(/usr/sbin/parstatus -X |awk “/Complex Name/”)

nparinfo=$(/usr/sbin/parstatus -P |awk “/^$this_par/ {if(pname == 1) {print}};/Partition Name/ {pname=1}”)
# model needs to be determineed
OS=$(uname -r)
if [ “$OS” = “B.11.31” ]
mod=$(model | awk ‘{ print $5 }’)
mod=$(model | awk -F/ ‘{ print $3}’)


this_cell=$(vparstatus -p ${hn} -v |awk ‘/Boot processor/ {print $4}’ |awk -F’\.’ ‘{print $1}’)

echo $this_cell

this_par=$(parstatus -c 0 |awk ‘/cell’$this_cell’/ {print $9}’)

/usr/sbin/parstatus -P |awk “/cell/ {if(pname == 1) {print}};/Partition Name/ {pname=1}”|awk ‘/’$this_par’ / {print $6}’

echo “Host name: ${lhn}”
writehtml “Host name:” ${lhn}
echo “Model number is: $mod”
writehtml “Model number:” ${mod}
#echo “<td>$complexname</td><td>$nparname</td><tr>” >>  ${IDX_HTML}
writehtml “${complexname}” ${nparname}
echo “Model number is: $mod”
pbootpath=$(parstatus -p 0 -V |awk -F: ‘/Primary Boot Path/ {print $2}’)

echo “Primary boot path: ${pbootpath}”
writehtml “Primary boot path:” ${pbootpath}
#echo “<td>$complexname</td><td>$nparnam</td><tr>” >>  ${IDX_HTML}
# echo “<td>Path</td><td>slot</td><td>MAC Address</td><td>lan</td><td>IP Address</td><td>vlan</td><td>Link Status</td><tr>” >>  ${IDX_HTML}
writehtml Path slot MAC_Address lan IP_Address vlan Link_Status

#echo “$nparinfo”
# echo “Path        slot MAC         lan     check    ip”
# 2/0/5/1/0/6/1 4 0x002264E4948B lan1
echo  “Path       slot MAC Address    lan  ipaddress      vlan   linkstatus”

/usr/sbin/ioscan -fnk | awk ‘/^lan/ {print $3}’ |while read -r path
echo $path  | sed ‘s/\// /g’ | read p1 p2 p3 p4 p5 p6 p7
macaddy=$(lanscan | awk ‘{if($1 == “‘${path}'”) print $2}’)
lanid=$(lanscan | awk ‘{if($1 == “‘${path}'”) print $5}’)
plan=$(lanscan | awk ‘{if($1 == “‘${path}'”) print $3}’)
lchk=$(/usr/sbin/linkloop -i $plan $macaddy 2>/dev/null | grep “OK”)
# If linkloop produces postive results then see if there is an ip address
ip=”IP not set”
if [ -n “$lchk” ]
# echo “lchk not null. running ifconfig command”
ip=$(/usr/sbin/ifconfig $lanid | grep netmask | awk ‘{print $2}’)
# roll through the router table and see if you can establish
# linkloop with the gateway
DRMAC=”No link..”
DVLAN=”Not found”
#while [[ “$value” != “val1” || “$value” != “val2” || “$value” != “val3” ]]
while read -r DL
rmacaddy=$(echo $DL | awk -F: ‘{print $2}’)
rvlan=$(echo $DL | awk -F: ‘{print $3}’)
rlchk=$(/usr/sbin/linkloop -i $plan $rmacaddy 2>/dev/null | grep “OK”)
if [ -n “$rlchk” ]
# echo “rlchk not null. setting vlan information.”
done < $MA

#  echo “${path} ${p7} ${macaddy} ${lanid} ${lchk} ${ip} ”
#p1=$(echo $path | awk -F/ ‘{print $1}’);
#p2=$(echo $path | awk -F/ ‘{print $2}’);
#p3=$(echo $path | awk -F/ ‘{print $3}’);
#p4=$(echo $path | awk -F/ ‘{print $4}’);
#p5=$(echo $path | awk -F/ ‘{print $5}’);
#p6=$(echo $path | awk -F/ ‘{print $6}’);
#p7=$(echo $path | awk -F/ ‘{print $7}’);

portpath=$(echo $path | awk -F/ ‘{print $3}’)
actualport=$(awk -F: ‘{if($2 == “‘${portpath}'” && $3 == “‘$mod'”) print $1}’ ${DF})

# echo “Actual path: ${p1} ${p2} ${p3} ${p4} ${p5} ${p6} ${p7}  ${actualport} ${ip} ${macaddy} ${lanid} ${ip}”
echo “${path} ${actualport} ${macaddy} ${lanid} ${ip}   ${DVLAN}   ${DRMAC}”
# echo “<td>${path}</td><td>${actualport}</td><td>${macaddy}</td><td>${lanid}</td><td>${ip}</td><td>${DVLAN}</td><td>${DRMAC}</td><tr>” >> ${IDX_HTML}
writehtml ${path} ${actualport} ${macaddy} ${lanid} ${ip} ${DVLAN} ${DRMAC}

echo “Fiber Channel….”
# echo “<td>Fiber Channel….</td><tr>” >> ${IDX_HTML}
writehtml  “Fiber Channel”
echo “PATH       slot Device… Status spd Hardware address”
# echo “<td>PATH</td><td>slot</td><td>Device</td><td>Status</td><td>speed</td><td>Hardware address</td><tr>” >>  ${IDX_HTML}
writehtml PATH slot Device Status speed Hardware address
#/usr/sbin/ioscan -fnCfc | grep fcd | awk ‘{print $3}’ |while read -r path
/usr/sbin/ioscan -fnk | awk ‘/^fc / {hw=$3;getline;print hw,$1}’ |while read -r hw devfile
#   echo “diag ${hw} dev file … ${devfile}”
port=$(echo $hw | awk -F/ ‘{print $3}’)
OSTAT=$(fcmsutil $devfile | awk ‘/ONLINE/  {print $4}’)
LSPD=$(fcmsutil $devfile | awk ‘/Link Speed/  {print $4}’)
WWN=$(fcmsutil $devfile | awk ‘/N_Port Port World Wide Name/  {print $7}’)
#  OSTAT=$(fcmsutil /dev/fcd1 | awk ‘/ONLINE/  {print $4}’)
#  LSPD=$(fcmsutil /dev/fcd1 | awk ‘/Link Speed/  {print $4}’)
#  WWN=$(fcmsutil /dev/fcd1 | awk ‘/N_Port Port World Wide Name/  {print $7}’)
actualport=$(awk -F: ‘{if($2 == “‘${port}'” && $3 == “‘$mod'”) print $1}’ ${DF})
echo “$hw ${actualport} $devfile ${OSTAT} ${LSPD} ${WWN}”
#echo “<td>$hw</td><td>${actualport}</td> <td>$devfile</td><td>${OSTAT}</td><td>${LSPD}</td> <td>${WWN}</td><tr>” >>  ${IDX_HTML}
writehtml ${hw} ${actualport} ${devfile} ${OSTAT} ${LSPD} ${WWN}

#awk -F: ‘{printf(“%8s %5s %4s\n”,$1,$3,$4)}’ steve

cat -<< !EOF >> ${IDX_HTML}

chmod a+r ${IDX_HTML}
# Added to copy the data file to my home directory for diagnosis.
cp syslayout.html /home/sprotte
chmod a+r /home/sprotte/syslayout.html

root@gitop2:/root # more /usr/global/etc/super.translate.dat

more /usr/global/etc/router.macadd.dat

IP Address : MAC Address : vlan# : Description
:0x00000c07ac0a:vlan9:HP-UX Production

Obviously this data varies from place the place. The Mac address of the router is used to check network connectivity with the linkloop command

Tags: , , , , ,

26 Oct 09 HP-UX system update terminal session title bar

Nothing huge today.

I just wanted my HP-UX systems to udpate the title bar when Linux systems or Putty terminal sessions come in.

——–begin code——

NAME=”$(uname -n):${PWD}”
LEN=`echo “$NAME\c” | wc -c`
if [ “$TERM” = “xterm” ]
——–end code———–

Tested with Putty. Will test later today with Linux.

Tags: , , , ,

Supportscreen tag
WhatsApp chat