Skip to content

Display F5 Data from Redis

This article is part three of a series, and it describes steps to retrieve F5 BigIP pool member information from a Redis database and return the data either in a svg image format or a json format, over an HTTP API call. The svg image format can be used to embed the image in an HTML page or a Github README.md page or the json endpoint can be called via a javascript.

Part1: https://blog.neni.io/blog/vector-redis-f5-syslogs/

Part2: https://blog.neni.io/blog/parsing-f5-syslogs-with-vector/

Components

  • Python App for HTTP API based on FastAPI

  • Redis: Database where the wip, vip or pool data is stored.

Designing an API endpoint

The status API endpoint should

  • provide data using a HTTP GET method over an API

  • support output in json and svg image formats.

  • Support querying based on parameters like wip, vip or pool.

Set up Environment

Clone the github repository

The app code is available at https://github.com/jbollineni/f5-poolmember-dashboard. Clone the repository to get started.

git clone git@github.com:jbollineni/f5-poolmember-dashboard.git
cd f5-poolmember-dashboard

Python virtual environment

Create and activate python virtual environment

python3 -m venv .venv
source .venv/bin/activate

Install python modules

pip install -r requirements.txt

Temporary server

Start a temporary ASGI server with uvicorn

./start_uvicorn_server.sh 

View Data in Redis

Pool database (db1)

The redis-client script populates Redis db1 with real-time pool member data that is parsed from F5 syslogs.

redisinsight

VIP database (db3)

Redis db3 is populated with SLB VIP name to pool mappings and is used to look up the pool name using the vip name. Similarly, db2 is used to pupulate GSLB WIP to pool mappings.

redisinsight

Get Data over an API

Navigate to the URL shown in the output of uvicorn to access the site. Access the swagger page via /docs or OpenAPI page /redoc for more information on API parameters.

Table format

redisinsight

json format

redisinsight

Running in production

To run the app in production, either setup the app as a systemd service or build a docker container image and run it as a container. Add an Nginx proxy as a front-end to handle TLS offload and certificate management, and to also expose port 443 to clients.