aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/prom-kafka-writer/README.md
blob: 8d981e1d57a78e66e6501e0a33e58ee82b3f4f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Prometheus Kafka Remote Writer

![Architecture Diagram](./diagram.png)

Prometheus Kafka remote writer is a remote writer/adapter to publish metrics from prometheus to a remote storage like kafka.
The prom-kafka-writer microservice enables to register the remote endpoint and configures the kafka producer endpoint. 
Prometheus can then be configured to set the remote write to this endpoint and the metrics can be published.

----
## Install
### Build docker images
```bash
git clone https://github.com/onap/demo.git
DA_WORKING_DIR=$PWD/demo/vnfs/DAaaS
cd $DA_WORKING_DIR/microservices/prom-kafka-writer
docker build -f Dockerfile.ci . -t prom-kafka-writer:latest
```
### Deploy using Helm chart
```bash
cd $DA_WORKING_DIR/deploy/collection/charts/prom-kafka-writer

# Modify the values.yaml
helm install -n pkw . -f values.yaml --namespace=edge1
```
Verify the deployment
```bash
kubectl get pods -n edge1 | grep prom-kafka-writer

NAME                                    READY   STATUS             RESTARTS   AGE
pkw-prom-kafka-writer-c6c89c579-jv6jt   1/1     Running            0          11m
```

## API
* Create Prometheus Kafka Writer endpoint

```bash
   //Request
   curl -X POST \
     http://prom-kafka-writer/pkw \
     -H 'Content-Type: application/json' \
     -d '{
    "bootstrap.servers": "kafka-cluster-kafka-bootstrap.kafka.svc.cluster.local:9091",
    "topic": "topic1",
    "usePartition": false,
    "compression.codec": "snappy"
   }'
```

* Delete Prometheus Kafka Writer endpoint
          
```bash
    //Request
    curl -X DELETE http://prom-kafka-writer/pkw/pkw0
```

* List Prometheus Kafka Writers
```bash
    //Request
    curl -X GET http://prom-kafka-writer/pkw
```

* Publish to Kafka Writer
```bash
    //Request
    curl -X POST http://prom-kafka-writer/pkw/pkw0/receive
```