环境准备:
1、F5虚拟机
2、Prometheus+Grafana环境
1、安装F5 Telemetry Streaming RPM包
下载地址:https://github.com/F5Networks/f5-telemetry-streaming/releases
下载完RPM包后,登录F5,进入iApps ›› Package Management LX页面,将下载完的RPM包导入。
导入成功后,可以看到如下信息:
2、安装Prometheus+Grafana环境
安装的方式有很多,这里为了方便安装,使用docker-compose。命令如下
mkdir /data/
cd /data/
git clone https://gitee.com/linge365/docker-prometheus.git
cd docker-prometheus
运行
cd /data/docker-prometheus
docker-compose up -d
会同时安装如下四个容器:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e0bb658f685 grafana/grafana:9.4.3 "/run.sh" 4 months ago Up About a minute 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp grafana
bededd236793 prom/prometheus:v2.37.6 "/bin/prometheus --c…" 4 months ago Up About a minute 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp prometheus
31b0da888605 prom/alertmanager:v0.25.0 "/bin/alertmanager -…" 4 months ago Up About a minute 0.0.0.0:9093->9093/tcp, :::9093->9093/tcp alertmanager
52dd9eae52da prom/node-exporter:v1.5.0 "/bin/node_exporter …" 4 months ago Up About a minute 0.0.0.0:9100->9100/tcp, :::9100->9100/tcp node-exporter
3、配置F5 Telemetry Streaming
使用Postman工具发送POST配置报文到F5的API接口
https://10.1.1.245/mgmt/shared/telemetry/declare
{
"class": "Telemetry",
"My_Poller": {
"class": "Telemetry_System_Poller",
"interval": 0
},
"My_System": {
"class": "Telemetry_System",
"enable": "true",
"systemPoller": [
"My_Poller"
]
},
"metrics": {
"class": "Telemetry_Pull_Consumer",
"type": "Prometheus",
"systemPoller": "My_Poller"
}
}
验证配置是否成功:
https://10.1.1.245/mgmt/shared/telemetry/declare
使用Postman工具发送GET查询
{
"message": "success",
"declaration": {
"class": "Telemetry",
"My_Poller": {
"class": "Telemetry_System_Poller",
"interval": 0,
"host": "localhost",
"port": 8100,
"protocol": "http",
"allowSelfSignedCert": false,
"enable": true,
"actions": [
{
"setTag": {
"tenant": "`T`",
"application": "`A`"
},
"enable": true
}
]
},
"My_System": {
"class": "Telemetry_System",
"enable": true,
"systemPoller": [
"My_Poller"
],
"host": "localhost",
"port": 8100,
"protocol": "http",
"allowSelfSignedCert": false
},
"metrics": {
"class": "Telemetry_Pull_Consumer",
"type": "Prometheus",
"systemPoller": "My_Poller",
"enable": true,
"trace": false
},
"schemaVersion": "1.33.0"
}
}
4、配置Prometheus
在Prometheus的配置文件prometheus.yml中添加如下内容:
username和password为登录F5的用户名和密码
targets为F5管理地址
scrape_configs:
- job_name: 'TelemetryStreaming'
scrape_timeout: 30s
scrape_interval: 30s
scheme: https
tls_config:
insecure_skip_verify: true
metrics_path: '/mgmt/shared/telemetry/pullconsumer/metrics'
basic_auth:
username: 'admin'
password: '1'
static_configs:
- targets: ['10.1.10.240:443']
重新加载配置:
curl -X POST http://localhost:9090/-/reload
登录Prometheus查看是否获取到指标
http://IP:9090/targets?search=
5、配置grafana显示
登录grafana进入Dashboards/Import页面,输入19135,然后点击Load
选择数据源为Prometheus,然后点击Import
进入F5 Dashboard页面,选择Job为TelemetryStreaming,instance根据你的F5地址选择
6、最终显示效果如下:
显示系统CPU、内存、吞吐、并发连接、新建连接
显示VS、Pool、Pool Members总数目及可用数目
显示单个VS吞吐量信息、HTTP交易的状态码信息
有点多,就不一一描述了,直接看图。。。