Archive
Machinfo on PA-RISC systems
When the HP-UX Itanium version was released it came with a very handy tool named machinfo. This command prints number and type of CPUs, amount of memory, firmware revision, serial number, machine id and many more useful information about the server. Sadly on PA-RISC we didn’t have something similar, of course there is print_manifest and I have to say that it’s quite a tool but I always loved the simplicity of machinfo.
Dozens of posts have been thrown throughout the years on ITRC Forums asking for a PA-RISC machinfo version and many workarounds and even some binaries have been posted.
I tried a lot of them but since I discovered Patrick Reut‘s version a couple of years ago I never used another one. It works on 11.11 and 11.23 systems, I tried on 10.20 but didn’t wok. The binary can found in this post as an attachment.
Here it an example output of the command:
root@tst1:/# which machinfo /usr/contrib/bin/machinfo root@tst1:/# ll /usr/contrib/bin/machinfo lrwx------ 1 root sys 34 Feb 17 10:15 /usr/contrib/bin/machinfo@ -> /usr/local/scripts/parisc_machinfo root@tst1:/# root@tst1:/# machinfo OS info: sysname = HP-UX nodename = sigtst1 release = B.11.23 version = U machine = 9000/800 idnumber = 11111111111 Platform info: model string = "9000/800/rp7420" machine id number = XXXXXXXXXXXXXX machine serial number = DEHxxxxxxxx CPU info Number of CPUs = 4 Clock speed = 1000 MHz processor family: 532 pa-2.0 processor model: 20 PA8900 Firmware info: Firmware revision = 22.2 Memory = 8165 MB (7 GB) Disk info: c0t6d0 : HP 146 GMA (size = 146GB) c0t5d0 : HP 146 GMA (size = 146GB) c45t0d1 : HP HS (size = 118GB) c45t0d4 : HP HS (size = 118GB) c45t0d5 : HP HS (size = 118GB) c45t0d7 : HP HS (size = 15GB) c45t1d0 : HP HS (size = 15GB) c47t0d1 : HP HS (size = 118GB) c47t0d4 : HP HS (size = 118GB) c47t0d5 : HP HS (size = 118GB) c47t0d7 : HP HS (size = 15GB) c47t1d0 : HP HS (size = 15GB) root@tst1:/#
Juanma.
Linux LVM commands in HP-UX
Some of the features I always liked about the Linux LVM2 implementation are the lvs, vgs and pvs command. with this simple commands a short list of the LVs, VGs and PVs active on the system can be obtained.
www04:~ # vgs VG #PV #LV #SN Attr VSize VFree vgwww01 1 6 0 wz--n- 39.75G 6.25G vgbbdd 3 3 0 wz--n- 94.25G 0 vgsys 1 6 0 wz--n- 34.74G 1.25G www04:~ #
In HP-UX there is nothing similar available, well since HP-UX 11.31 and LVM2 a “-F” option has been added to produce a formated, more script friendly list but is not very “human readable”.
[root@nfscl02] ~ # vgdisplay -vF vg00 vg_name=/dev/vg00:vg_write_access=read,write:vg_status=available:max_lv=255:cur_lv=9:open_lv=9:max_pv=16:cur_pv=1:act_pv=1:max_pe_per_pv=4353:vgda=2:pe_size=32:total_pe=4322:alloc_pe=1539:free_pe=2783:total_pvg=0:total_spare_pvs=0:total_spare_pvs_in_use=0:vg_version=1.0:vg_max_size=2228736m:vg_max_extents=69648 lv_name=/dev/vg00/lvol1:lv_status=available,syncd:lv_size=1856:current_le=58:allocated_pe=58:used_pv=1 lv_name=/dev/vg00/lvol2:lv_status=available,syncd:lv_size=8192:current_le=256:allocated_pe=256:used_pv=1 lv_name=/dev/vg00/lvol3:lv_status=available,syncd:lv_size=1504:current_le=47:allocated_pe=47:used_pv=1 lv_name=/dev/vg00/lvol4:lv_status=available,syncd:lv_size=512:current_le=16:allocated_pe=16:used_pv=1 lv_name=/dev/vg00/lvol5:lv_status=available,syncd:lv_size=8192:current_le=256:allocated_pe=256:used_pv=1 lv_name=/dev/vg00/lvol6:lv_status=available,syncd:lv_size=5024:current_le=157:allocated_pe=157:used_pv=1 lv_name=/dev/vg00/lvol7:lv_status=available,syncd:lv_size=5024:current_le=157:allocated_pe=157:used_pv=1 lv_name=/dev/vg00/lvol8:lv_status=available,syncd:lv_size=8704:current_le=272:allocated_pe=272:used_pv=1 lv_name=/dev/vg00/lv_crash:lv_status=available,syncd:lv_size=10240:current_le=320:allocated_pe=320:used_pv=1 pv_name=/dev/disk/disk1_p2:pv_status=available:total_pe=4322:free_pe=2783:autoswitch=On:proactive_polling=On [root@nfscl02] ~ #
Because of this I decided to write three scripts to emulate the behavior of vgs, lvs and pvs on my HP-UX servers. This scripts take advantage of the mentioned LVM2 “-F” switch so they will not work on HP-UX 11.23 or any other previous versions. If anyones recognize the “scripting” style is because I grab some parts of the code from Olivier’s ioscan_fc2.sh and adapted them to my needs so credit goes to him also :-)
- VGS: List the volume group on the /etc/lvmtab file, if the server is part of a cluster the volume groups active on other nodes will be showed as deactivated. With the “-v” switch single VGs can be queried.
root@cldpp01:~# ./vgs.sh VG PVs LVs Status Version VGSize Free vg00 1 9 available 1.0 135G 77G vgdpp 1 1 available,exclusive 1.0 49G 0G vgidbbck deactivated root@cldpp01:~# ./vgs.sh -v vgdpp VG PVs LVs Status Version VGSize Free vgdpp 1 1 available,exclusive 1.0 49G 0G root@cldpp01:~#
The code:
#!/sbin/sh
#
# vgs.sh - script to emulate the Linux LVM command vgs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "VGS for HP-UX ${version}"
echo
echo "Usage: vgs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "VGS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
vg_display="vgdisplay -F"
[ ! "${vg_name}" = "" ] && vg_display="vgdisplay -F ${vg_name}"
printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" VG PVs LVs Status Version VGSize Free
eval ${vg_display} | while IFS=":" read vgdisplay
do
echo ${vgdisplay} | cut -d ":" -f 2 | cut -d "=" -f 2 | read status
if [ "${status}" = "deactivated" ]
then
status=deactivated
vg_size=""
vg_free=""
else
echo ${vgdisplay} | cut -d ":" -f 3 | cut -d "=" -f 2 | read status
echo ${vgdisplay} | cut -d ":" -f 13 | cut -d "=" -f 2 | read total_pe
echo ${vgdisplay} | cut -d ":" -f 12 | cut -d "=" -f 2 | read pe_size
echo ${vgdisplay} | cut -d ":" -f 15 | cut -d "=" -f 2 | read free_pe
vg_size="`/usr/bin/expr $total_pe \* $pe_size / 1024`G"
vg_free="`/usr/bin/expr $free_pe \* $pe_size / 1024`G"
fi
echo ${vgdisplay} | cut -d ":" -f 1 | cut -d "=" -f 2 | cut -d "/" -f 3 | read vg_name
echo ${vgdisplay} | cut -d ":" -f 8 | cut -d "=" -f 2 | read pvs
echo ${vgdisplay} | cut -d ":" -f 5 | cut -d "=" -f 2 | read lvs
echo ${vgdisplay} | cut -d ":" -f 19 | cut -d "=" -f 2 | read version
printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" "${vg_name}" "${pvs}" "${lvs}" "${status}" "${version}" "${vg_size}" "${vg_free}"
done
- LVS: Like its Linux counterpart shows a list with every active logical volume. As in vgs with the -v switch you can ask the list of a specific volume group.
root@asoka:/# ./lvs.sh -v vg00 LV VG Status LVSize Permissions Mirrors Stripes Allocation lvol1 vg00 available,syncd 1G read,write 0 0 strict,contiguous lvol2 vg00 available,syncd 8G read,write 0 0 strict,contiguous lvol3 vg00 available,syncd 1G read,write 0 0 strict,contiguous lvol4 vg00 available,syncd 0G read,write 0 0 strict lvol5 vg00 available,syncd 20G read,write 0 0 strict lvol6 vg00 available,syncd 1G read,write 0 0 strict lvol7 vg00 available,syncd 5G read,write 0 0 strict lvol8 vg00 available,syncd 20G read,write 0 0 strict lv_crash vg00 available,syncd 9G read,write 0 0 strict root@asoka:/#
The code:
#!/sbin/sh
#
# lvs.sh - script to emulate the Linux LVM command lvs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "LVS for HP-UX ${version}"
echo
echo "Usage: lvs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "LVS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
lv_list="vgdisplay -vF | grep lv_name"
[ ! "${vg_name}" = "" ] && lv_list="vgdisplay -vF ${vg_name} | grep lv_name"
printf "%-30s %-12s %-17s %-6s %-10s %-7s %-8s %-8s %-7s\n" LV VG Status LVSize Permissions Mirrors Stripes Allocation
eval ${lv_list} | while IFS=":" read lvlist
do
echo ${lvlist} | cut -d ":" -f 1 | cut -d "/" -f 4 | read lv_name
echo ${lvlist} | cut -d ":" -f 1 | cut -d "=" -f 2 | read lv_long_name
lvdisplay -F ${lv_long_name} | cut -d ":" -f 2 | cut -d "/" -f 3 | read vg_name
lvdisplay -F ${lv_long_name} | cut -d ":" -f 4 | cut -d "=" -f 2 | read lv_status
lvdisplay -F ${lv_long_name} | cut -d ":" -f 3 | cut -d "=" -f 2 | read lv_perm
lvdisplay -F ${lv_long_name} | cut -d ":" -f 5 | cut -d "=" -f 2 | read lv_mirrors
lvdisplay -F ${lv_long_name} | cut -d ":" -f 11 | cut -d "=" -f 2 | read lv_stripes
lvdisplay -F ${lv_long_name} | cut -d ":" -f 14 | cut -d "=" -f 2 | read lv_allocation
lvdisplay -F ${lv_long_name} | cut -d ":" -f 8 | cut -d "=" -f 2 | read size_megs
lv_size="`/usr/bin/expr $size_megs / 1024`G"
printf "%-30s %-12s %-17s %-6s %-17s %-7s %-2s %-5s\n" "${lv_name}" "${vg_name}" "${lv_status}" "${lv_size}" "${lv_perm}" "${lv_mirrors}" "${lv_stripes}" "${lv_allocation}"
done
- PVS: And now the last one. List the activated physical volumes, if a VGs is not active on the current node its PVs wouldn’t be shown. Like in pvs and vgs there is a “-v” switch.
root@oracle:~# ./pvs.sh PV VG Status PVSize Free /dev/disk/disk1_p2 vg00 available 135G 48G /dev/disk/disk28 vgora available 1G 0G /dev/disk/disk29 vgora available 5G 0G /dev/disk/disk30 vgora available 3G 0G /dev/disk/disk31 vgora available 51G 1G /dev/disk/disk32 vgora available 1G 0G /dev/disk/disk37 vgora available 3G 0G /dev/disk/disk38 vgora available 6G 0G /dev/disk/disk43 vgoracli available 3G 0G /dev/disk/disk119 vgoracli available 2G 0G root@oracle:~#
And the code:
#!/sbin/sh
#
# pvs.sh - script to emulate the Linux LVM command pvs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "PVS for HP-UX ${version}"
echo
echo "Usage: pvs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "PVS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
pv_list="vgdisplay -vF | grep disk"
[ ! "${vg_name}" = "" ] && pv_list="vgdisplay -vF ${vg_name} | grep disk"
printf "%-20s %-10s %-20s %-6s %-5s\n" PV VG Status PVSize Free
eval ${pv_list} | while IFS=":" read pvlist
do
echo ${pvlist} | cut -d ":" -f 1 | cut -d "=" -f 2 | read pv_name
pvdisplay -F ${pv_name} | cut -d ":" -f 2 | cut -d "=" -f 2 | cut -d "/" -f 3 | read vg_name
pvdisplay -F ${pv_name} | cut -d ":" -f 3 | cut -d "=" -f 2 | read status
pvdisplay -F ${pv_name} | cut -d ":" -f 8 | cut -d "=" -f 2 | read total_pe
pvdisplay -F ${pv_name} | cut -d ":" -f 7 | cut -d "=" -f 2 | read pe_size
pvdisplay -F ${pv_name} | cut -d ":" -f 9 | cut -d "=" -f 2 | read free_pe
pv_size="`/usr/bin/expr $total_pe \* $pe_size / 1024`G"
pv_free="`/usr/bin/expr $free_pe \* $pe_size / 1024`G"
printf "%-20s %-10s %-20s %-6s %-5s\n" "${pv_name}" "${vg_name}" "${status}" "${pv_size}" "${pv_free}"
done
As always any comments, corrections and/or suggestions are welcome.
Juanma.
Playing with lanadmin & lanscan
Current release of HP-UX, 11.31, has the handy nwmgr to handle networking tasks, but for years instead of nwmgr we’ve been playing with lanscan and lanadmin (linkloop as well) to perform many networking tasks on the 11.23 release and previous ones. And surely some of you, just like myself, still have 11iv2 systems up and running. Following is a small list of tips and tasks for lanadmin from one of my “how-to-do” files.
- Lanscan: Basically is used to get information about the LAN interfaces.
root@sap01:~# lanscan Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI Path Address In# State NamePPA ID Type Support Mjr# 0/0/0/1/0 0x001A4B07F002 0 UP lan0 snap0 1 ETHER Yes 119 0/0/0/1/1 0x001A4B07F003 1 UP lan1 snap1 2 ETHER Yes 119 0/0/1/1/0 0x0018FE2D7EE7 2 UP lan2 snap2 3 ETHER Yes 119 0/0/9/1/0 0x0018FE2D7EF4 3 UP lan3 snap3 4 ETHER Yes 119 0/0/10/1/0 0x000CFC0046B9 4 UP lan4 snap4 5 ETHER Yes 119 0/0/12/1/0 0x000CFC004672 5 UP lan5 snap5 6 ETHER Yes 119 LinkAgg0 0x000000000000 900 DOWN lan900 snap900 9 ETHER Yes 119 LinkAgg1 0x000000000000 901 DOWN lan901 snap901 10 ETHER Yes 119 LinkAgg2 0x000000000000 902 DOWN lan902 snap902 11 ETHER Yes 119 LinkAgg3 0x000000000000 903 DOWN lan903 snap903 12 ETHER Yes 119 LinkAgg4 0x000000000000 904 DOWN lan904 snap904 13 ETHER Yes 119 root@sap01:~#
A verbose version can be obtained with the -v switch, but for me this switch has a glitch since you can’t query for a single LAN card:
root@sap01:~# lanscan -v ------------------------------------------------------------------------------- Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI Path Address In# State NamePPA ID Type Support Mjr# 0/0/0/1/0 0x001A4B07F002 0 UP lan0 snap0 1 ETHER Yes 119 Extended Station LLC Encapsulation Address Methods 0x001A4B07F002 IEEE HPEXTIEEE SNAP ETHER NOVELL Driver Specific Information iether ------------------------------------------------------------------------------- ... root@sap01:~#
There are other options for lanscan that can be used to obtain more simple info in a “script friendly” list format:
root@sap01:~# lanscan -a 0x001A4B07F002 0x001A4B07F003 0x0018FE2D7EE7 0x0018FE2D7EF4 0x000CFC0046B9 0x000CFC004672 0x000000000000 0x000000000000 0x000000000000 0x000000000000 0x000000000000 root@sap01:~# lanscan -i lan0 snap0 lan1 snap1 lan2 snap2 lan3 snap3 lan4 snap4 lan5 snap5 lan900 snap900 lan901 snap901 lan902 snap902 lan903 snap903 lan904 snap904 root@sap01:~#
- Lanadmin: The lanadmin, acording to its man page, allow you to:
+ Display and change the station address.
+ Display and change the 802.5 Source Routing options (RIF).
+ Display and change the maximum transmission unit (MTU).
+ Display and change the speed setting.
+ Clear the network statistics registers to zero.
+ Display the interface statistics.
+ Display the interface usage information.
+ Reset the interface card, thus executing its self-test.
+ Configure VLANs on the cards that support VLAN.
It can be used in two ways, if invoked with no options from the shell it will present a menu style interface where different tasks can be performed. Following is am example to illustrate.
LOCAL AREA NETWORK ONLINE ADMINISTRATION, Version 1.0
Tue , Feb 9,2010 14:22:27
Copyright 1994 Hewlett Packard Company.
All rights are reserved.
Test Selection mode.
lan = LAN Interface Administration
menu = Display this menu
quit = Terminate the Administration
terse = Do not display command menu
verbose = Display command menu
Enter command: lan
LAN Interface test mode. LAN Interface PPA Number = 0
clear = Clear statistics registers
display = Display LAN Interface status and statistics registers
end = End LAN Interface Administration, return to Test Selection
menu = Display this menu
ppa = PPA Number of the LAN Interface
quit = Terminate the Administration, return to shell
reset = Reset LAN Interface to execute its selftest
specific = Go to Driver specific menu
Enter command: display
LAN INTERFACE STATUS DISPLAY
Tue , Feb 9,2010 14:22:31
PPA Number = 0
Description = lan0 HP PCI Core I/O 1000Base-T Release B.11.23.0712.01
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 1000000000
Station Address = 0x14c2650091
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 419
Inbound Octets = 120454615
Inbound Unicast Packets = 863761
Inbound Non-Unicast Packets = 4327
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 12
Outbound Octets = 145033817
Outbound Unicast Packets = 1285500
Outbound Non-Unicast Packets = 221
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Press to continue
Ethernet-like Statistics Group
Index = 1
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 0
Multiple Collision Frames = 0
Deferred Transmissions = 0
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0
LAN Interface test mode. LAN Interface PPA Number = 0
clear = Clear statistics registers
display = Display LAN Interface status and statistics registers
end = End LAN Interface Administration, return to Test Selection
menu = Display this menu
ppa = PPA Number of the LAN Interface
quit = Terminate the Administration, return to shell
reset = Reset LAN Interface to execute its selftest
specific = Go to Driver specific menu
Enter command:
When used with options from the command line lanadmin can perform the same tasks as as in the menu interface on each LAN card. Here are some of the most common features I’ve been using for years:
· Display interface info:
root@sap01:~# lanadmin -x card_info 1 *********** Version Information ********** Driver version: B.11.23.0712 Firmware version: N/A Chip version: 0x3 PCI Sub-System ID: 0x12a6 PCI Sub-Vendor ID: 0x103c Board Revision: D4503807 Software Key: 0 Engineering Date Code: A-4731 ********** Card Setting *********** Driver State: IETHER_ONLINE Auto Negotiation: On Flow Control: On Send Max Buf Descriptors: 1 Recv Max Buf Descriptors: 1 Send Coalesced Ticks: 150 Recv Coalesced Ticks: 0 root@sap01:~#
· Display Auto-Port Aggregation status:
root@sap01:~# lanadmin -x -v 900 Link Aggregate PPA # : 900 Number of Ports : 2 Ports PPA : 0 1 Link Aggregation State : LINKAGG MANUAL Load Balance Mode : Hot Standby (LB_HOT_STANDBY) root@sap01:~#
· Show speed settings:
root@sap01:/# lanadmin -x 1 Speed = 1000 Full-Duplex. Autonegotiation = On. root@sap01:/#
· Creating an Aggregation link:
roo@sap01:/# lanadmin -X -a 1 2 900
· Show load balancing algorithm in APA:
root@sap02:/etc# lanadmin -x -l 900 Load Balancing = Hot Standby (LB_HOT_STANDBY) root@sap02:/etc#
· Display MAC address:
root@sap01:~# lanadmin -a 1 Station Address = 0x001a4b07f003 root@sap01:~#
· Display driver and adapter statistics:
root@sap01:/# lanadmin -x stats drv 1 ****** Driver Statistics ****** In Packet Error 0 Out Packet Error 0 Loopback packets 44 Link Down events 0 ****** Host Command Statistics ****** nicCmdsDelMCastAddr 0 nicCmdsSetMACAddr 0 nicCmdsSetPromiscMode 0 nicCmdsSetMulticastMode 0 nicCmdsClearStats 1 ****** NIC Events Statistics ****** nicEventsFirmwareOperational 0 nicEventsStatsUpdated 0 nicEventsLinkStateChanged 1 nicEventsMCastListUpdated 0 ****** Interface Statistics ****** ifIndex 2 ifType 6 ifMtu 1500 ifSpeed 1000000000 ifAdminStatus 1 ifOperStatus 1 ifLastChange 36 ifInDiscards 0 ifInErrors 0 ifInUnknownProtos 87777 ifOutDiscards 0 ifOutErrors 0 ifOutQLen 0 ifInOctets_low 1205643914 ifInOctets_high 0 ifInUcastPkts_low 8695826 ifInUcastPkts_high 0 ifInMulticastPkts_low 0 ifInMulticastPkts_high 0 ifInBroadcastPkts_low 87777 ifInBroadcastPkts_high 0 ifOutOctets_low 1200310422 ifOutOctets_high 0 ifOutUcastPkts_low 8696015 ifOutUcastPkts_high 0 ifOutMulticastPkts_low 0 ifOutMulticastPkts_high 0 ifOutBroadcastPkts_low 0 ifOutBroadcastPkts_high 0 root@sap01:/#
· Show Vital Product Data, a really funny name ;-) don’t you think?
root@sap01:/# lanadmin -x vpd 0 *********** Vital Product Data ********** Product Description: PCI/PCI-X 10/100/1000BT Dual Ethernet Adapter Part Number: A7012-60601 Engineering Date Code: A-4731 Part Serial Number: 001A4B07F002 Misc. Information: 7.5W Mfd. Date: 4749 Checksum: 0xb EFI Version: 03048 ROM Firmware Version: N/A Asset Tag: N/A root@sap01:/#
· Show card type:
root@sap01:~# lanadmin -x type 1 1000Base-T root@sap01:~#
And we are finished. Probably I’m forgetting a more interesting uses of lanadmin if you have other everyday use please comment :-)
Juanma.
SSH foolishness
Today it’s been one of those days that you wish to hide very deep under your desk.
For a couple of days I’ve been battling with a 11.31 server over its sshd configuration, somehow this was the only node which refused the public-key ssh authentication method from my management server and always asked for root password, that means I could’t run scripts remotely with a convenient for loop over the sever list, no remote tests, no cron tasks from the management node against it, etc; and that’s unacceptable for me.
I almost wiped out the config of the target server and recreated it from scratch using the sshd_config file of a working 11.31 node as my starting point and still the damn server asked for a password. I was desperate, looking through the config file one time after another, checked file permissions, running the same test from other servers with same result.
Finally I ask a colleague if he could review my sshd_config file, at first look he found nothing wrong and then he performed some test and MAGIC!! it worked. I asked him about his “guru trick” and he said ‘Dude, your root home had 777 permissions’ ‘WHAT?!?!?!?’
I was terribly embarrassed, one of the first tasks I do after install any HP-UX is to move the root home from / to /root and in this almost newly deployed 11.31 I didn’t change the permissions. Of course I quickly checked all my servers just in case and fortunately for me none of them had a misconfigured sshd.
Two days completely lost finghting against my foolishness, got out of bed on the wrong side this morning.
Oh I almost forgot… thanks Javi, you’re the best :-)
Juanma.
Open Source software and HP-UX
HP-UX is a great OS and the default installation provides a plethora of tools for any Unix sysadmin but of course, like almost every operative system, it can improved with third-party opensource software
This is a short list of the packages I can’t live without, all of them can be obtained at the Porting And Archive Centre for HP-UX or the HP-UX 11i Internet Express collection. The packages included in the Internet Express collection are fully supported and tested by HP.
- Bash shell. The best Unix shell, at least for me, powerful and highly customizable.
- GNU coreutils. Provides with GNU version of many Unix commands, what can I say? I like the GNU ls colored output x-)
- Lsof. How can any sysadmin live without lsof?
- Sudo. Indispensable to allow scripts or users run certain commands as root or any other user.
- Unzip. It’s not that I use it but every time I set up a new server to run Oracle the database people ask for it so I got used to install it.
- Tcpdump. Don’t install it by default on my servers but I like to have the depot around, just in case.
- Tusc. God bless Chris Bertin!
- Vim. Not on my production servers but I like to have VI Improved installed on my management node, usually the Ignite-UX server, where I store all my scripts and with ssh (public key authentication) access to all the nodes.
Of course all of them have dependencies that have to be met, however with the exception of vim, which have tons of them, there aren’t too much.
And that’s all folks, which opensource package do you use in your HP-UX boxes? Please comment :-)
Juanma.
UNIX95 and ps command
UNIX95 is a Unix standard defined in the Single UNIX Specification. HP-UX 11i is registered as UNIX95 compliant in its v1 and v2 versions and as UNIX03 (a more modern version) the v3.
This standard affect commands and syscalls in various ways and it is not set by default. To “activate” this mode the UNIX95 environment variable must be declared, it is not recommendable to set the variable through the root profile or /etc/profile. The best way to use the features provided by the UNIX95 standard is to temporally set the variable just before execute a command in the shell.
Currently I only use this mode with the ps command. This command has some options that can only be used if the UNIX95 variable is declared. I have a couple of alias in my profile to take advantage of this options.
- With this command you can get a sort of equivalent of the Solaris ptree command.
root@asoka:/# alias ptree alias ptree='UNIX95=1 ps -eHf'
- Get the top 15 CPU consuming processes:
root@asoka:/# alias pcpu alias pcpu='UNIX95=1 ps -ef -o pcpu,user,pid,args | /bin/sort -u -r | sed -e '\''s/\.[0-9][0-9]/&\%/g'\'' | sed -n 1,15p' root@asoka:/# pcpu 0.83% root 10520 /opt/wbem/lbin/cimprovagt 0 5 10 root SFMProviderModule 0.51% hpsmh 10434 /opt/hpws/apache/bin/httpd -k start -DSSL -f /opt/hpsmh/conf/smhpd.conf 0.45% root 53 vxfsd 0.42% cimsrvr 10518 cimservermain --executor-socket 5 0.16% root 1904 vxsvc -r /opt/VRTSob/config/Registry -e 0.13% root 552 /usr/sbin/utmpd 0.12% root 1468 /opt/dce/sbin/rpcd 0.11% root 39 schedcpu 0.10% root 10523 /opt/wbem/lbin/cimprovagt 0 5 10 root HPUXFCIndicationProviderModule 0.10% root 1707 /usr/sbin/swagentd -r 0.07% root 26676 sshd: root@pts/1 0.06% root 10525 /opt/wbem/lbin/cimprovagt 0 5 10 root HPUXLANIndicationProviderModule 0.06% root 2296 /usr/sbin/stm/uut/bin/tools/monitor/WbemWrapperMonitor 0.06% root 1028 /usr/sbin/automountd 0.06% root 21 ksyncer_daemon root@asoka:/#
There are more options for ps and for other commands, just investigate a bit in the man pages.
Juanma.


