Forum Discussion
paul_dawson_258
Nimbostratus
Jun 06, 2018Query to retrieve VIP name from Node IP input
Hi, We are doing a DC migration and have the need to retrieve a list of VIP names based on the server/node IP address. I was wondering if anyone has written a script which does this already. I would ...
- Jun 06, 2018
This should do it, though it is fairly resource-intensive if you have a lot of virtual servers / pools / nodes:
!/usr/bin/env python3 from f5.bigip import ManagementRoot from getpass import getpass from pprint import pprint hostname = 'my.f5.ltm.net' username = 'foo' node_ips = ['192.168.1.1', 192.168.1.2', '192.168.1.3'] mgmt = ManagmentRoot(hostname, username, getpass()) Get node names that have IPs in the list nodes = [] for node in mgmt.tm.ltm.nodes.get_collection(): if node.address in node_ips: fullPath is /PARTITION/NAME nodes.append(node.fullPath) Get pool names which nodes in list belong pools = [] for pool in mgmt.tm.ltm.pools.get_collection(): members = pool.members_s.get_collection() for member in members: Member fullpath is '/PARTITION/NODENAME:SERVICE_PORT' if member.fullPath.split(':')[0] in nodes: pools.append(pool.fullPath) break Get virtual server names which pools in list belong virtuals = [] for virtual in mgmt.tm.ltm.virtuals.get_collection(): if hasattr(virtual, 'pool') and virtual.pool in pools: virtuals.append(virtual.fullPath) pprint(virtuals)
Hi John,
Jason has some steps here using a vanilla CentOS instance:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086419/Monitoring-Windows-Terminal-Services-from-BIG-IP.aspx
Aaron
- Oct 16, 2007The easiest way to do this is to use the log statement to send the data you want to the system log and then analyze it later. The downside to this is that there is only a finite amount of disk storage on the BIG-IP and the log system wasn't designed to be a database. If you regularly clean out the logs, then this shouldn't be that big an issue.
when HTTP_REQUEST { set uri [HTTP::uri] set start [clock milliseconds] } when HTTP_RESPONSE { log local0. "URI: $uri; Time: [expr [clock milliseconds] - $start] ms." }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects