Ansitheus

Ansitheus: Ansible + Prometheus

Prometheus overview

NOTE: Checkout the Prometheus official documentation.

Prometheus is an open-source systems monitoring & alerting toolkit originally built at SoundCloud.

Features

Architecture & components

Prometheus scrapes metrics from instrumented jobs, either directly or via an intermediary push gateway for short-lived jobs. It stores all scraped samples locally & runs rules over this data to either aggregate & record new time series from existing data or generate alerts. Grafana or other API consumers can be used to visualize the collected data.

Ansitheus

Why Ansitheus?

As you can see that, Prometheus ecosystem consists of multiple components. The operator may need a lot of efforts to configure, deploy & maintain these components. To make life easier, it is necessary to enter the world of automation, using modern tools of configuration management, provisioning & orchestration. Ansible is one of them. It is simple, agentless IT automation that anyone can use. My team decided to choose it as the automation solution, & Ansitheus is the result.

Features

The idea using Ansible to deploy Prometheus is not new. There are many existing solutions:

So what makes Ansitheus be different with others?

Components

Getting started

  1. Install Ansible in deployment node.

  2. Clone this repostiory.

  3. Create configuration directory, default path /etc/ansitheus.

    sudo mkdir -p /etc/ansitheus
    sudo chown $USER:$USER /etc/ansitheus
    
  4. Copy config.yml to /etc/ansitheus directory - this is the main configuration for Ansible monitoring tool.

    cp /path/to/ansitheus/repository/etc/ansitheus/config.yml \
        /etc/ansitheus/config.yml
    
  5. Copy inventory files to the current directory.

    cp /path/to/ansitheus/repository/ansible/inventory/* .
    
  6. Modify inventory & /etc/ansitheus/config.yml.

  7. Run tools/ansitheus, figure out yourself:

    Usage: ./tools/ansitheus COMMAND [option]
    
    Options:
        --inventory, -i <inventory_path> Specify path to ansible inventory file
        --configdir, -c <config_path>    Specify path to directory with config.yml
        --verbose, -v                    Increase verbosity of ansible-playbook
        --tags, -t <tags>                Only run plays & tasks tagged with these values
        --help, -h                       Show this usage information
        --skip-common                    Skip common role
        --ask-vault-pass                 Ask for vault password
    
    Commands:
        precheck                         Do pre-deployment checks for hosts
        deploy                           Deploy & start all ansitheus containers
        pull                             Pull all images for containers (only pull, no running containers)
        destroy                          Destroy Prometheus containers & service configuration
                                            --include-images to also destroy Prometheus images
                                            --include-volumes to also destroy Prometheus volumes
    

Contributors

  1. Kien Nguyen
  2. Dat Vu
  3. Duc Nguyen
  4. Long Cao