Skip to main content
Question

how can i get the F5 POOL Member name ip and state and availability

  • October 11, 2024
  • 13 replies
  • 219 views

Forum|alt.badge.img+2

how can i get the F5 POOL Member name ip and state and availability ?

13 replies

Forum|alt.badge.img+2
  • Employee
  • 56 replies
  • October 11, 2024

@Rohit_809 Kumar Have you seen this post?

 


Forum|alt.badge.img+2
  • Author
  • Spotter
  • 42 replies
  • October 11, 2024

@GaryB i checked this one , but its not fulfill my requirement,

 

i need availability state output in separate  coloum.

 

Like 1st Coloum - Device name 
         2nd Coloum - Pool name 

        3rd Coloum -Pool Member 

        4rd Coloum - State 

 

     5th Coloum - Avalibility


Forum|alt.badge.img+2
  • Employee
  • 56 replies
  • October 11, 2024

@Rohit_809 Kumar These are just examples you can use to tailor to your own requirements. 

Would it be more useful to share your approach by adding your query, and we can assist you with your understanding to satisfy your needs?


Forum|alt.badge.img+2
  • Author
  • Spotter
  • 42 replies
  • October 11, 2024

i tried  but not getting result as i want , if you help me that would be great !!

 


Forum|alt.badge.img+2
  • Employee
  • 56 replies
  • October 11, 2024

@Rohit_809 Kumar Absolutely, Happy to help, can you share what you have so far please, that helps us all learn?

But to get you a little across the finish line.

 

/**
* @intent Parse out F5 Pools and Members
* @description Report on all F5 Pools and their members
*/

pattern =
```
Ltm::Pool: {pool:string}
Connection Queue
Average queue entry age (ms)
Ltm::Pool Member: {poolmember:string}
Status
Availability : {availability:string}
State : {state:string}
```;

// This is used to clean some of the characters so we can parse effectively
cleanMembers(config) = replace(cleanCharacters(config), "|", "");

cleanCharacters(config) = replace(config, "-", "");

foreach device in network.devices
where device.platform.vendor == Vendor.F5
let outputs = device.outputs
foreach command in outputs.commands
where command.commandType == CommandType.F5_LTM_POOL_STATE
let modified = cleanMembers(command.response)
let configlines = parseConfigBlocks(OS.UNKNOWN, modified)
let matches = blockMatches(configlines, pattern)
foreach match in matches
let data = match.data
select {
deviceName: device.name,
Pool: data.pool,
PoolMember: data.poolmember,
Availability: data.availability,
State: data.state
}

 


Forum|alt.badge.img+2
  • Author
  • Spotter
  • 42 replies
  • October 11, 2024

this is looks good , but i am not sure what is the issue i am getting appprox 2m record against only 2 devices , mens getting outut only with 2 device


Forum|alt.badge.img+2
  • Employee
  • 56 replies
  • October 11, 2024

@Rohit_809 Kumar Can you share your NQE query?


Forum|alt.badge.img
  • Employee
  • 24 replies
  • October 14, 2024

Hi Rohit,

can you try following NQE? 

 

pattern = ```
Ltm::Pool: {pool: string}
Connection Queue
Average queue entry age (ms)
Ltm::Pool Member: {poolmember: string}
Status
Availability : {poolmemberavailability: string}
State : {poolmemberstate: string}
IP Address : {poolmemberIP: string}

```;

// This is used to clean some of the characters so we can parse effectively
cleanMembers(config) = replace(cleanCharacters(config), "|", "");
cleanCharacters(config) = replace(config, "-", "");

foreach device in network.devices
where device.platform.vendor == Vendor.F5
let outputs = device.outputs
foreach command in outputs.commands
where command.commandType == CommandType.F5_LTM_POOL_STATE
let modified = cleanMembers(command.response)
let configlines = parseConfigBlocks(OS.UNKNOWN, modified)
let matches = blockMatches(configlines, pattern)
foreach match in matches

select {
deviceName: device.name,
Pool: match.data.pool,
PoolMember: match.data.poolmember,
PoolMemberIP: match.data.poolmemberIP,
PoolmemberAvailability: match.data.poolmemberavailability,
PoolmemberState: match.data.poolmemberstate
}

 

I get following output:

 


Forum|alt.badge.img+2
  • Author
  • Spotter
  • 42 replies
  • October 15, 2024

using same query still getting same issue , appprox 200k valuse across 2 devices.


Tyson Henrie
Employee
Forum|alt.badge.img+2
  • Employee
  • 75 replies
  • October 15, 2024

Unfortunately that state command “ltm pool state” is very poorly structured for working with NQE.  It will take a lot more “messaging” with replaceMatch commands to get it work correctly.  The problem you are having is that comparing every pool with every pool member.

I think what throws this off the most is all the fully left justified output under the Pool before you get to the Pool Member.

I think you need to add an indentation to ALL lines.  Then un-indent the Pool and the Pool Members.  But you need to be careful how much you un-ident them.

Let me try this out.


Tyson Henrie
Employee
Forum|alt.badge.img+2
  • Employee
  • 75 replies
  • October 15, 2024

This worked.  I tried to find as few replacements as possible.  You will see that I refer to them as “text”. Since they are performed in order it is the “text” that goes into the pattern matching is the result of each replacement in turn.  And the order of those replacements is very important. 

Because I added a 4 space indent to ALL lines using “\n    “. 

I then un-indented “LMT::Pool: “to zero spaces of indentation. 

And, un-indented “| Ltm::Pool Member: “ to 2 spaces of indentation.  The result provides better “structure” for NQE to work with.

 

pattern01 = ```
Ltm::Pool: {poolName: string}
| Ltm::Pool Member: {poolMember: string}
| Availability : {memberAvailability: string}
| State : {memberState: string}
| IP Address : {memberIP: ipv4Address}
```;

foreach device in network.devices
where device.platform.vendor == Vendor.F5
where device.snapshotInfo.result == DeviceSnapshotResult.completed
foreach command in device.outputs.commands
where command.commandType == CommandType.F5_LTM_POOL_STATE
let text = command.response
let text = replaceMatches(text, "\n", "\n ")
let text = replaceMatches(text, " Ltm::Pool: ", "Ltm::Pool: ")
let text = replaceMatches(text, " | Ltm::Pool Member: ", " | Ltm::Pool Member: ")
let parsedCommand = parseConfigBlocks(OS.F5, text)
foreach match in blockMatches(parsedCommand, pattern01)
select {
device: device.name,
pool: match.data.poolName,
members: match.data.poolMember,
memberIP: match.data.memberIP,
memberAvailability: match.data.memberAvailability,
memberStatus: match.data.memberState
}

 


Tyson Henrie
Employee
Forum|alt.badge.img+2
  • Employee
  • 75 replies
  • October 16, 2024

I’ll just mention.  From another of Rohit’s posts. It is pretty clear that the output of F5_LTM_POOL_STATE can vary by F5 version.  Which means the IDEAs about indenting output and un-indenting output will be useful, but you may have to change the pattern01 according to the output from your version of F5 software.


Tyson Henrie
Employee
Forum|alt.badge.img+2
  • Employee
  • 75 replies
  • October 16, 2024

I added this to the other F5 post.  The pattern01 may have to change depending on your version of F5 software. Because it is pretty apparent that the contents of the F5_LTM_POOL_STATE file can vary depending on OS.  In this case you have to use the method of indenting and un-indenting, but then adjust your pattern01 according to the OS version you are running.