From 5965fe4e52f3f351a883936aadd4da3019cfd2bc Mon Sep 17 00:00:00 2001 From: Samuel Liard Date: Fri, 2 Mar 2018 14:18:20 +0100 Subject: [PATCH] Migrate to Prometheus 2.1.0 and Grafana 5.0.0 --- templates/Prometheus/6/README.md | 26 ++++++++ templates/Prometheus/6/docker-compose.yml | 74 ++++++++++++++++++++++ templates/Prometheus/6/rancher-compose.yml | 54 ++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 templates/Prometheus/6/README.md create mode 100644 templates/Prometheus/6/docker-compose.yml create mode 100644 templates/Prometheus/6/rancher-compose.yml diff --git a/templates/Prometheus/6/README.md b/templates/Prometheus/6/README.md new file mode 100644 index 0000000..fadf442 --- /dev/null +++ b/templates/Prometheus/6/README.md @@ -0,0 +1,26 @@ +# Prometheus + +### Info: + +This template deploys a collection of monitoring services based upon the technologies listed below, once deployed you should have a monitoring platform capable of querying a wide variety of metrics that represent your environment, also included are somehandy pre-configured dashboards to get you started. + +In this catalog item, the following technologies are utilised to make this as useful as possible; + +* [Prometheus](https://github.com/prometheus/prometheus) - Used to scrape and store metrics from our data sources. +* [Prometheus Node Exporter](https://github.com/prometheus/node_exporter) - Gets host level metrics and exposes them to Prometheus. +* [cAdvisor](https://github.com/google/cadvisor) - Deploys and Exposes the cadvsior stats used by Rancher's agent container, to Prometheus. +* [Grafana](https://github.com/grafana/grafana/) - Used to visualise the data from Prometheus and InfluxDB. +* [Prometheus Rancher Exporter](https://github.com/infinityworksltd/prometheus-rancher-exporter/) - Allows Prometheus to access the Rancher API and return the status of any stack or service in the rancher environment associated with the API key used. + +The full compliment of metrics from the Rancher server itsself are now available for graphing directly in Prometheus, this is easily enabled with an environment variable. For those interested, I've documented the steps [here].(https://github.com/infinityworksltd/Guide_Rancher_Monitoring) + +All components in this stack are open source tools available in the community. All this template does is to bound them together in an easy to use package. I expect most people who find this useful will make use of this as a starting point and develop it further around their own needs. + +## Deployment: +1. Select Prometheus from the community catalog. +2. Enter the IP Address of your Rancher server (used for accessing Ranchers own metrics, optional) +3. Click deploy. + +## Usage +* Grafana will now be available on, running on port 3000. I've added a number of dashboards to help get you started. Authentication is with the default `admin/admin`. +* Prometheus will now be available, running on port 9090. Have a play around with some of the data. For more information on Prometheus, check out their [documentation](https://prometheus.io/docs/introduction/overview/). diff --git a/templates/Prometheus/6/docker-compose.yml b/templates/Prometheus/6/docker-compose.yml new file mode 100644 index 0000000..37c827c --- /dev/null +++ b/templates/Prometheus/6/docker-compose.yml @@ -0,0 +1,74 @@ +cadvisor: + labels: + io.rancher.scheduler.global: 'true' + tty: true + image: google/cadvisor:latest + stdin_open: true + volumes: + - "/:/rootfs:ro" + - "/var/run:/var/run:rw" + - "/sys:/sys:ro" + - "/var/lib/docker/:/var/lib/docker:ro" + +node-exporter: + labels: + io.rancher.scheduler.global: 'true' + tty: true + image: prom/node-exporter:latest + stdin_open: true + +prom-conf: + tty: true + image: infinityworks/prom-conf:20 + volumes: + - /etc/prom-conf/ + net: none + +prometheus: + tty: true + image: prom/prometheus:v2.1.0 + command: --config.file=/etc/prom-conf/prometheus.yml --storage.tsdb.path=/prometheus --web.console.libraries=/etc/prometheus/console_libraries --web.console.templates=/etc/prometheus/consoles + ports: + - 9090:9090 + labels: + io.rancher.sidekicks: prom-conf + volumes_from: + - prom-conf + volumes: + - prometheus-data:/prometheus + volume_driver: ${VOLUME_DRIVER} + links: + - cadvisor:cadvisor + - node-exporter:node-exporter + - prometheus-rancher-exporter:prometheus-rancher-exporter + extra_hosts: + - "rancher-server:${RANCHER_SERVER}" + +graf-db: + tty: true + image: infinityworks/graf-db:11 + command: cat + volumes: + - grafana-data:/var/lib/grafana/ + volume_driver: ${VOLUME_DRIVER} + net: none + +grafana: + tty: true + image: grafana/grafana:5.0.0 + ports: + - 3000:3000 + labels: + io.rancher.sidekicks: graf-db + volumes_from: + - graf-db + links: + - prometheus:prometheus + - prometheus-rancher-exporter:prometheus-rancher-exporter + +prometheus-rancher-exporter: + tty: true + labels: + io.rancher.container.create_agent: true + io.rancher.container.agent.role: environment + image: infinityworks/prometheus-rancher-exporter:v0.22.52 diff --git a/templates/Prometheus/6/rancher-compose.yml b/templates/Prometheus/6/rancher-compose.yml new file mode 100644 index 0000000..41943c3 --- /dev/null +++ b/templates/Prometheus/6/rancher-compose.yml @@ -0,0 +1,54 @@ +.catalog: + name: "Prometheus" + version: "3.0.1" + description: "Prometheus Monitoring Solution" + uuid: prometheus-2 + minimum_rancher_version: v1.5.5 + questions: + - variable: "RANCHER_SERVER" + label: "Rancher Server" + description: "IP Address of the rancher server, no HTTP or slashes. This is only required for users that have enabled metrics to be exported by Rancher" + default: "0.0.0.0" + required: false + type: "string" + - variable: "VOLUME_DRIVER" + description: "The VOLUME driver to associate with this server" + label: "VOLUME Driver" + required: true + default: "local" + type: enum + options: + - local + - rancher-nfs + - rancher-efs + - rancher-ebs + +prometheus: + scale: 1 + health_check: + port: 9090 + interval: 5000 + unhealthy_threshold: 3 + request_line: '' + healthy_threshold: 2 + response_timeout: 5000 + +grafana: + scale: 1 + health_check: + port: 3000 + interval: 5000 + unhealthy_threshold: 3 + request_line: '' + healthy_threshold: 2 + response_timeout: 5000 + +prometheus-rancher-exporter: + scale: 1 + health_check: + port: 9173 + interval: 5000 + unhealthy_threshold: 3 + request_line: '' + healthy_threshold: 2 + response_timeout: 5000