Blog O' Matty


Dissecting Clariion WWPNs

This article was posted by Matty on 2005-09-26 03:35:00 -0400 -0400

When zoning hosts (actually HBA ports) to EMC Clariion SP ports, it is often beneficial to know which Clariion SP and port a WWPN is associated with. You can easily determine this by taking the Clariion WWPN (50:06:10:60:10:F3:84 in the following example) and breaking it down into three pieces:

EMC identifier => 50:06:10
SP and Port # => :60:
WWN of the array => 10:F3:84

The fourth octet (e.g., 60 in this example) contains the port and service processor, which can be identified by comparing the value to the following chart:

60 - SPA port 0
61 - SPA port 1
62 - SPA port 2
63 - SPA port 3
68 - SPB port 0
69 - SPB port 1
6A - SPB port 2
6B - SPB port 3

So in the case of WWPN 50:06:10:60:10:F3:84, the value 60 would map to service process A, port 0. Hopefully this information will save someone a walk to their data center (walking is good exercise, so I probably shouldn’t have posted this). :)

Executing commands when the shell exits

This article was posted by Matty on 2005-09-26 00:52:00 -0400 -0400

While pruning some cruft from my .profile, I came across several important trap(1) statements that I had defined some time back. If you are unfamiliar with trap(1), this nifty little shell built-in allows the shell to setup signal handlers, which define a series of actions to take if a specific signal is received. The following trap statement will cause the script named ‘~/hi’ to be executed when the user logs out of the shell:

$ trap '~/hi' 0

$ cat hi

echo Howdy!
sleep 60

$ exit

logout
Howdy!
^C

The integer argument to trap(1) indicates the SIGNAL to trap (these are defined in /usr/include/sys/iso/signal_iso.h on Solaris systems), and 0 is a trap(1) constant that will invoke the action when the shell exits.

Emulex hbacmd utility

This article was posted by Matty on 2005-09-25 21:29:00 -0400 -0400

In my previous post on printing Emulex HBA statistics and resetting Emulex HBAs, I briefly touched on the hbacmd(1m) utility. hbacmd(1m) allows you to view configuration data and print numerous statistics, and is an invaluable resource for troubleshooting SAN problems. hbacmd(1m) lives in /usr/sbin/hbanyware, and provides a help screen when invoked with the “-h” (help) option:

$ hbacmd -h

Usage: hbacmd { h=IP Address or Hostname{:port} }
Valid Commands:

Version

ListHBAs

HBAAttrib

PortAttrib

PortStat

ServerAttrib

TargetMapping

Reset

Download

PersistentBinding
Source: {C L}
C: Configuration
L: Live

AllNodeInfo

SetPersistentBinding
Scope: {P I B}
P: Bind set Permanently
I: Bind set Immediately
B: Bind set Both Immediately and at Reboot
BindType: {D P N}
D: Enable binding by D_ID
P: Enable binding by WWPN
N: Enable binding by WWNN
Id: Either WWPN, WWNN, or D_ID (depending on BindType)

RemoveAllPersistentBinding

RemovePersistentBinding
BindType: {D P N}
D: Enable binding by D_ID
P: Enable binding by WWPN
N: Enable binding by WWNN
Id: Either WWPN, WWNN, or D_ID (depending on BindType)

BindingCapabilities

BindingSupport
Source: {C L}
C: Configuration
L: Live

SetBindingSupport
BindFlag: {D P N A DA PA NA}
D: Enable binding by D_ID
P: Enable binding by WWPN
N: Enable binding by WWNN
A: Enable binding by AUTOMAP
DA: Enable binding by D_ID and AUTOMAP
PA: Enable binding by WWPN and AUTOMAP
NA: Enable binding by WWNN and AUTOMAP

DriverParams

DriverParamsGlobal

SetDriverParam
CtrlWord: {P G B N}
P: Permanent
G: Global
B: Both
N: Neither

SetBootBios
CtrlWord: {E D}
E: Enable
D: Disable

To view all of the Emulex HBAs installed in a server, hbacmd(1m) can be invoked with the “listhbas” option:

$ hbacmd listhbas

Manageable HBA List

Port WWN : 10:00:00:00:c9:49:28:42
Node WWN : 20:00:00:00:c9:49:28:42
Fabric Name: 10:00:00:60:69:80:2d:ee
Flags : 8000f980
Host Name : server01
Mfg : Emulex Corporation

Port WWN : 10:00:00:00:c9:49:28:47
Node WWN : 20:00:00:00:c9:49:28:47
Fabric Name: 10:00:00:60:69:80:0e:fc
Flags : 8000f980
Host Name : fraudmgmt01
Mfg : Emulex Corporation

[ ..... ]

To list firmware versions, serial numbers, WWN and a variety of model specific information, the hbacmd(1m) utility can be invoked with the “hbaattrib” option and the WWN to probe:

$ hbacmd HBAAttrib 10:00:00:00:c9:49:28:47

HBA Attributes for 10:00:00:00:c9:49:28:47

Host Name : server01
Manufacturer : Emulex Corporation
Serial Number : MS51403247
Model : LP9802
Model Desc : Emulex LightPulse LP9802 2 Gigabit PCI Fibre Channel Adapter
Node WWN : 20 00 00 00 c9 49 28 47
Node Symname : Emulex LP9802 FV1.91A1 DV6.02f
HW Version : 2003806d
Opt ROM Version: 1.50a4
FW Version : 1.91A1 (H2D1.91A1)
Vender Spec ID : 80F9
Number of Ports: 1
Driver Name : lpfc
Device ID : F980
HBA Type : LP9802
Operational FW : SLI-2 Overlay
SLI1 FW : SLI-1 Overlay 1.91a1
SLI2 FW : SLI-2 Overlay 1.91a1
IEEE Address : 00 00 c9 49 28 47
Boot BIOS : Fcode Firmware1.50a4
Driver Version : 6.02f; HBAAPI(I) v2.0.e, 11-07-03

To view host port information (e.g., port speed, device paths) and fabric parameters (e.g., fabric ID (S_ID), # of ports zoned along with this port), hbacmd(1m) can be invoked with the “portattrib” option:

$ hbacmd PortAttrib 10:00:00:00:c9:49:28:47

Port Attributes for 10:00:00:00:c9:49:28:47

Node WWN : 20 00 00 00 c9 49 28 47
Port WWN : 10 00 00 00 c9 49 28 47
Port Symname :
Port FCID : 6D0900
Port Type : Fabric
Port State : Operational
Port Service Type : 6
Port Supported FC4 : 00 00 01 20 00 00 00 01
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Port Active FC4 : 00 00 01 20 00 00 00 01
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Port Supported Speed: 2 GBit/sec.
Port Speed : 2 GBit/sec.
Max Frame Size : 2048
OS Device Name : /devices/pci@84,2000/lpfc@1
Num Discovered Ports: 3
Fabric Name : 10 00 00 60 69 80 0e fc

In addition to providing super high performance HBAS, Emulex has done a great job with their CLI (their GUI is actually pretty good as well) management utilites!

New version of ldap-stats.pl (version 3.0)

This article was posted by Matty on 2005-09-25 18:52:00 -0400 -0400

I had been meaning to update ldap-stats.pl for quite some time, and finally got the updates completed this afternoon. The new version contains usage breakdowns by hour of day, day of month, and months in the year:

$ ldap-stats.pl /var/log/openldap openldap

Report Generated on Sun Sep 25 16:30:36 2005
--------------------------------------------
Processed "/var/log/openldap": Sep 18 00:29:35 - Sep 23 23:13:51
Processed "openldap1": Dec 26 19:20:50 - Dec 29 12:22:00
Processed "openldap2": Dec 26 19:20:50 - Dec 31 12:51:02
Processed "openldap3": Dec 26 19:20:50 - Dec 29 12:22:00


Operation totals
------------------
Total operations : 116424
Total connections : 22176
Total authentication failures : 0
Total binds : 15708
Total unbinds : 15708
Total searches : 85008
Total compares : 0
Total modifications : 0
Total modrdns : 0
Total additions : 0
Total deletions : 0
Unindexed attribute requests : 0
Operations per connection : 5.25



Hostname Connections Failures Binds Unbinds Searches Adds Mods ModRDNs Dels
------------- ----------- -------- ------ ------- -------- ---- ---- ------- ----
192.168.1.3 19404 0 12936 12936 82236 0 0 0 0
192.168.1.8 2772 0 2772 2772 2772 0 0 0 0



Hour of Day Connections Failures Binds Unbinds Searches Adds Mods ModRDNs Dels
------------- ----------- -------- ------ ------- -------- ---- ---- ------- ----
01:00 - 01:59 3696 0 3696 3696 3696 0 0 0 0
02:00 - 02:59 3696 0 3696 3696 3696 0 0 0 0
12:00 - 12:59 924 0 924 924 924 0 0 0 0
13:00 - 13:59 3696 0 3696 3696 3696 0 0 0 0
15:00 - 15:59 1848 0 1848 1848 1848 0 0 0 0
17:00 - 17:59 3696 0 0 0 55440 0 0 0 0
18:00 - 18:59 924 0 0 0 13860 0 0 0 0
21:00 - 21:59 924 0 924 924 924 0 0 0 0
23:00 - 23:59 2772 0 924 924 924 0 0 0 0


Day of Month Connections Failures Binds Unbinds Searches Adds Mods ModRDNs Dels
------------- ----------- -------- ------ ------- -------- ---- ---- ------- ----
18 8316 0 924 3696 72996 0 0 0 0
19 924 0 0 924 924 0 0 0 0
21 6468 0 0 6468 6468 0 0 0 0
22 3696 0 3696 3696 3696 0 0 0 0
23 2772 0 924 924 924 0 0 0 0


Month Connections Failures Binds Unbinds Searches Adds Mods ModRDNs Dels
------- ----------- -------- ------ ------- -------- ---- ---- ------- ----
Sep 22176 0 15708 15708 85008 0 0 0 0


Unindexed attribute References to attribute
------------------- -----------------------
sn 46
givenName 46


# Searches Search base referenced by # searches
---------- -----------------------------------------------------------
15708 ou=contacts,dc=synack,dc=com
9240 cn=operations,cn=monitor
4620 cn=add,cn=operations,cn=monitor
4620 cn=read,cn=waiters,cn=monitor
4620 cn=search,cn=operations,cn=monitor
4620 cn=compare,cn=operations,cn=monitor
4620 cn=modify,cn=operations,cn=monitor
4620 cn=bind,cn=operations,cn=monitor
4620 cn=delete,cn=operations,cn=monitor
4620 cn=write,cn=waiters,cn=monitor
4620 cn=total,cn=connections,cn=monitor
4620 cn=entries,cn=statistics,cn=monitor
4620 cn=referrals,cn=statistics,cn=monitor
4620 cn=bytes,cn=statistics,cn=monitor
4620 cn=unbind,cn=operations,cn=monitor


# Binds Bind DN
------- --------------------------------------------------------------
10164 anonymous
5544 cn=email,dc=synack,dc=com

The time breakdowns can be useful for finding bootleg cron jobs, and attempts to illegally access the directory server. Let me know if you find any problems!

Massaging data with fmt and sed

This article was posted by Matty on 2005-09-23 23:51:00 -0400 -0400

I had to cleanup a few documents today, and wanted to transform the text into an 80-column file with 4 spaces in the left margin. This was easily accomplished with the following shell pipeline:

$ cat messedup.txt | sed 's/^/ /' | fmt -80 > messedup.txt.new

I was lucky that the file had a basic form, since it minimized the number of items in my pipeline. :)