Skip to content

Usage documentation

Panos Karkazis edited this page Jul 24, 2018 · 5 revisions

1. Installation

5GTango/Sonata Monitoring framework can be installed either as part of the Service Platform by executing an automated installation process (recommended) or using the source code.

a. Service Platform installation (recommended)

In order to proceed with the full installation of the Service Platform, you must follow installation guide of the latest release

b. Source code installation

Prerequisites

Docker >= 1.13

Get source code

git clone https://github.com/sonata-nfv/son-monitor.git

Build docker containers

cd son-monitor
docker build -f influxDB/Dockerfile -t son-monitor-influxdb .
docker build -f pushgatway/Dockerfile -t son-monitor-pushgateway .
docker build -f prometheus/Dockerfile -t son-monitor-prometheus .
docker build -f manager/Dockerfile -t son-monitor-manager .
docker build -f manager/Dockerfile -t son-monitor-snmpmng .

Run Monitoring Framework

docker run -d --name son-monitor-influxdb -p 8086:8086 son-monitor-influxdb
docker run -d --name son-monitor-postgres -e POSTGRES_DB=dbname -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -p 5433:5432 ntboes/postgres-uuid
docker run -d --name son-monitor-pushgateway -p 9091:9091 son-monitor-pushgateway
docker run -d --name son-monitor-prometheus -p 9090:9090 -p 9089:9089 -e RABBIT_URL=<son-broker-ip>:5671 --add-host pushgateway:127.0.0.1 --add-host influx:127.0.0.1 son-monitor-prometheus
docker run -d --name son-monitor-snmpmng -e POSTGS_PORT=<postgres_port> -e POSTGS_HOST=<postgres_ip> -e DB_USER_NAME=<user_name> -e DB_USER_PASS=<password> -e PROM_SRV=[\"<pushgateway_url>\"] son-monitor-snmpmng

2. Retrieve Monitoring data from a VNF

a. GET List of NS

Request:

curl http://<mon-manager>:8000/api/v1/services \
-H "Accept: application/json" \
-H "Content-Type:application/json"

Response:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "sonata_srv_id": "63aaf467-e2d0-49fe-9e1e-c2b602aa5c73",
      "name": "test-service",
      "description": "NS description",
      "created": "2018-07-24T08:33:43.567111Z",
      "user": [
        1
      ],
      "host_id": "",
      "pop_id": ""
    }
  ]
}

b. GET List of VNFs per NS

Request:

curl http://<mon-manager>:8000/api/v1/functions/service/63aaf467-e2d0-49fe-9e1e-c2b602aa5c73/ \
-H "Accept: application/json" \
-H "Content-Type:application/json"

Response:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "sonata_func_id": "a821c856-8188-403c-a450-dc9a38124879",
      "name": "vtu-vnf",
      "description": "VNF implementing a vTU (virtual Transcoding Unit)",
      "created": "2018-07-24T08:33:43.591953Z",
      "service": 1,
      "host_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
      "pop_id": "1111-22222222-33333333-5555"
    }
  ]
}

c. GET List of metric per VNF

Request:

curl http://<mon-manager>:8000/api/v1/prometheus/vnf/a821c856-8188-403c-a450-dc9a38124879/metric/list
-H "Accept: application/json" \
-H "Content-Type:application/json"

Response:

{
    "status": "Success",
    "vdus": [
        {
            "metrics": [
                {
                    "__name__": "memory_usage",
                    "counter_unit": "MB",
                    "display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
                    "pop": "athens1",
                    "project_id": "425e1e692db848ed9d1a0f499b73e4e6",
                    "resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
                    "user_id": "23a53028e98f4c2c957d6e307103c2b4"
                },
                {
                    "__name__": "cpu_delta",
                    "counter_unit": "ns",
                    "display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
                    "pop": "athens1",
                    "project_id": "425e1e692db848ed9d1a0f499b73e4e6",
                    "resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
                    "user_id": "23a53028e98f4c2c957d6e307103c2b4"
                },
                {
                    "__name__": "cpu",
                    "counter_unit": "ns",
                    "display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
                    "pop": "athens1",
                    "project_id": "425e1e692db848ed9d1a0f499b73e4e6",
                    "resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
                    "user_id": "23a53028e98f4c2c957d6e307103c2b4"
                },
                {
                    "__name__": "cpu_util",
                    "counter_unit": "%",
                    "display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
                    "pop": "athens1",
                    "project_id": "425e1e692db848ed9d1a0f499b73e4e6",
                    "resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
                    "user_id": "23a53028e98f4c2c957d6e307103c2b4"
                }
            ],
            "vdu_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05"
        }
    ]
}

d. GET metric description

Request:

curl http://<mon-manager>:8000/api/v1/prometheus/vnf/a821c856-8188-403c-a450-dc9a38124879/metrics/name/cpu_util/ \
-H "Accept: application/json" \
-H "Content-Type:application/json"

Response:

{
    "status": "Success",
    "vdus": [
        {
            "metrics": [
                {
                    "metric": {
                        "__name__": "cpu_util",
                        "counter_unit": "%",
                        "display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
                        "instance": "10.100.32.200:9091",
                        "job": "sonata",
                        "pop": "athens1",
                        "project_id": "425e1e692db848ed9d1a0f499b73e4e6",
                        "resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
                        "user_id": "23a53028e98f4c2c957d6e307103c2b4"
                    },
                    "value": [
                        1532334936.542,
                        "7.739714839579372"
                    ]
                }
            ],
            "vdu_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05"
        }
    ]
}

e. GET monitoring data

Request:

tw_end=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
tw_start=$(date -u -d -10minutes '+%Y-%m-%dT%H:%M:%SZ')
curl \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name":"cpu_util","start": "'$tw_start'", "end": "'$tw_end'", "step": "10s", "labels": []}' \
"http://<mon-manager>:8000/api/v1/prometheus/vnf/a821c856-8188-403c-a450-dc9a38124879/metrics/data" 

Response:

{
	"metrics": {
		"resultType": "matrix",
		"result": [{
			"metric": {
				"user_id": "23a53028e98f4c2c957d6e307103c2b4",
				"display_name": "haproxy-vnf.vdu01.86f36eb1-42c2-4d84-bdc1-3b0caf1153d1.instance0",
				"resource_id": "6cff3faa-def7-457c-bb26-1aaddf1c9b05",
				"pop": "athens1",
				"instance": "10.100.32.200:9091",
				"job": "sonata",
				"counter_unit": "%",
				"__name__": "cpu_util",
				"project_id": "425e1e692db848ed9d1a0f499b73e4e6"
			},
			"values": [
				[1532337140, "4.637110623581866"],
				[1532337150, "4.637110623581866"],
				[1532337160, "4.637110623581866"],
				[1532337170, "4.637110623581866"],
				[1532337180, "4.637110623581866"],
				[1532337190, "4.71579765505501"],
				[1532337200, "4.71579765505501"],
				[1532337210, "4.71579765505501"],
				[1532337220, "4.71579765505501"],
				[1532337230, "4.71579765505501"]
				
			]
		}]
	}
}