diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 723ef36..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea \ No newline at end of file diff --git a/README.md b/README.md index 9e8a9c1..5be359a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ Необходимо развернуть следующую систему: -![image](assets/images/DockerTask.png) +![DockerTask](https://github.com/user-attachments/assets/ad1e1139-a0d5-474e-ac4d-d46df9240ae8) + Симуляторы сенсоров, развернутые в докер контейнерах, публикуют сообщения на Mqtt брокер. Сервис Consumer подписывается на все сообщение, опубликованные в брокере, и заносит их в базу данных временных рядов. Сервис dashboard отображает графики полученных данных от сервисов. @@ -59,5 +60,3 @@ - docker-compose.yml - report.md - Отчет markdown - -P.S. опираться можно на данную [статью](https://coderlessons.com/articles/programmirovanie/raspberry-pi-iot-datchiki-influxdb-mqtt-i-grafana) diff --git a/REPORT.md b/REPORT.md new file mode 100644 index 0000000..eaa4faa --- /dev/null +++ b/REPORT.md @@ -0,0 +1,134 @@ +# Отчёт по работе №2: Практика Docker +**Цель:** создать систему мониторинга системы датчиков с использованием Docker, Mosquitto, InfluxDB, Telegraf и Grafana на трёх виртуальных машинах (далее ВМ). + +## Подготовка ВМ +1. Взяты три ВМ из работы №1 (предварительно настроены в формате client, server, gateway). +2. Необходимо установить на каждую ВМ Docker и Docker Compose посредством: +```shell +sudo apt update +sudo apt upgrade -y +sudo apt install -y docker.io +sudo systemctl enable docker +sudo systemctl start docker +docker --version +sudo usermod -aG docker $USER +sudo apt install -y docker-compose +docker-compose --version +``` + +# Шаг 1: Разработка Simulator для генерации данных + +В файле `sensor.py` создаем четвертыht типf датчиков. + +Далее в файле `main.py` реализовуем клиента, который подключается к mqtt брокеру и публикует сообщения. + +В `Dockerfile`, необходимом для того, что создать образ, указываем следуюещие инструкции: + +``` Dockerfile +FROM python:alpine3.19 +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . . +CMD ["python", "main.py"] +``` + +Инструкция `FROM` инициализирует новый этап сборки и устанавливает базовый образ для последующих инструкций. `WORKDIR` создает рабочий каталог для последующих инструкций `Dockerfile`. Инструкция `COPY` копирует файл *requirements.txt* из источника в указанное место внутри образа. +Инструкция `RUN`задает команды, которые следует выполнить и поместить в новый образ контейнера. `RUN` описывает команду с аргументами, которую нужно выполнить когда контейнер будет запущен. + +Содержимое файла *requirements.txt* приведено ниже: +`paho_mqtt==1.6.1` + +*paho_mqtt* предоставляет клиентский класс, который позволяет приложениям подключаться к MQTT-брокеру для публикации сообщений. + +После проделанных выше опреаций можно создать образ командой: + +`docker build -t luyda/sensor-sim . ` + +Таким способом мы создали образ, из которого можно развернуть контейнер. + +# Шаг 2: Запуск Mosquitto брокера + +Для настройки протокола MQTT необходимо создать конфигурационный файл *mosquitto.conf* со следующим содержимымы: + +```c +listener 1883 +allow_anonymous true +``` +Для более удобного запуска брокера создадим файл *docker-compose.yml*. + +Теперь создав контейнер посмотрим его логи: +![example_run_logs](https://github.com/user-attachments/assets/79529d5e-a1a1-4f9a-bb6e-ae171fc12bc2) + +Брокер же отображает присоединившегося клиента. +![mqtt-docker_run](https://github.com/user-attachments/assets/ac0feb01-6071-4bf4-8a9c-e969bd2aea44) + +Теперь можно запустить несколько датчиков. Но перед этим необходимо прописать *docker-compose.yml*: + +С помощью команды `docker compose up` запустим контейнеры. + +При этом брокер отображает: +![mqtt-docker-compose](https://github.com/user-attachments/assets/67cae960-53c8-42cc-a962-8eb575bdbbed) + +# Шаг 3: Получение данных от симулятора +Первоначально необходимо настроить Telegraf, который подписывается на MQTT, где датчики публикуют данные. Данные будут сохраняться в InfluxDB. Отображение информации с датчиков будет происходить при помощи Grafana. + +## Telegraf +Перед использованием Telegram необходимо настроить его. +Для этого создадим конфигурационный файл *telegraf.conf* +Тем самым мы настраиваем Telegraf на чтение данных с машины IP адрес которой 192.168.0.101 через порт 1883. + +Настройка Telegraf на этом завршена. + +## InfluDB + +Для создания базы данных необходимо в конфигурационном файле *influxdb-init.iql* прописать следующее: +```sql +CREATE database sensors +CREATE USER telegraf WITH PASSWORD 'telegraf' WITH ALL PRIVILEGES +``` + +## Grafana + +Данные для отображения датчиков берутся из InfluxDB. +Для настройки в конфигурационном файле необходимо прописать следующее: +```yaml +apiVersion: 1 +datasources: + - name: InfluxDB_v1 + type: influxdb + access: proxy + database: sensors + user: telegraf + url: http://influxdb:8086 + jsonData: + httpMode: GET + secureJsonData: + password: telegraf +``` + +Для запуска всех трех контенйеров воспользуемся docker-compose. создадим файл docker-compose.yml + +После чего можно выполнить команду `docker compose up` + +# Настройка дашборда +После запуска всех необходимых контейнеров, в браузере переходим по `192.168.0.101:3000` + +Для проверки соединения перейдем в Menu -> Connections -> Data sources. Находим в истончиках InfluxDB и проверяем подключение: +![grafana-influxdb-test](https://github.com/user-attachments/assets/db9150a7-259a-4186-94d3-167383dd9e25) + +После переходим через Меню в раздел Dashboards, где создаем собственный дашбоард. +![grafana-new-view](https://github.com/user-attachments/assets/ee1b4398-b5e2-4910-b340-9d1a33185fb5) + +Для отображения информации с датчиков необходимо создать запрос (query). +![query](https://github.com/user-attachments/assets/3dbd7945-7190-470d-bf3c-f6f1b537e77e) + +После создания необходимо количества графиков, отображающих инфомрацию с Simluator, экспортируем дашборд как JSON-файл. + +Для этого находим функцию `Share` -> ``Export` -> `Save to file`. Сохраненный файл помещаем в папку `vms\server\infra\grafana\provisioning\dashboards\mqtt.json` + +# Пример выполненной работы + +![dashboard](https://github.com/user-attachments/assets/f94c4469-4ef2-4c4a-b2bb-9b2c7464bd79) + + diff --git a/assets/images/DockerTask.png b/assets/images/DockerTask.png deleted file mode 100644 index c8b1d49..0000000 Binary files a/assets/images/DockerTask.png and /dev/null differ diff --git a/guide/manual.md b/guide/manual.md deleted file mode 100644 index 5f2410a..0000000 --- a/guide/manual.md +++ /dev/null @@ -1,114 +0,0 @@ -### Ubuntu_1 -1. Написать код симулятора - * Использовать класс sensor и наследников - * Использовать переменные среды для конфигурирования - -2. Показать настройку деплоя (через pycharm ssh) -3. Показать запуск через докер -```shell -docker build -t antonaleks/sensor-sim . -docker run -e SIM_HOST=192.168.0.114 -e SIM_TYPE=temperature --name temperature antonaleks/sensor-sim -docker push antonaleks/sensor-sim -``` -4. Продемонстрировать запуск через docker-compose двух сенсоров (пример в репозитории) - -### Ubuntu_2 -1. Загрузить mosquitto брокер, создать mosquitto.conf файл -2. Запустить контейнер с привязкой к порту и загрузкой conf файла в систему -```shell - docker run -v $PWD/mosquitto:/mosquitto/config -p 1883:1883 --name broker --rm eclipse-mosquitto -``` -3. Проверить через mqtt explorer - -### Ubuntu_3 -1. influx - развернуть контейнер, указать точки монтирования - 1. Запустить контейнер с БД с приатаченным volume (версия 1.8) - ```shell - sudo docker run -d -p 8086:8086 -v influx:/var/lib/influxdb --name influxdb influxdb:1.8 - ``` - 2. Запустить в контейнере influxdb - ```shell - CREATE database sensors - USE sensors - CREATE USER telegraf WITH PASSWORD 'telegraf' WITH ALL PRIVILEGES - ``` -2. Telegraf - сконфигурировать как в гайде - 1. Получить конфигурационный файл - ```shell - sudo docker run --rm telegraf telegraf config > telegraf.conf - ``` - 2. Вставить следующую конфигурацию: - ```shell - # в блок mqtt_consumer - servers = ["tcp://192.168.1.1:1883"] # адрес vm с mqtt-брокером - topics = [ - "sensors/#" - ] - data_format = "value" - data_type = "float" - - # в блок [outputs.influxdb] - urls = ["http://192.168.26.10:8086"] # адрес докера с influxdb (указать alias при docker-compose) - database = "sensors" - skip_database_creation = true - username = "telegraf" - password = "telegraf" - ``` - 3. Запустить телеграф - ```shell - sudo docker run -v $PWD/telegraf:/etc/telegraf:ro -d telegraf - ``` -3. Сконфигурировать grafana через интерфейс - 1. Запустить контейнер с графаной - ```shell - sudo docker run --rm -d grafana/grafana - ``` - 2. Экспортировать grafana.ini на хост файл - ```shell - sudo docker exec -it cat /etc/grafana/grafana.ini > grafana.ini - ``` - 3. Запустить контейнер - ```shell - sudo docker run -p 3000:3000 -v $PWD/grafana:/etc/grafana -v grafana-data:/var/lib/grafana --name grafana -d grafana/grafana - ``` - 4. Сконфигурировать через веб-интерфейс доступ к influxdb. IP адрес указать виртуальной машины. Логин пароль telegraf, бд sensors - 5. Удалить контейнер и volume. Создать на хост папке в grafana/provising две папки dashboards и datasources - В папке datasources создать default.yaml со следующим содержимым: - ```yaml - apiVersion: 1 - - datasources: - - name: InfluxDB_v1 - type: influxdb - access: proxy - database: site - user: telegraf - url: http://192.168.1.10:8086 - jsonData: - httpMode: GET - secureJsonData: - password: telegraf - ``` - - в папке dashboards создать default.yaml - ```yaml - apiVersion: 1 - - providers: - - name: 'mqtt' - orgId: 1 - folder: '' - type: file - disableDeletion: false - editable: true - allowUiUpdates: true - options: - path: /etc/grafana/provisioning/dashboards - ``` - Также сгенерировать график в grafana вручную и скопировать json графика. Этот json залить в папку с dashboards - -4. Сконфигурировать запуск контейнеров через docker-compose - 1. Запустить с созданием отдельной сети для докеров, при этом везде в конфигурационных файлах заменить ссылку на alias (см. docker-compose.yml) - - -[Исходная статья](https://coderlessons.com/articles/programmirovanie/raspberry-pi-iot-datchiki-influxdb-mqtt-i-grafana) \ No newline at end of file diff --git a/vms/client/simulator/Dockerfile b/vm/client/Dockerfile similarity index 73% rename from vms/client/simulator/Dockerfile rename to vm/client/Dockerfile index eb66b3a..a393901 100644 --- a/vms/client/simulator/Dockerfile +++ b/vm/client/Dockerfile @@ -2,5 +2,3 @@ FROM python:alpine3.19 WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt -COPY . . -CMD ["python", "main.py"] diff --git a/vm/client/docker-compose.yml b/vm/client/docker-compose.yml new file mode 100644 index 0000000..d2fd238 --- /dev/null +++ b/vm/client/docker-compose.yml @@ -0,0 +1,31 @@ +version: "3" + +services: + temp_sensor: + image: luyda/sensor-sim + environment: + - SIM_HOST=192.168.0.101 + - SIM_NAME=TEMP1 + - SIM_PERIOD=2 + - SIM_TYPE=temperature + pressure_sensor: + image: luyda/sensor-sim + environment: + - SIM_HOST=192.168.0.101 + - SIM_NAME=PRESS1 + - SIM_PERIOD=2 + - SIM_TYPE=pressure + current_sensor: + image: luyda/sensor-sim + environment: + - SIM_HOST=192.168.0.101 + - SIM_NAME=CURRENT1 + - SIM_PERIOD=2 + - SIM_TYPE=current + co_sensor: + image: polinazhirakova/data-simulator + environment: + - SIM_HOST=192.168.0.101 + - SIM_NAME=CO1 + - SIM_PERIOD=2 + - SIM_TYPE=carbon_oxid diff --git a/vm/client/enity/sensor.py b/vm/client/enity/sensor.py new file mode 100644 index 0000000..db58e87 --- /dev/null +++ b/vm/client/enity/sensor.py @@ -0,0 +1,14 @@ + import math + self.value = math.sin(self.step) + self.step = self.step + 1 + +class CO(Sensor): + step = 0 + + def __init__(self,name): + super().__init__(name) + self.type = "carbon oxid" + + def generate_new_value(self): + self.value = self.step * 1e6 + self.step = self.step + 0.001 diff --git a/vms/client/simulator/main.py b/vm/client/main.py similarity index 64% rename from vms/client/simulator/main.py rename to vm/client/main.py index 4d17730..38198d8 100644 --- a/vms/client/simulator/main.py +++ b/vm/client/main.py @@ -1,27 +1,21 @@ import paho.mqtt.client as paho from os import environ import time - from entity.sensor import * - broker = "localhost" if "SIM_HOST" not in environ.keys() else environ["SIM_HOST"] -port = 1883 if "SIM_PORT" not in environ.keys() else int(environ["SIM_PORT"]) +port = 1883 if "SIM_PORT" not in environ.keys() else environ["SIM_PORT"] name = "sensor" if "SIM_NAME" not in environ.keys() else environ["SIM_NAME"] period = 1 if "SIM_PERIOD" not in environ.keys() else int(environ["SIM_PERIOD"]) type_sim = "temperature" if "SIM_TYPE" not in environ.keys() else environ["SIM_TYPE"] -sensors = {"temperature": Temperature, "pressure": Pressure, "current": Current} - - -def on_publish(client, userdata, result): # create function for callback +sensors = {"temperature": Temperature, "pressure": Pressure, "current": Current, "carbon_oxid": CO} +def on_publish(client, userdata, result): print(f"data published {userdata}") pass - - sensor = sensors[type_sim](name=name) -client1 = paho.Client(sensor.name) # create client object -client1.on_publish = on_publish # assign function to callback -client1.connect(broker, port) # establish connection +client1 = paho.Client(sensor.name) +client1.on_publish = on_publish +client1.connect(broker, port) while True: sensor.generate_new_value() - ret = client1.publish("sensors/" + sensor.type + "/" + sensor.name, sensor.get_data()) # publish + ret = client1.publish("sensors/" + sensor.type + "/" + sensor.name, sensor.get_data()) time.sleep(period) diff --git a/vms/client/simulator/requirements.txt b/vm/client/requirements.txt similarity index 100% rename from vms/client/simulator/requirements.txt rename to vm/client/requirements.txt diff --git a/vm/gateway/docker-compose.yml b/vm/gateway/docker-compose.yml new file mode 100644 index 0000000..3aa4263 --- /dev/null +++ b/vm/gateway/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3" +services: + broker: + image: eclipse-mosquitto + container_name: broker + volumes: + - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf + ports: + - "1883:1883" diff --git a/vms/server/infra/docker-compose.yml b/vm/server/docker-compose.yml similarity index 97% rename from vms/server/infra/docker-compose.yml rename to vm/server/docker-compose.yml index 94e705e..b82fc3d 100644 --- a/vms/server/infra/docker-compose.yml +++ b/vm/server/docker-compose.yml @@ -22,7 +22,6 @@ services: volumes: - grafana_data:/var/lib/grafana - ./grafana/:/etc/grafana/ - environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=admin @@ -32,11 +31,8 @@ services: - 3000:3000 networks: - server-net - - volumes: influx_data: {} grafana_data: {} - networks: - server-net: {} \ No newline at end of file + server-net: {} diff --git a/vm/server/telegraf/telegraf.conf b/vm/server/telegraf/telegraf.conf new file mode 100644 index 0000000..6a2a7c4 --- /dev/null +++ b/vm/server/telegraf/telegraf.conf @@ -0,0 +1,48 @@ +[global_tags] + +[agent] + interval = "10s" + round_interval = true + metric_batch_size = 1000 + collection_jitter = "0s" + flush_interval = "10s" + flush_jitter = "0s" + precision = "0s" + hostname = "" + omit_hostname = false + +[[outputs.influxdb]] + urls = ["http://influxdb:8086"] + database = "sensors" + skip_database_creation = true + username = "telegraf" + password = "telegraf" + +[[inputs.cpu]] + percpu = true + totalcpu = true + collect_cpu_time = false + report_active = false + +[[inputs.disk]] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] + +[[inputs.diskio]] + +[[inputs.kernel]] + +[[inputs.mem]] + +[[inputs.processes]] + +[[inputs.swap]] + +[[inputs.system]] + +[[inputs.mqtt_consumer]] + servers = ["tcp://192.168.0.101:1883"] + topics = [ + "sensors/#" + ] + data_format = "value" + data_type = "float" diff --git a/vms/client/simulator/docker-compose.yml b/vms/client/simulator/docker-compose.yml deleted file mode 100644 index b9e08bb..0000000 --- a/vms/client/simulator/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: "3" - -services: - temp_sensor: - image: antonaleks/data-simulator - environment: - - SIM_HOST=192.168.1.1 - - SIM_NAME=TIRCAHL24 - - SIM_PERIOD=5 - - SIM_TYPE=temperature - pressure_sensor: - image: antonaleks/data-simulator - environment: - - SIM_HOST=192.168.1.1 - - SIM_NAME=PIRCAHL11 - - SIM_PERIOD=10 - - SIM_TYPE=pressure - current_sensor: - image: antonaleks/data-simulator - environment: - - SIM_HOST=192.168.1.1 - - SIM_NAME=A0_CURRENT - - SIM_PERIOD=1 - - SIM_TYPE=current diff --git a/vms/client/simulator/entity/__init__.py b/vms/client/simulator/entity/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/vms/client/simulator/entity/sensor.py b/vms/client/simulator/entity/sensor.py deleted file mode 100644 index 922fea5..0000000 --- a/vms/client/simulator/entity/sensor.py +++ /dev/null @@ -1,54 +0,0 @@ -import random - - -class Sensor: - value: float - name: str - type: str - - def __init__(self, name): - self.name = name - - def generate_new_value(self): - pass - - def get_data(self): - return self.value - - def __str__(self): - return {"type": self.type, "name": self.name, "value": self.value} - - -class Temperature(Sensor): - step = 25 - - def __init__(self, name): - super().__init__(name) - self.type = "temp" - - def generate_new_value(self): - self.value = random.random() + self.step - - -class Pressure(Sensor): - step = 55 - - def __init__(self, name): - super().__init__(name) - self.type = "pressure" - - def generate_new_value(self): - self.value = random.random() + self.step - 56.48 + 25 * 7 - - -class Current(Sensor): - step = 0 - - def __init__(self, name): - super().__init__(name) - self.type = "current" - - def generate_new_value(self): - import math - self.value = math.sin(self.step) - self.step = self.step + 1 diff --git a/vms/gateway/mosquitto/mosquitto.conf b/vms/gateway/mosquitto/mosquitto.conf deleted file mode 100644 index c8348ac..0000000 --- a/vms/gateway/mosquitto/mosquitto.conf +++ /dev/null @@ -1,2 +0,0 @@ -listener 1883 -allow_anonymous true diff --git a/vms/server/infra/grafana/grafana.ini b/vms/server/infra/grafana/grafana.ini deleted file mode 100644 index 71abc3a..0000000 --- a/vms/server/infra/grafana/grafana.ini +++ /dev/null @@ -1,1119 +0,0 @@ -##################### Grafana Configuration Example ##################### -# -# Everything has defaults so you only need to uncomment things you want to -# change - -# possible values : production, development -;app_mode = production - -# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty -;instance_name = ${HOSTNAME} - -#################################### Paths #################################### -[paths] -# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) -;data = /var/lib/grafana - -# Temporary files in `data` directory older than given duration will be removed -;temp_data_lifetime = 24h - -# Directory where grafana can store logs -;logs = /var/log/grafana - -# Directory where grafana will automatically scan and look for plugins -;plugins = /var/lib/grafana/plugins - -# folder that contains provisioning config files that grafana will apply on startup and while running. -;provisioning = conf/provisioning - -#################################### Server #################################### -[server] -# Protocol (http, https, h2, socket) -;protocol = http - -# The ip address to bind to, empty will bind to all interfaces -;http_addr = - -# The http port to use -;http_port = 3000 - -# The public facing domain name used to access grafana from a browser -;domain = localhost - -# Redirect to correct domain if host header does not match domain -# Prevents DNS rebinding attacks -;enforce_domain = false - -# The full public facing url you use in browser, used for redirects and emails -# If you use reverse proxy and sub path specify full url (with sub path) -;root_url = %(protocol)s://%(domain)s:%(http_port)s/ - -# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. -;serve_from_sub_path = false - -# Log web requests -;router_logging = false - -# the path relative working path -;static_root_path = public - -# enable gzip -;enable_gzip = false - -# https certs & key file -;cert_file = -;cert_key = - -# Unix socket path -;socket = - -# CDN Url -;cdn_url = - -# Sets the maximum time using a duration format (5s/5m/5ms) before timing out read of an incoming request and closing idle connections. -# `0` means there is no timeout for reading the request. -;read_timeout = 0 - -#################################### Database #################################### -[database] -# You can configure the database connection by specifying type, host, name, user and password -# as separate properties or as on string using the url properties. - -# Either "mysql", "postgres" or "sqlite3", it's your choice -;type = sqlite3 -;host = 127.0.0.1:3306 -;name = grafana -;user = root -# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" -;password = - -# Use either URL or the previous fields to configure the database -# Example: mysql://user:secret@host:port/database -;url = - -# For "postgres" only, either "disable", "require" or "verify-full" -;ssl_mode = disable - -# Database drivers may support different transaction isolation levels. -# Currently, only "mysql" driver supports isolation levels. -# If the value is empty - driver's default isolation level is applied. -# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE". -;isolation_level = - -;ca_cert_path = -;client_key_path = -;client_cert_path = -;server_cert_name = - -# For "sqlite3" only, path relative to data_path setting -;path = grafana.db - -# Max idle conn setting default is 2 -;max_idle_conn = 2 - -# Max conn setting default is 0 (mean not set) -;max_open_conn = - -# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) -;conn_max_lifetime = 14400 - -# Set to true to log the sql calls and execution times. -;log_queries = - -# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) -;cache_mode = private - -# For "mysql" only if lockingMigration feature toggle is set. How many seconds to wait before failing to lock the database for the migrations, default is 0. -;locking_attempt_timeout_sec = 0 - -################################### Data sources ######################### -[datasources] -# Upper limit of data sources that Grafana will return. This limit is a temporary configuration and it will be deprecated when pagination will be introduced on the list data sources API. -;datasource_limit = 5000 - -#################################### Cache server ############################# -[remote_cache] -# Either "redis", "memcached" or "database" default is "database" -;type = database - -# cache connectionstring options -# database: will use Grafana primary database. -# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. -# memcache: 127.0.0.1:11211 -;connstr = - -#################################### Data proxy ########################### -[dataproxy] - -# This enables data proxy logging, default is false -;logging = false - -# How long the data proxy waits to read the headers of the response before timing out, default is 30 seconds. -# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set. -;timeout = 30 - -# How long the data proxy waits to establish a TCP connection before timing out, default is 10 seconds. -;dialTimeout = 10 - -# How many seconds the data proxy waits before sending a keepalive probe request. -;keep_alive_seconds = 30 - -# How many seconds the data proxy waits for a successful TLS Handshake before timing out. -;tls_handshake_timeout_seconds = 10 - -# How many seconds the data proxy will wait for a server's first response headers after -# fully writing the request headers if the request has an "Expect: 100-continue" -# header. A value of 0 will result in the body being sent immediately, without -# waiting for the server to approve. -;expect_continue_timeout_seconds = 1 - -# Optionally limits the total number of connections per host, including connections in the dialing, -# active, and idle states. On limit violation, dials will block. -# A value of zero (0) means no limit. -;max_conns_per_host = 0 - -# The maximum number of idle connections that Grafana will keep alive. -;max_idle_connections = 100 - -# How many seconds the data proxy keeps an idle connection open before timing out. -;idle_conn_timeout_seconds = 90 - -# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. -;send_user_header = false - -# Limit the amount of bytes that will be read/accepted from responses of outgoing HTTP requests. -;response_limit = 0 - -# Limits the number of rows that Grafana will process from SQL data sources. -;row_limit = 1000000 - -#################################### Analytics #################################### -[analytics] -# Server reporting, sends usage counters to stats.grafana.org every 24 hours. -# No ip addresses are being tracked, only simple counters to track -# running instances, dashboard and error counts. It is very helpful to us. -# Change this option to false to disable reporting. -;reporting_enabled = true - -# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs -;reporting_distributor = grafana-labs - -# Set to false to disable all checks to https://grafana.net -# for new versions (grafana itself and plugins), check is used -# in some UI views to notify that grafana or plugin update exists -# This option does not cause any auto updates, nor send any information -# only a GET request to http://grafana.com to get latest versions -;check_for_updates = true - -# Google Analytics universal tracking code, only enabled if you specify an id here -;google_analytics_ua_id = - -# Google Tag Manager ID, only enabled if you specify an id here -;google_tag_manager_id = - -# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set -;rudderstack_write_key = - -# Rudderstack data plane url, enabled only if rudderstack_write_key is also set -;rudderstack_data_plane_url = - -# Rudderstack SDK url, optional, only valid if rudderstack_write_key and rudderstack_data_plane_url is also set -;rudderstack_sdk_url = - -# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config -;rudderstack_config_url = - -#################################### Security #################################### -[security] -# disable creation of admin user on first start of grafana -;disable_initial_admin_creation = false - -# default admin user, created on startup -;admin_user = admin - -# default admin password, can be changed before first start of grafana, or in profile settings -;admin_password = admin - -# used for signing -;secret_key = SW2YcwTIb9zpOOhoPsMm - -# current key provider used for envelope encryption, default to static value specified by secret_key -;encryption_provider = secretKey.v1 - -# list of configured key providers, space separated (Enterprise only): e.g., awskms.v1 azurekv.v1 -;available_encryption_providers = - -# disable gravatar profile images -;disable_gravatar = false - -# data source proxy whitelist (ip_or_domain:port separated by spaces) -;data_source_proxy_whitelist = - -# disable protection against brute force login attempts -;disable_brute_force_login_protection = false - -# set to true if you host Grafana behind HTTPS. default is false. -;cookie_secure = false - -# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" -;cookie_samesite = lax - -# set to true if you want to allow browsers to render Grafana in a ,