12
support/grafana/datasources/clickhouse.yaml
Normal file
12
support/grafana/datasources/clickhouse.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: ClickHouse
|
||||
type: grafana-clickhouse-datasource
|
||||
jsonData:
|
||||
server: localhost
|
||||
port: 9000
|
||||
username: ${CLICKHOUSE_USER}
|
||||
defaultDatabase: ${CLICKHOUSE_DB}
|
||||
secureJsonData:
|
||||
password: ${CLICKHOUSE_PASSWORD}
|
19
support/grafana/docker-compose.yml
Normal file
19
support/grafana/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
hostname: grafana
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- grafana-lib:/var/lib/grafana
|
||||
- ./datasources:/etc/grafana/provisioning/datasources
|
||||
environment:
|
||||
- GF_INSTALL_PLUGINS=grafana-clickhouse-datasource
|
||||
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER}
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
|
||||
- CLICKHOUSE_USER=${CLICKHOUSE_USER}
|
||||
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}
|
||||
- CLICKHOUSE_DB=${CLICKHOUSE_DB}
|
||||
network_mode: host
|
||||
|
||||
volumes:
|
||||
grafana-lib:
|
17
support/grafana/queries.sql
Normal file
17
support/grafana/queries.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
SELECT $__timeInterval(time),
|
||||
any(open) as open,
|
||||
max(high) as high,
|
||||
min(low) as low,
|
||||
anyLast(close) as close,
|
||||
sum(volume) as volume
|
||||
FROM bars FINAL
|
||||
WHERE $__timeFilter(time)
|
||||
AND symbol = '${bars}'
|
||||
GROUP BY time;
|
||||
|
||||
SELECT time_created AS time,
|
||||
headline
|
||||
FROM news FINAL
|
||||
WHERE $__timeFilter(time)
|
||||
AND hasAny(symbols, [${news}])
|
||||
ORDER BY time ASC;
|
Reference in New Issue
Block a user