How to use it


How to use it

First you need to install Epazote, either you can compile it from source or download a pre-compiled binary matching your operating system from here: https://bintray.com/nbari/epazote/epazote/_latestVersion

To compile from source, after downloading the sources use make to build the binary:

~/projects/go/src/github.com/epazote/epazote
$ make

Epazote was designed with simplicity in mind, as an easy tool for DevOps and as a complement to infrastructure orchestration tools like Ansible and SaltStack, because of this YAML is used for the configuration files, avoiding with this, the learn of a new language or syntax and simplifying the setup.

Basic example

services:
    google:
        url: https://www.google.com
        seconds: 5
        expect:
            status: 302
            ssl:
                hours: 72
            if_not:
                cmd: echo -n "google down"

To supervise google you would run (basic.yml is a file containing the above code):

$ epazote -f /path/to/yaml/file/basic.yml -d

-d is for debugging, will print all output to standard output.

asciicast

This example, will supervise every 5 seconds the service with name google, it will do an HTTP GET to http://www.google.com and will expect an 302 Status code if not, it will echo -n "google down"

The ssl: hours: 72 means to send an alert if the certificate is about to expire in the next 72 hours.

Extending the basic example for receiving notifications:

config:
    smtp:
        username: [email protected]
        password: password
        server: mail.example.com
        port: 587
        headers:
            from: [email protected]
            to: [email protected]
            subject: "[_name_, _because_]"

services:
    google:
        url: http://www.google.com
        minutes: 3
        threshold:
            healthy: 2 # consecutive successes
            unhealthy: 2 # consecutive failures
        expect:
            status: 200
            if_not:
                cmd: echo -n "google down"
                notify: yes

In this case, every 3 minutes the service will be checked and in case of not receiving a 200 Status code more than 2 times:

threshold:
    unhealthy: 2

Besides executing the command: echo -n "google down" an email is going to be send to [email protected], this because of the notify: yes setting.

After getting 2 consecutive successful responses 200 status code, an alert is also sent.

The configuration file

The configuration file (YAML formated) consists of two parts, a config and a services (Key-value pairs).