deployment/docker: replace Prometheus with vmagent (#589)

vmagent replaces Prometheus to perform scrapes and writes
into VictoriaMetrics installation. Prometheus datasource was
dropped, but its config was reused to feed vmagent.

Change also contains simplification in dashboard propagation
to Grafana container by removing excessive json manipulation
steps.
This commit is contained in:
Roman Khavronenko 2020-06-29 20:05:34 +01:00 committed by GitHub
parent 82ecfa3b32
commit eba4e92994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 60 deletions

View File

@ -594,7 +594,7 @@ ROOT_IMAGE=scratch make package-victoria-metrics
### Start with docker-compose
[Docker-compose](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml)
helps to spin up VictoriaMetrics, Prometheus and Grafana with one command.
helps to spin up VictoriaMetrics, vmagent and Grafana with one command.
More details may be found [here](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/deployment/docker#folder-contains-basic-images-and-tools-for-building-and-running-victoria-metrics-in-docker).
### Setting up service

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",
@ -65,7 +56,7 @@
"gnetId": 10229,
"graphTooltip": 0,
"id": null,
"iteration": 1591986157550,
"iteration": 1593345560631,
"links": [
{
"icon": "doc",
@ -96,7 +87,7 @@
"panels": [
{
"collapsed": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"gridPos": {
"h": 1,
"w": 24,
@ -110,7 +101,7 @@
},
{
"content": "<div style=\"text-align: center; font-size: 2em\">$version</div>",
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"description": "",
"fieldConfig": {
"defaults": {
@ -500,7 +491,7 @@
},
{
"collapsed": false,
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"gridPos": {
"h": 1,
"w": 24,
@ -1144,7 +1135,7 @@
},
{
"collapsed": true,
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"gridPos": {
"h": 1,
"w": 24,
@ -2178,7 +2169,7 @@
},
{
"collapsed": true,
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"gridPos": {
"h": 1,
"w": 24,
@ -2486,7 +2477,7 @@
},
{
"collapsed": true,
"datasource": "${DS_PROMETHEUS}",
"datasource": "$datasource",
"gridPos": {
"h": 1,
"w": 24,
@ -3207,9 +3198,9 @@
"list": [
{
"current": {
"selected": true,
"text": "Prometheus",
"value": "Prometheus"
"selected": false,
"text": "VictoriaMetrics",
"value": "VictoriaMetrics"
},
"hide": 0,
"includeAll": false,
@ -3228,14 +3219,14 @@
"allValue": null,
"current": {},
"datasource": "$datasource",
"definition": "label_values(vm_app_version, job)",
"definition": "label_values(vm_app_version{version=~\"victoria-metrics-.*\"}, job)",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "job",
"options": [],
"query": "label_values(vm_app_version, job)",
"query": "label_values(vm_app_version{version=~\"victoria-metrics-.*\"}, job)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
@ -3301,5 +3292,5 @@
"timezone": "",
"title": "VictoriaMetrics",
"uid": "wNf0q_kZk",
"version": 3
"version": 1
}

View File

@ -2,7 +2,7 @@
#### Docker compose
To spin-up setup of VictoriaMetrics, Prometheus and Grafana run following command:
To spin-up setup of VictoriaMetrics, vmagent and Grafana run following command:
`docker-compose up`
@ -13,11 +13,11 @@ VictoriaMetrics opens following ports:
* `--opentsdbListenAddr=:4242`
* `--httpListenAddr=:8428`
##### Prometheus
##### vmagent
To access service open following [link](http://localhost:9090).
Prometheus is already configured to use VictoriaMetrics as remote storage.
vmagent is used for scraping and pushing timeseries to
VictoriaMetrics instance. It accepts Prometheus-compatible
configuration `prometheus.yml` with listed targets for scraping.
##### Grafana

View File

@ -1,18 +1,18 @@
version: '3.5'
services:
prometheus:
container_name: prometheus
image: prom/prometheus:v2.19.1
vmagent:
container_name: vmagent
image: victoriametrics/vmagent
depends_on:
- "victoriametrics"
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://victoriametrics:8428/api/v1/write'
networks:
- vm_net
restart: always
@ -36,12 +36,6 @@ services:
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:
- "victoriametrics"
ports:
@ -49,12 +43,12 @@ services:
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
networks:
- vm_net
restart: always
volumes:
promdata: {}
vmagentdata: {}
vmdata: {}
grafanadata: {}
networks:

View File

@ -1,16 +1,10 @@
global:
scrape_interval: 10s
evaluation_interval: 10s
remote_write:
- url: "http://victoriametrics:8428/api/v1/write"
queue_config:
max_samples_per_send: 10000
scrape_configs:
- job_name: 'prometheus'
- job_name: 'vmagent'
static_configs:
- targets: ['prometheus:9090']
- targets: ['vmagent:8429']
- job_name: 'victoriametrics'
static_configs:
- targets: ['victoriametrics:8428']

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://victoriametrics:8428
isDefault: false
isDefault: true