open5gs / open5gs

Open5GS is a C-language Open Source implementation for 5G Core and EPC, i.e. the core network of LTE/NR network (Release-17)
https://open5gs.org
GNU Affero General Public License v3.0
1.87k stars 772 forks source link

metrics endpoint is not enabled #2052

Open sumith-sreedhar opened 1 year ago

sumith-sreedhar commented 1 year ago

How to enable metrics endpoint? It seems to be disabled in https://bitbucket.org/infinitydon/opensource-5g-core-service-mesh/src/main/helm-chart/

I've tried adding metrics in amf-configmap.yaml but its showing the following logs in amf. How to enable metrics endpoint?

root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart# k -n open5gs logs open-amf-deployment-bbf7c586c-v9s9m | grep metri 02/05 12:34:19.384: [amf] WARNING: unknown key metrics (../src/amf/context.c:825)

Marcel2508 commented 1 year ago

Hey, there is a tutorial here: https://open5gs.org/open5gs/docs/tutorial/04-metrics-prometheus/

You need to enable the feature during build. To do so you could append -Dmetrics_impl=prometheus to the build command

meson build -Dmetrics_impl=prometheus --prefix=`pwd`/install

For your linked repository you would probably need to modify this Dockerfile / build command: https://bitbucket.org/infinitydon/opensource-5g-core-service-mesh/src/main/helm-chart/Dockerfiles/open5gs-epc/open5gs-epc-aio

sumith-sreedhar commented 1 year ago

Thanks but that didn't help..

02/07 12:54:35.509: [amf] WARNING: unknown key metrics (../src/amf/context.c:825)

cristianat98 commented 1 year ago

Hi @sumith-sreedhar I saw from your bitbucket that you are using the version 2.4.5. This version doesn't have the metrics implemented. Use any version from 2.5 to above.

cristianat98 commented 1 year ago

Also, you need to include what @Marcel2508 is mentioning to your Dockerfile

sumith-sreedhar commented 1 year ago

Hi @cristianat98 @Marcel2508 Here's the current Docker file

root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart/Dockerfiles/open5gs-epc# cat open5gs-epc-aio FROM ubuntu:focal

MAINTAINER Christopher Adigun adigunca@amazon.com

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \ apt-get -yq dist-upgrade && \ apt-get --no-install-recommends -qqy install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev \ libidn11-dev libmongoc-dev libbson-dev libyaml-dev libmicrohttpd-dev libcurl4-gnutls-dev meson iproute2 libnghttp2-dev \ iptables iputils-ping tcpdump cmake curl gnupg meson && \ git clone --recursive -b v2.6.0 https://github.com/open5gs/open5gs && \ cd open5gs && meson build -Dmetrics_impl=prometheus --prefix=pwd/install && ninja -C build && cd build && ninja install

WORKDIR /


Issue persists

root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart# k -n open5gs logs open-amf-deployment-7987f9dc47-899cp | grep metri 02/08 11:52:02.317: [amf] WARNING: unknown key metrics (../src/amf/context.c:825)

cristianat98 commented 1 year ago

Can you share the amf.yaml resulting of your deployment ?

sumith-sreedhar commented 1 year ago

Here's the output of "/usr/bin/meson --internal regenerate /open5gs /open5gs/build --backend ninja" command within the amf container.

open5gs 2.6.0

Subprojects freeDiameter: YES prometheus-client-c: YES

Found ninja-1.10.0 at /usr/bin/ninja

sumith-sreedhar commented 1 year ago

@cristianat98 root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart/templates# cat amf-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-amf-config labels: epc-mode: amf data: amf.yaml: | logger: file: /var/log/open5gs/amf.log

level: debug

    #domain: sbi

amf:
    sbi:
    - addr: 0.0.0.0
      advertise: {{ .Release.Name }}-amf
    ngap:
      dev: {{ .Values.k8s.interface }}
    guami:
      - plmn_id:
          mcc: {{ .Values.amf.mcc }}
          mnc: {{ .Values.amf.mnc }}
        amf_id:
          region: 2
          set: 1
    metrics:
      - addr: 0.0.0.0
        port: 9096
    tai:
      - plmn_id:
          mcc: {{ .Values.amf.mcc }}
          mnc: {{ .Values.amf.mnc }}
        tac: {{ .Values.amf.tac }}
    plmn_support:
    - plmn_id:
        mcc: {{ .Values.amf.mcc }}
        mnc: {{ .Values.amf.mnc }}
      s_nssai:
      - sst: 1
        #            sd: 1
    security:
        integrity_order : [ NIA2, NIA1, NIA0 ]
        ciphering_order : [ NEA0, NEA1, NEA2 ]
    network_name:
        full: Open5GS
    amf_name: open5gs-amf0

nrf:
 sbi:
   name: {{ .Release.Name }}-nrf

root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart/templates#

sumith-sreedhar commented 1 year ago

@cristianat98 Here's values.yaml

root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart# cat values.yaml

Default values for open5gs-epc-helm.

This is a YAML-formatted file.

Declare variables to be passed into your templates.

open5gs: image:

repository: linuxcares/open5gs-amf

repository: registry.gitlab.com/infinitydon/registry/open5gs-aio
pullPolicy: IfNotPresent
#tag: "v2.1.2"
tag: "v2.4.5"
#    tag: "v2.2.2"

webui: image: repository: registry.gitlab.com/infinitydon/registry/open5gs-webui pullPolicy: IfNotPresent tag: "2.4.5"

tag: "v2.4.5"

#tag: "v2.2.2"

ingress: enabled: false

Ingress annotations done as key:value pairs

## For a full list of possible ingress annotations, please see
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
##
## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
# annotations:
#   kubernetes.io/ingress.class: nginx

hosts:
  - name: open5gs-epc.local
    paths: ["/"]
    ## Set this to true in order to enable TLS on the ingress record
    tls: false

    ## Optionally specify the TLS hosts for the ingress record
    ## Useful when the Ingress controller supports www-redirection
    ## If not specified, the above host name will be used
    # tlsHosts:
    # - www.open5gs-epc.local
    # - open5gs-epc.local

    ## If TLS is set to true, you can declare what secret will store the key/certificate for TLS
    # tlsSecret: open5gs-epc.local-tls

dnn: internet

amf: mcc: 208 mnc: 93 tac: 7

Primary/Native kubernetes interface

k8s: interface: ens5 root@ip-172-31-82-40:~/opensource-5g-core-service-mesh/helm-chart#

sumith-sreedhar commented 1 year ago

Here's amf log:

cat /var/log/open5gs/amf.log

Open5GS daemon v2.4.5

02/08 12:50:34.560: [app] INFO: Configuration: '/open5gs/config-map/amf.yaml' (../lib/app/ogs-init.c:129) 02/08 12:50:34.560: [app] INFO: File Logging: '/var/log/open5gs/amf.log' (../lib/app/ogs-init.c:132) 02/08 12:50:34.562: [amf] WARNING: unknown key metrics (../src/amf/context.c:825) 02/08 12:50:34.564: [sbi] INFO: nghttp2_server() [0.0.0.0]:80 (../lib/sbi/nghttp2-server.c:146) 02/08 12:50:34.564: [amf] INFO: ngap_server() [192.168.14.252]:38412 (../src/amf/ngap-sctp.c:61) 02/08 12:50:34.564: [sctp] INFO: AMF initialize...done (../src/amf/app.c:33) 02/08 12:50:34.565: [sbi] WARNING: [7] Failed to connect to open-nrf port 80: Connection refused (../lib/sbi/client.c:484) 02/08 12:50:45.569: [amf] WARNING: [2daa62de-a7af-41ed-a391-cbb417c7c8f6] Retry to registration with NRF (../src/amf/nf-sm.c:161) 02/08 12:50:45.570: [amf] INFO: [2daa62de-a7af-41ed-a391-cbb417c7c8f6] NF registred [Heartbeat:10s] (../src/amf/nf-sm.c:198) 02/08 12:50:47.008: [amf] INFO: [2e800204-a7af-41ed-bc4d-576fe98c2750] (NRF-notify) NF registered (../src/amf/nnrf-handler.c:182) 02/08 12:50:47.008: [amf] INFO: [2e800204-a7af-41ed-bc4d-576fe98c2750] (NRF-notify) NF Profile updated (../src/amf/nnrf-handler.c:203) 02/08 12:50:47.229: [amf] INFO: [2ea2c9a6-a7af-41ed-a49a-910e47eb6968] (NRF-notify) NF registered (../src/amf/nnrf-handler.c:182) 02/08 12:50:47.229: [amf] INFO: [2ea2c9a6-a7af-41ed-a49a-910e47eb6968] (NRF-notify) NF Profile updated (../src/amf/nnrf-handler.c:203) 02/08 12:50:47.241: [amf] INFO: [2ea5e12c-a7af-41ed-9064-f724916e03b0] (NRF-notify) NF registered (../src/amf/nnrf-handler.c:182) 02/08 12:50:47.241: [amf] INFO: [2ea5e12c-a7af-41ed-9064-f724916e03b0] (NRF-notify) NF Profile updated (../src/amf/nnrf-handler.c:203) 02/08 12:50:48.927: [amf] INFO: [2fa598f6-a7af-41ed-9d83-6f76b2d049a4] (NRF-notify) NF registered (../src/amf/nnrf-handler.c:182) 02/08 12:50:48.927: [amf] INFO: [2fa598f6-a7af-41ed-9d83-6f76b2d049a4] (NRF-notify) NF Profile updated (../src/amf/nnrf-handler.c:203) 02/08 12:50:50.199: [amf] INFO: [36f7ad6a-a7af-41ed-906d-81b8f11f877e] (NRF-notify) NF registered (../src/amf/nnrf-handler.c:182) 02/08 12:50:50.199: [amf] INFO: [36f7ad6a-a7af-41ed-906d-81b8f11f877e] (NRF-notify) NF Profile updated (../src/amf/nnrf-handler.c:203) #

cristianat98 commented 1 year ago

Hi @sumith-sreedhar It's strange it is still showing you are using the version 2.4.5 of the Open5GS. Are you sure you switch to the version 2.6.0 ?

sumith-sreedhar commented 1 year ago

@cristianat98 Could you please share the amf image I can use in values.yaml ? The values.yaml was pasted in my previous reply

open5gs: image:

repository: linuxcares/open5gs-amf

repository: registry.gitlab.com/infinitydon/registry/open5gs-aio pullPolicy: IfNotPresent

tag: "v2.1.2"

tag: "v2.4.5"

kouamdo commented 1 year ago

Like @cristianat98 said , try to use version 2.4 9 or 2.5 and above. Look at here also : https://github.com/open5gs/open5gs/blob/ff5023e95b01ed2b01339d854e19829aedea6eef/configs/open5gs/amf.yaml.in#L372