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.
This commit is contained in:
Roman Khavronenko 2020-07-17 00:18:03 +01:00 committed by GitHub
parent 87946dcc53
commit 21cf6a1ec4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 52 deletions

View file

@ -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"

View file

@ -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: {}

View file

@ -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:

View file

@ -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
isDefault: true