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¶
Designing an API endpoint¶
The status API endpoint should
-
provide data using a HTTP GET method over an API
-
support output in
json
andsvg
image formats. -
Support querying based on parameters like
wip
,vip
orpool
.
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.
Python virtual environment¶
Create and activate python virtual environment
Install python modules
Temporary server¶
Start a temporary ASGI server with uvicorn
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.
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.
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¶
json format¶
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.