在Open5GS的5GC和UERANSIM的UE/RAN中,使用Prometheus来监视网络功能的指标

本文介绍了使用Open5GS和UERANSIM在Prometheus中监控C-Plane的NF(AMF,SMF)度量的简单配置。这样可以监控5G通信中AMF会话数和活动的GTPv1 PDU上下文的运行情况。
请注意,希望读者大致了解5GC核心网络中每个NF(网络功能)的角色和接口,并省略了这些说明。


章节目录

    • Open5GS 5GCのシミュレーション携帯網の概要

 

    • Open5GS 5GC C-Planeの設定ファイルの追加の変更点

 

    • Prometheusを有効にしたOpen5GSのビルド

Prometheusを実行

Prometheus DashboardへのWebアクセス
Open5GS AMFのメトリック
Open5GS SMFのメトリック

Grafanaを実行

Grafana DashboardへのWebアクセス
Grafanaで使用するPrometheus data source
Grafanaでメトリックを可視化する設定例

最後に
主な変更履歴


Open5GS 5GC的模拟移动网络概述

这是一个应用了Prometheus对网络功能的指标进行监控的额外配置示例。

    Open5GS 5GC & UERANSIM UE / RAN Sample Configuration – Select UPF based on S-NSSAI

以下是组织结构。请注意,对于与度量无关的NF,被省略在图中。

network-overview.png

以下是用于5G核心网(5GC)和用户设备/无线接入网(UE/RAN)的OSS系统列表。我们使用Docker来实现Prometheus和Grafana(可视化服务器)。

    • 5GC – Open5GS v2.4.9 – https://github.com/open5gs/open5gs

UE / RAN – UERANSIM v3.2.6 – https://github.com/aligungr/UERANSIM

以下是NF正在监控的IP地址和端口。

NFIP addressportPrometheus job_nameAMF192.168.0.1119090/tcpopen5gs-amfdSMF1192.168.0.1129090/tcpopen5gs-smfd1SMF2192.168.0.1139090/tcpopen5gs-smfd2

Prometheus和Grafana-OSS的公开IP地址和端口如下所示。

ServerIP addressportPrometheus192.168.0.1119091/tcpGrafana-OSS192.168.0.1113000/tcp

Open5GS 5GC 控制面板的配置文件的附加变更

在这种情况下,针对以下配置,将进行进一步的更改,以便使用Prometheus对网络功能(NF)的度量进行监控。

    Open5GS 5GC & UERANSIM UE / RAN Sample Configuration – Select UPF based on S-NSSAI

在这里,将解释关于附加配置的内容。在进行监视时,将编辑C-Plane的每个NF的以下设置文件。

    open5gs/install/etc/open5gs/amf.yaml
...
metrics:
    addr: 192.168.0.111
    port: 9090
    open5gs/install/etc/open5gs/smf1.yaml
...
metrics:
    addr: 192.168.0.112
    port: 9090
    open5gs/install/etc/open5gs/smf2.yaml
...
metrics:
    addr: 192.168.0.113
    port: 9090

启用了Prometheus的Open5GS构建。

请参考以下步骤来构建启用Prometheus的Open5GS。

    • https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/

 

    https://open5gs.org/open5gs/docs/tutorial/04-metrics-prometheus/

此外,将安装CMake。

apt update
apt install cmake

为了在Docker上运行Prometheus,需要安装以下内容。

    docker-ce

在这里,我会简要解释一下在Ubuntu 20.04上进行构建时需要注意的要点。

1. 我们将稍作更改,以下是建设步骤的变动。

cd open5gs
meson build --prefix=`pwd`/install
ninja -C build

我們將根據以下方式進行變更。

cd open5gs
meson build --prefix=`pwd`/install && meson configure -Dmetrics_impl=prometheus build
ln -s `pwd`/subprojects/ `pwd`/../subprojects
ninja -C build

2. 如果在构建和安装之后,在以下NF中找不到共享库libcm_prom.so的链接,请执行以下操作。

open5gs-amfd
open5gs-smfd

为了链接libcm_prom.so,执行以下操作。

cd open5gs
cp -p install/lib/libcm_prom.so install/lib/x86_64-linux-gnu/

如果找不到该链接,请执行以下操作。

cd open5gs
echo `pwd`/install/lib/x86_64-linux-gnu >> /etc/ld.so.conf.d/open5gs.conf
ldconfig

执行Prometheus

请参考以下链接了解Open5GS和Prometheus的协作。

    https://open5gs.org/open5gs/docs/tutorial/04-metrics-prometheus/

对Prometheus仪表板的Web访问

首先,创建下面的prometheus.yml文件。

global:
  scrape_interval: 10s

scrape_configs:
  - job_name: open5gs-amfd
    static_configs:
      - targets: ["192.168.0.111:9090"]
  - job_name: open5gs-smfd1
    static_configs:
      - targets: ["192.168.0.112:9090"]
  - job_name: open5gs-smfd2
    static_configs:
      - targets: ["192.168.0.113:9090"]

在启动Open5GS后,按照以下步骤执行Prometheus。

docker run -d -p 9091:9090 -v `pwd`/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

通过这个,你就可以从浏览器中访问下面的网址了。

http://192.168.0.111:9091/
network-overview.png

以下是受监控的网络功能列表。

network-overview.png

Open5GS AMF的度量

工作名称=打开5gs-amfd的端点链接,将显示以下指标。

# HELP ran_ue RAN UEs
# TYPE ran_ue gauge
ran_ue 0

# HELP amf_session AMF Sessions
# TYPE amf_session gauge
amf_session 0

# HELP gnb gNodeBs
# TYPE gnb gauge
gnb 0

# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1024

# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total gauge
process_cpu_seconds_total 3

# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 152248320

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 19255296

# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 515230

# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 24

Open5GS SMF的度量

当查看open5gs-smfd1的Endpoint链接时,会显示以下指标。

# HELP gn_rx_createpdpcontextreq Received GTPv1C CreatePDPContextRequest messages
# TYPE gn_rx_createpdpcontextreq counter
gn_rx_createpdpcontextreq 0

# HELP gn_rx_deletepdpcontextreq Received GTPv1C DeletePDPContextRequest messages
# TYPE gn_rx_deletepdpcontextreq counter
gn_rx_deletepdpcontextreq 0

# HELP gtp1_pdpctxs_active Active GTPv1 PDP Contexts (GGSN)
# TYPE gtp1_pdpctxs_active gauge
gtp1_pdpctxs_active 0

# HELP ues_active Active User Equipments
# TYPE ues_active gauge
ues_active 0

# HELP gtp2_sessions_active Active GTPv2 Sessions (PGW)
# TYPE gtp2_sessions_active gauge
gtp2_sessions_active 0

# HELP gtp_node_gn_rx_parse_failed Received GTPv1C messages discarded due to parsing failure
# TYPE gtp_node_gn_rx_parse_failed counter

# HELP s5c_rx_createsession Received GTPv2C CreateSessionRequest messages
# TYPE s5c_rx_createsession counter
s5c_rx_createsession 0

# HELP s5c_rx_deletesession Received GTPv2C DeleteSessionRequest messages
# TYPE s5c_rx_deletesession counter
s5c_rx_deletesession 0

# HELP gtp_new_node_failed Unable to allocate new GTP (peer) Node
# TYPE gtp_new_node_failed counter
gtp_new_node_failed 0

# HELP s5c_rx_parse_failed Received GTPv2C messages discarded due to parsing failure
# TYPE s5c_rx_parse_failed counter
s5c_rx_parse_failed 0

# HELP sessions_active Active Sessions
# TYPE sessions_active gauge
sessions_active 0

# HELP gtp_node_gn_rx_createpdpcontextreq Received GTPv1C CreatePDPContextRequest messages
# TYPE gtp_node_gn_rx_createpdpcontextreq counter

# HELP gtp_node_gn_rx_deletepdpcontextreq Received GTPv1C DeletePDPContextRequest messages
# TYPE gtp_node_gn_rx_deletepdpcontextreq counter

# HELP bearers_active Active Bearers
# TYPE bearers_active gauge
bearers_active 0

# HELP gn_rx_parse_failed Received GTPv1C messages discarded due to parsing failure
# TYPE gn_rx_parse_failed counter
gn_rx_parse_failed 0

# HELP gtp_node_s5c_rx_parse_failed Received GTPv2C messages discarded due to parsing failure
# TYPE gtp_node_s5c_rx_parse_failed counter

# HELP gtp_peers_active Active GTP peers
# TYPE gtp_peers_active gauge
gtp_peers_active 0

# HELP gtp_node_s5c_rx_createsession Received GTPv2C CreateSessionRequest messages
# TYPE gtp_node_s5c_rx_createsession counter

# HELP gtp_node_s5c_rx_deletesession Received GTPv2C DeleteSessionRequest messages
# TYPE gtp_node_s5c_rx_deletesession counter

# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1024

# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total gauge
process_cpu_seconds_total 7

# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1169731584

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 45481984

# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 515230

# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 21

执行Grafana

我们将在这里使用Grafana的OSS版本。

对Grafana仪表盘的网络访问

在启动Open5GS和Prometheus之后,按照以下方式运行Grafana-OSS。

docker run -d -p 3000:3000 grafana/grafana-oss

通过这个,您将能够从浏览器访问以下URL。请注意,默认的登录用户名和密码均为admin。

http://192.168.0.111:3000/

在Grafana中使用Prometheus数据源

数据来源名称、URL和访问方式如下所示。

NameURLAccess ModeOpen5GShttp://192.168.0.111:9091/Server
network-overview.png

在Grafana中设置示例来可视化指标

首先,准备一个Grafana仪表板,然后创建要可视化的指标面板。在以下的指标浏览器中,选择想要可视化的job_name和指标,为该指标创建面板属性并添加面板,最后创建仪表板。

以下是设置AMF指标amf_session的面板的简单示例。

network-overview.png

通过使用Grafana,可以根据每个指标创建吸引人的面板,并将它们组合在一起,从而自由地设计出易于使用的仪表盘。

最后

一般来说,系统通常会提供监控运行状态的手段。Open5GS是一个开源的4G/5G核心,最近,它引入了可被Prometheus监控的指标框架,并加入了一些初始指标。未来,将会添加更多有用的运行信息指标。
需要注意的是,本次介绍的网络功能是5GC的AMF和SMF,同时也引入了EPC(4G)的MME指标。

最后,原文是写在Github上的。我也在Open5GS的教程中提供了链接。

主要的变更历史

    [2022.09.13] 初版。
广告
将在 10 秒后关闭
bannerAds