Giter VIP home page Giter VIP logo

ansible-monitoring's Introduction

ansible-monitoring
ansible-monitoring

Ansible role for installing Grafana, Prometheus and node_exporter

TravisCI

TestsVariablesUsageUse it on Raspberry PiCreditsLicense

screenshot

Tests

The role was tested in the following distributions using docker images.

Distribution Tested
Debian 9 Stretch
Ubuntu 16.04 Xenial Xerus
Ubuntu 18.04 Bionic Beaver

You can run the tests from the root directory using the following command.

distro=<distro> tests/runtests.sh
# <distro> is one of { debian9, ubuntu16 } (debian9 is the default one)

Variables

Variable Default Description
components [] Services to install. Possible values: { prometheus, node_exporter, grafana }

Usage

Inventory example:

[master]
halcyon1     ansible_connection=local

[workers]
halcyon2

[cluster:children]
master
workers

The last group is important because we need to tell Prometheus from where it should gather the metrics exported by node_exporter.

Then, you can use the provided playbooks in tests to install, start and stop the services.

---
#
# file: tests/monitoring_install.yml
#

- hosts: master
  become: True
  roles:
    - monitoring
  vars:
    components:
      - prometheus
      - node_exporter
      - grafana

- hosts: workers
  become: True
  roles:
    - monitoring
  vars:
    components:
      - node_exporter

As you can see, one node of the cluster will host Prometheus and Grafana, while the metrics will be gathered from all the nodes in the cluster.

ansible-playbook monitoring_install.yml

Keep in mind that the previous playbook doesn't start the services. This one does:

ansible-playbook monitoring_start.yml

You should be able to access Grafana and Prometheus using the browser. The installation includes two Grafana dashboards to check the status of the cluster and the individual nodes.

Use it on Raspberry Pi

I've successfully used this role in a Raspberry Pi 3 cluster with a few changes in defaults/main.yml.

First, update the variable prometheus_platform_suffix to armv7. Then, update the variables grafana_apt_key and grafana_apt_repo since you need to use an unofficial repository to install the latest Grafana version. You can find the official repos and keys at Installing Grafana.

Just add the following modification to defaults/main.yml.

#grafana_apt_key: https://packagecloud.io/gpg.key
#grafana_apt_repo: deb https://packagecloud.io/grafana/stable/debian/ jessie main

# Use these one instead if you want to install it on Raspberry Pi 3
grafana_apt_key: https://bintray.com/user/downloadSubjectPublicKey?username=bintray
grafana_apt_repo: deb https://dl.bintray.com/fg2it/deb jessie main

Credits

I've been inspired by the following open source projects:

License

This project is licensed under the MIT License - see the LICENSE file for details.

ansible-monitoring's People

Contributors

fediazgon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-monitoring's Issues

task duplicate

in file tasks/install-prometheus.yml
you have two identical tasks name: copy Prometheus main config file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.