{"id":17031453,"url":"https://github.com/platan/metrics-shields-io-config","last_synced_at":"2025-08-31T15:19:18.104Z","repository":{"id":43654996,"uuid":"167589702","full_name":"platan/metrics-shields-io-config","owner":"platan","description":"https://metrics.shields.io/ configuration","archived":false,"fork":false,"pushed_at":"2025-08-19T08:46:50.000Z","size":849,"stargazers_count":5,"open_issues_count":13,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-24T18:31:17.594Z","etag":null,"topics":["ansible","grafana","metrics","nginx","prometheus","shields","shieldsio"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/platan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-25T17:55:21.000Z","updated_at":"2025-07-20T21:44:17.000Z","dependencies_parsed_at":"2023-02-14T19:46:39.290Z","dependency_job_id":"42882476-3e03-457d-b52f-97b3aed6c888","html_url":"https://github.com/platan/metrics-shields-io-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/platan/metrics-shields-io-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Fmetrics-shields-io-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Fmetrics-shields-io-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Fmetrics-shields-io-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Fmetrics-shields-io-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/platan","download_url":"https://codeload.github.com/platan/metrics-shields-io-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Fmetrics-shields-io-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272996383,"owners_count":25028119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","grafana","metrics","nginx","prometheus","shields","shieldsio"],"created_at":"2024-10-14T08:24:16.733Z","updated_at":"2025-08-31T15:19:18.058Z","avatar_url":"https://github.com/platan.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Ansible playbook for https://metrics.shields.io\n\nThis [Ansible](https://www.ansible.com/) [playbook](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html) can be used to setup monitoring (https://metrics.shields.io) for [Shields.io](https://shields.io/). It installs [Prometheus](https://prometheus.io/), [Telegraf](https://www.influxdata.com/time-series-platform/telegraf/), [Grafana](https://grafana.com/), [NGINX](https://www.nginx.com/) and [Let's Encrypt](https://letsencrypt.org/) certificates (using [Certbot](https://certbot.eff.org/)).\n\nPrometheus configuration contains all [instances (servers)](https://github.com/badges/shields/blob/master/doc/production-hosting.md#badge-servers) of shields.io. Grafana contains dashboards and [worldPing](https://grafana.com/plugins/raintank-worldping-app) plugin. \n\n__If you want to make changes in existing Grafana dashboards you have to update [these files](grafana/dashboards) ([explanation + instruction](http://docs.grafana.org/administration/provisioning/#making-changes-to-a-provisioned-dashboard)) and run this role.__ You can always save changes as a new dashboard: Dashboard settings \u003e Save As ...\n\nworldPing has to be [enabled manually](https://grafana.com/plugins/raintank-worldping-app/installation). It also requires Grafana.com API Key. \n\n\u003cimg src=\".readme/grafana-nodejs-dashboard.png\" width=\"40%\" height=\"40%\"\u003e \u003cimg src=\".readme/grafana-services-dashboard.png\" width=\"40%\" height=\"40%\"\u003e\n\n### How to use it?\n\n1. Install python dependencies in a python 3 virtual environment:\n```bash\npip install -r requirements.txt\n```\n2. Prepare an inventory file `inventory.ini`:\n```ini\nmetrics ansible_host=metrics.example.com ansible_port=22 ansible_user=ubuntu ansible_python_interpreter=/usr/bin/python3\n```\n3. Copy a SSH key to remote server\n4. Install required Ansible roles:\n```bash\nansible-galaxy install -r requirements.yml\n```\n5. Define properties in `variables.yml`:\n```yml\nmetrics_domain: metrics.example.com\nmertics_grafana_admin_password: !vault |\n          $ANSIBLE_VAULT;1.1;AES256\n          ...\nmetrics_grafana_github_client_id: github_client_id\nmetrics_grafana_github_client_secret: !vault |\n          $ANSIBLE_VAULT;1.1;AES256\n          ...\nmertics_prometheus_password: !vault |\n          $ANSIBLE_VAULT;1.1;AES256\n          ...\nmetrics_certbot_email: metrics@example.com\n```\nE-mail address (`metrics_certbot_email`) is used by Certbot for notification about certificates that are about to expire ([doc](https://certbot.eff.org/docs/using.html)).\n\nYou can encrypt passwords/secrets using [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html):\n```bash\nansible-vault encrypt_string --ask-vault-pass --stdin-name 'my_key'\n```\n6. Run a playbook:\n```bash\nansible-playbook shields-io-metrics.yml -i inventory.ini -e @variables.yml --ask-vault-pass --ask-become-pass\n```\n\n### Component versions\n\nServices\n| Name | The latest version | Version used in this playbook |\n|---|---|---|\n| Grafana | ![](https://img.shields.io/github/v/release/grafana/grafana?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..metrics_grafana_version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Fversions.yml) |\n| Nginx | ![](https://img.shields.io/github/v/tag/nginx/nginx?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..metrics_nginx_version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Fversions.yml) |\n| Prometheus | ![](https://img.shields.io/github/v/release/prometheus/prometheus?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..metrics_prometheus_version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Fversions.yml) |\n\n\nAnsible roles\n| Name | The latest version | Version used in this playbook |\n|---|---|---|\n| cloudalchemy.prometheus | ![](https://img.shields.io/github/v/release/cloudalchemy/ansible-prometheus?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27cloudalchemy.prometheus%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n| cloudalchemy.grafana | ![](https://img.shields.io/github/v/release/cloudalchemy/ansible-grafana?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27cloudalchemy.grafana%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n| cloudalchemy.node_exporter | ![](https://img.shields.io/github/v/release/cloudalchemy/ansible-node-exporter?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27cloudalchemy.node_exporter%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n| cloudalchemy.blackbox-exporter | ![](https://img.shields.io/github/v/release/cloudalchemy/ansible-blackbox-exporter?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27cloudalchemy.blackbox-exporter%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n| dj-wasabi.telegraf | ![](https://img.shields.io/github/v/tag/dj-wasabi/ansible-telegraf?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27dj-wasabi.telegraf%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n| nginxinc.nginx | ![](https://img.shields.io/github/v/tag/nginxinc/ansible-role-nginx?label=version) | ![](https://img.shields.io/badge/dynamic/yaml?color=blue\u0026label=version\u0026query=%24..%5B%3F%28%40.name%3D%3D%27nginxinc.nginx%27%29%5D.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Fplatan%2Fmetrics-shields-io-config%2Fmaster%2Frequirements.yml) |\n\n### Updating components\n\n#### Grafana\n- update `metrics_grafana_version` in `versions.yml` file\n- run the playbook with `grafana` tags: `ansible-playbook shields-io-metrics.yml -i inventory.ini -e @variables.yml -e @versions.yml --ask-vault-pass --ask-become-pass --tags grafana`\n\n#### Prometheus\n- update `metrics_prometheus_version` in `versions.yml` file\n- run the playbook with `prometheus` tags: `ansible-playbook shields-io-metrics.yml -i inventory.ini -e @variables.yml -e @versions.yml --ask-vault-pass --ask-become-pass --tags prometheus`\n\n#### Nginx\n- update `metrics_nginx_version` in `versions.yml` file\n- run the playbook with `nginx,certbot-nginx` tags: `ansible-playbook shields-io-metrics.yml -i inventory.ini -e @variables.yml -e @versions.yml --ask-vault-pass --ask-become-pass --tags nginx,certbot-nginx`\n\n#### Node exporter, Blackbox exporter\nThese components do not have a fixed version in `versions.yml` file or in `shields-io-metrics.yml` file. The playbook is using the default version value defined in corresponding Ansible roles. Usually, the new versions of Ansible role for these components are released shortly after releasing components. To update the component simply update the Ansible role (instructions below).\n\n#### Telegraf\n:warning: apt repository containing Telegraf contains only the latest version (https://github.com/dj-wasabi/ansible-telegraf/issues/95#issuecomment-480397359, https://github.com/influxdata/telegraf/issues/5685)\n- update `metrics_telegraf_version` in `versions.yml` file\n- run the playbook with `telegraf` tags: `ansible-playbook shields-io-metrics.yml -i inventory.ini -e @variables.yml -e @versions.yml --ask-vault-pass --ask-become-pass --tags telegraf`\n\n#### Any Ansible role\n- update version in `requirements.yml`\n- run `ansible-galaxy install -r requirements.yml --force`\n- run the playbook with one of the tags: \n  - `blackbox-exporter`\n  - `node-exporter`\n  - `prometheus`\n  - `grafana`\n  - `nginx,certbot-nginx`\n  - `telegraf`\n\n### Resources\nResource | Path | Access restrictions\n---|---|---\nGrafana | `/` | public access for all dashboards; administration using username `admin` and password from `mertics_grafana_admin_password` variable or using GitHub authentication\nPrometheus | `/prometheus` | requires username `prometheus` and password from `mertics_prometheus_password` variable\nTelegraf | `/telegraf` | requires username `telegraf` and password from `mertics_telegraf_password` variable \u003cbr\u003eor username `telegraf-staging` and password from `mertics_telegraf_staging_password` variable \u003cbr\u003eor username `telegraf-production` and password from `mertics_telegraf_production_password` variable\n\n### https://metrics.shields.io/\n\nhttps://metrics.shields.io/ uses one single-core virtual host with 2 GB RAM [VPS SSD 1](https://www.ovh.com/world/vps/vps-ssd.xml) with Ubuntu 18.04.\n\n#### GitHub authentication\nGrafana allows to authenticate with [GitHub](http://docs.grafana.org/auth/github/). At https://metrics.shields.io maintainers from core team can log into Grafana using GitHub with 'Editor' role. Currently [GitHub OAuth application](http://docs.grafana.org/auth/github/#configure-github-oauth-application) used for Grafana at metrics.shields.io is owned by [@platan](https://github.com/platan). \n\n### Testing/running locally\n\nVagrant can be used to test the configuration or run monitoring locally ([documentation](https://docs.ansible.com/ansible/latest/scenario_guides/guide_vagrant.html)).\n1. Start a virtual server and run the playbook:\n```bash\n# go to repo directory\ncd repo-dir\n# or `OBJC_DISABLE_INITIALIZE_FORK_SAFETY=true vagrant up` if you have get `objc[7750]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.`\nvagrant up\n```\n\n2. Now you can visit:\n- Grafana: http://localhost:8081\n- Prometheus: http://localhost:8081/prometheus\n\nCredentials are defined in `variables-local.yml`.\n\nIt is possible to run Ansible manually against local machine:\n```sh\nansible-playbook shields-io-metrics.yml --private-key .vagrant/machines/metrics/virtualbox/private_key -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory -e @variables-local.yml -e @versions.yml --tags grafana\n```\n\nFinally you can stop (`vagrant halt`) or remove (`vagrant destroy`) the virtual server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatan%2Fmetrics-shields-io-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplatan%2Fmetrics-shields-io-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatan%2Fmetrics-shields-io-config/lists"}