From 21cf6a1ec48762ca5dbcf5cf3da1bb765a61d2e5 Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Fri, 17 Jul 2020 00:18:03 +0100 Subject: [PATCH] deployment/docker: replace Prometheus with vmagent (#635) * replace Prometheus with vmagent in docker compose env; * cluster dashboard: exclude vmagent from job list; * cluster dasbhoard: reference datasource var instead of datasource name. --- dashboards/victoriametrics.json | 39 ++++++++----------- deployment/docker/docker-compose.yml | 30 ++++++-------- deployment/docker/prometheus.yml | 7 +--- .../provisioning/datasources/datasource.yml | 8 +--- 4 files changed, 32 insertions(+), 52 deletions(-) diff --git a/dashboards/victoriametrics.json b/dashboards/victoriametrics.json index bd4d97b22..e7eb995a5 100644 --- a/dashboards/victoriametrics.json +++ b/dashboards/victoriametrics.json @@ -1,20 +1,11 @@ { - "__inputs": [ - { - "name": "DS_PROMETHEUS", - "label": "Prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], + "__inputs": [], "__requires": [ { "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "7.0.2" + "version": "7.0.3" }, { "type": "panel", @@ -59,7 +50,7 @@ "gnetId": null, "graphTooltip": 0, "id": null, - "iteration": 1591987127262, + "iteration": 1594940971206, "links": [ { "icon": "doc", @@ -89,7 +80,7 @@ "panels": [ { "collapsed": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -1480,7 +1471,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -1946,7 +1937,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -2227,7 +2218,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -2914,7 +2905,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -3129,7 +3120,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -4052,7 +4043,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -4379,7 +4370,7 @@ }, { "collapsed": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "$ds", "gridPos": { "h": 1, "w": 24, @@ -4894,14 +4885,14 @@ "allValue": null, "current": {}, "datasource": "$ds", - "definition": "label_values(vm_app_version{version=~\"^vm.*\"}, job)", + "definition": "label_values(vm_app_version{version=~\"^vm(insert|select|storage).*\"}, job)", "hide": 0, "includeAll": true, "label": null, "multi": true, "name": "job", "options": [], - "query": "label_values(vm_app_version{version=~\"^vm.*\"}, job)", + "query": "label_values(vm_app_version{version=~\"^vm(insert|select|storage).*\"}, job)", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -4938,6 +4929,10 @@ "selected": false, "text": "vmstorage" }, + { + "selected": false, + "text": "vmagent" + }, { "selected": false, "text": "vminsert" diff --git a/deployment/docker/docker-compose.yml b/deployment/docker/docker-compose.yml index 9754bf0b6..fd2273942 100644 --- a/deployment/docker/docker-compose.yml +++ b/deployment/docker/docker-compose.yml @@ -1,39 +1,33 @@ version: '3.5' services: - prometheus: - container_name: prometheus - image: prom/prometheus:v2.19.1 + vmagent: + container_name: vmagent + image: victoriametrics/vmagent depends_on: - - "vminsert" - - "vmselect" + - "vminsert" ports: - - 9090:9090 + - 8429:8429 volumes: - - promdata:/prometheus + - vmagentdata:/vmagentdata - ./prometheus.yml:/etc/prometheus/prometheus.yml command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.path=/prometheus' + - '--promscrape.config=/etc/prometheus/prometheus.yml' + - '--remoteWrite.url=http://vminsert:8480/insert/0/prometheus/' restart: always grafana: container_name: grafana image: grafana/grafana:7.0.3 - entrypoint: > - /bin/sh -c " - cd /var/lib/grafana && - mkdir -p dashboards && - sed 's/$${DS_PROMETHEUS}/Prometheus/g' vm.json > dashboards/vm.json && - /run.sh" depends_on: - - "prometheus" + - "vmselect" ports: - 3000:3000 restart: always volumes: - grafanadata:/var/lib/grafana - ./provisioning/:/etc/grafana/provisioning/ - - ./../../dashboards/victoriametrics.json:/var/lib/grafana/vm.json + - ./../../dashboards/victoriametrics.json:/var/lib/grafana/dashboards/vm.json + - ./../../dashboards/vmagent.json:/var/lib/grafana/dashboards/vmagent.json vmstorage: container_name: vmstorage @@ -71,6 +65,6 @@ services: restart: always volumes: - promdata: {} + vmagentdata: {} strgdata: {} grafanadata: {} diff --git a/deployment/docker/prometheus.yml b/deployment/docker/prometheus.yml index 211180588..158307dfe 100644 --- a/deployment/docker/prometheus.yml +++ b/deployment/docker/prometheus.yml @@ -2,13 +2,10 @@ global: scrape_interval: 1s evaluation_interval: 1s -remote_write: - - url: "http://vminsert:8480/insert/0/prometheus/" - scrape_configs: - - job_name: 'prometheus' + - job_name: 'vmagent' static_configs: - - targets: ['prometheus:9090'] + - targets: ['vmagent:8429'] - job_name: 'vminsert' static_configs: diff --git a/deployment/docker/provisioning/datasources/datasource.yml b/deployment/docker/provisioning/datasources/datasource.yml index 090554d49..5529f7349 100644 --- a/deployment/docker/provisioning/datasources/datasource.yml +++ b/deployment/docker/provisioning/datasources/datasource.yml @@ -1,14 +1,8 @@ apiVersion: 1 datasources: - - name: Prometheus - type: prometheus - access: proxy - url: http://prometheus:9090 - isDefault: true - - name: VictoriaMetrics type: prometheus access: proxy url: http://vmselect:8481/select/0/prometheus - isDefault: false \ No newline at end of file + isDefault: true \ No newline at end of file