Tuesday, 7 October 2014

WebSphere Application Server - Auditing Ports

So one of the core tenets of Java development is to re-use, not re-invent.

I had a requirement to report on the various TCP/IP ports being used by members of my various WAS 8.0 and 8.5 cells.

Steve Robinson came to the rescue with this: -

import java
lineSeparator = java.lang.System.getProperty('line.separator')

# get Nodes
NodeIDs = AdminConfig.getid('/Node:/')
arrayNodeIDs = NodeIDs.split(lineSeparator)

# get Ports
EndPointIDs = AdminConfig.getid('/EndPoint:/')
arrayEndPointIDs = EndPointIDs.split(lineSeparator)
NamedEndPointIDs = AdminConfig.getid('/NamedEndPoint:/')
arrayNamedEndPointIDs = NamedEndPointIDs.split(lineSeparator)

# print
for x in range(len(arrayNodeIDs)):
        for y in range(len(arrayEndPointIDs)):
                if arrayEndPointIDs[y].find(AdminConfig.showAttribute(arrayNodeIDs[x],'name')) > 0:
                        print AdminConfig.showAttribute(arrayNodeIDs[x],'name'),AdminConfig.showAttribute(arrayNamedEndPointIDs[y],'endPointName'),AdminConfig.showAttribute(arrayEndPointIDs[y],'port')

No comments:

Yay, VMware Fusion and macOS Big Sur - no longer "NAT good friends" - forgive the double negative and the terrible pun ...

After macOS 11 Big Sur was released in 2020, VMware updated their Fusion product to v12 and, sadly, managed to break Network Address Trans...