how can i get the F5 POOL Member name ip and state and availability ?
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
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?
i tried but not getting result as i want , if you help me that would be great !!
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
}
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
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:
using same query still getting same issue , appprox 200k valuse across 2 devices.
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.
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
}
Reply
Sign up
Already have an account? Login
Welcome to the Forward Networks Community
Select a login option:
Register / Login Forward Employee LoginEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.