Skip to main content

A10 Load Balancer Service Group VIP, Virtual Servers, End / Real Host IPs and Status Report

  • 2 September 2024
  • 0 replies
  • 19 views

A common debugging method for A10 Load Balancers is the command “show slb virtual-server bind”.  This command enumerates the Virtual Server, its IP Address, the VIP Port,  the End / Real Host IP Address and State.  

Let’s create a Custom Command for the A10 ACOS type devices to run “show slb virtual-server bind” and then add to the output of this report where the End / Real Host is connected and if the Host IP is indeed in the Forward Networks Inventory.  

For the Violation, if the Host IP is not in the Inventory, set a flag of false.  

Note that this is a third in a series of A10 Load Balancer NQEs.  The two posted prior do not rely upon Custom Commands.
 

 

The simple method of blockMatches is used.  It’s a bit tricky to get the match string syntax correct at first.  Why shouldn’t the string be parsed post match, for example.  In other words, remove the colons, commas, and other characters post blockMatches matching.   The A10 output strings like to have colons next to the output string.  How about the the “====>” followed by the Service Group value.  This must have been someone playing around with ASCII text for fun instead of just using another colon.  Or, maybe to bring attention to this particular value.
 

Filtering by A10 Device, Host Status, or otherwise is now easy.   

Another benefit of using a Custom Command is that the outputs are analyzed during Diff processing. This screen shot ran the Customer Command once.  Therefore there is no Diff output until another Snapshot is run.  One can then easily compare the output of “show slb virtual-server bind” between two Snapshots.

 



There are commented Select values for debugging.  

/**
* @intent Enumerate the A10 SLB End Host Status with Customer Command "show slb virtual-server bind"
* @description Parse the output of A10 Custom Command "show slb virtual-server bind" to show the VIPs, Reals, and Status.
*/

/* Example Pattern to Match
Command: show slb virtual-server bind
Total Number of Virtual Services configured: 30
---------------------------------------------------------------------------------
*Virtual Server :virtualsvr1 10.10.10.100 Disb

+port 443 tcp ====>slb_svc_group1 State :Down
+server1:443 10.10.10.5 State :Down
+server2:443 10.10.10.6 State :Down
*/

pattern1 = ```
*Virtual Server {virtSvr:string} {virtIP:string } {virtStatus:(string *)}
+port {virtPort:string} tcp {svcGroup:string} State {svcGroupStatus:(string *)}
{host:string} {hostIP:string} State {hostState:string}
```;

// Routine to look up the Host Values for Enumeration.
checkHostIP(device)=
// foreach device in network.devices
foreach host in device.hosts
where isPresent(host.macAddress)
select {
deviceName: device.name,
physicalName: device.system.physicalName,
address: host.addresses,
addrStr: toString(host.addresses),
macAddress: host.macAddress,
vendor:ouiAssignee(host.macAddress),
interfaces: host.interfaces,
hostType: host.hostType,
}
;
// ***** MAIN FUNCTION *****
foreach device in network.devices
where device.platform.vendor == Vendor.A10
let outputs = device.outputs
foreach command in outputs.commands
where command.commandType == CommandType.CUSTOM
where command.commandText == "show slb virtual-server bind"
let rawDataResponse = command.response
let configurations = parseConfigBlocks(OS.ACOS, command.response)
foreach slb_block in blockMatches(configurations, pattern1)
let serviceIPStr = toString(slb_block.data.hostIP)
let serviceIPStr = serviceIPStr + "/32"
let serviceIPaddr = ipSubnet(serviceIPStr)
let ipHost = max(foreach record in checkHostIP(device)
where serviceIPaddr in record?.address
select record )

//
select {
violation: !isPresent(ipHost?.address),
deviceName: device.name,
// commandType: command.commandType,
// output: rawDataResponse,
virtSvr: replace(slb_block.data.virtSvr, ":", ""),
virtIP: slb_block.data.virtIP,
virtPort: slb_block.data.virtPort,
virtStatus: replace(replace(replace(toString(slb_block.data.virtStatus), "c", ""), "]", ""), ", ", " "),
svcGroup: replace(slb_block.data.svcGroup, "====>", ""),
svcGroupStatus: replace(replace(replace(replace(toString(slb_block.data.svcGroupStatus), "e", ""), "]", ""), ", ", " "), ":", ""),
host: replace(slb_block.data.host, "+", ""),
hostIP: slb_block.data.hostIP,
hostState: replace(slb_block.data.hostState, ":", ""),
// Host Inventory Values
// recordAdd: ipHost?.address,
// addrStr: ipHost?.addrStr,
hostMAC: ipHost?.macAddress,
hostConn: ipHost?.physicalName,
hostInt: ipHost?.interfaces,
hostVendor: ipHost?.vendor,
}

 

Column Headers in case you are not familiar with the Select statement.

 

 

What additional output is desired for debugging A10 Load Balancers?  Feel free to post a reply in this Community post.  NQE helps you to save time and pull analytics together.   
 

Be the first to reply!

Reply