diff --git a/prometheus/README.md b/prometheus/README.md index eb73678..d896899 100644 --- a/prometheus/README.md +++ b/prometheus/README.md @@ -3,4 +3,6 @@ prometheus [Prometheus][1] is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. +![](http://www.robustperception.io/wp-content/uploads/2015/11/Replacing-Graphite-with-Prometheus.png) + [1]: https://prometheus.io/docs/introduction/overview/ diff --git a/prometheus/data/etc/graphite-mapping.yaml b/prometheus/data/etc/graphite-mapping.yaml new file mode 100644 index 0000000..0310c92 --- /dev/null +++ b/prometheus/data/etc/graphite-mapping.yaml @@ -0,0 +1,20 @@ +mappings: +- match: test.dispatcher.*.*.* + name: dispatcher_events_total + labels: + action: $2 + job: test_dispatcher + outcome: $3 + processor: $1 +- match: '*.signup.*.*' + name: signup_events_total + labels: + job: ${1}_server + outcome: $3 + provider: $2 +- match: 'servers\.(.*)\.networking\.subnetworks\.transmissions\.([a-z0-9-]+)\.(.*)' + match_type: regex + name: 'servers_networking_transmissions_${3}' + labels: + hostname: ${1} + device: ${2} diff --git a/prometheus/data/etc/prometheus.yml b/prometheus/data/etc/prometheus.yml index 93c24da..d8970e5 100644 --- a/prometheus/data/etc/prometheus.yml +++ b/prometheus/data/etc/prometheus.yml @@ -1,19 +1,16 @@ global: - scrape_interval: 15s # By default, scrape targets every 15 seconds. - - # Attach these labels to any time series or alerts when communicating with - # external systems (federation, remote storage, Alertmanager). + scrape_interval: 15s external_labels: monitor: 'codelab-monitor' -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. scrape_configs: - # The job name is added as a label `job=` to any timeseries scraped from this config. - job_name: 'prometheus' - - # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 5s - static_configs: - targets: ['localhost:9090'] + + - job_name: 'graphite' + honor_labels: true + static_configs: + - targets: + - graphite:9108 diff --git a/prometheus/docker-compose.yml b/prometheus/docker-compose.yml index b48024e..0523ed0 100644 --- a/prometheus/docker-compose.yml +++ b/prometheus/docker-compose.yml @@ -1,15 +1,32 @@ version: "3.8" + services: + prometheus: image: prom/prometheus:v2.31.1 command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.path=/var/lib/prometheus' - - '--web.console.libraries=/usr/share/prometheus/console_libraries' - - '--web.console.templates=/usr/share/prometheus/consoles' + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/var/lib/prometheus" + - "--web.console.libraries=/usr/share/prometheus/console_libraries" + - "--web.console.templates=/usr/share/prometheus/consoles" + - "--web.external-url=http://127.0.0.1:9090" + - "--storage.tsdb.retention.time=1y" ports: - "9090:9090" volumes: - ./data/etc:/etc/prometheus - ./data/var:/var/lib/prometheus restart: unless-stopped + + graphite: + image: prom/graphite-exporter + command: + - "--graphite.mapping-config=/etc/prometheus/graphite-mapping.yaml" + - "--graphite.mapping-strict-match" + ports: + - "9108:9108" + - "9109:9109" + - "9109:9109/udp" + volumes: + - ./data/etc:/etc/prometheus + restart: unless-stopped diff --git a/trino/README.md b/trino/README.md index 1ff2be6..69954b6 100644 --- a/trino/README.md +++ b/trino/README.md @@ -5,13 +5,14 @@ trino distributed over one or more heterogeneous data sources. ```bash -$ mkdir -m 777 data +$ mkdir data/{etc,data} +$ chown -R 1000:1000 data $ docker-compose up -d $ docker-compose exec trino trino >>> show catalogs; ->>> show schemas from jmx; ->>> show tables from jmx.current; ->>> select * from jmx.current."java.lang:type=operatingsystem"; +>>> show schemas from system; +>>> show tables from system.runtime; +>>> select * from system.runtime.queries; >>> quit ``` diff --git a/trino/data/etc/node.properties b/trino/data/etc/node.properties index d04a716..f52f198 100644 --- a/trino/data/etc/node.properties +++ b/trino/data/etc/node.properties @@ -1,3 +1,3 @@ node.environment=docker -node.data-dir=/var/lib/trino +node.data-dir=/usr/lib/trino/data node.id=master diff --git a/trino/docker-compose.yml b/trino/docker-compose.yml index f1312dd..fc2c2c5 100644 --- a/trino/docker-compose.yml +++ b/trino/docker-compose.yml @@ -2,10 +2,11 @@ version: "3.8" services: trino: image: trinodb/trino - command: ["/usr/lib/trino/bin/launcher", "run", "--etc-dir", "etc", "--data-dir", "data"] + command: ["bin/launcher", "run", "--etc-dir", "etc", "--data-dir", "data"] ports: - "8080:8080" volumes: - - ./data:/opt/trino - working_dir: /opt/trino + - ./data/etc:/usr/lib/trino/etc + - ./data/data:/usr/lib/trino/data + working_dir: /usr/lib/trino restart: unless-stopped