Giter Site home page Giter Site logo

trellis-monit's Introduction

Trellis Monit

This role is made to be used with Trellis. It configure Monit on the server and allow you to monitor any services.

Get Started

Add the role to the galaxy.yml file of Trellis :

- name: trellis-monit
  src: 2kloc.trellis-monit
  version: 1.1.1

Run ansible-galaxy install -r galaxy.yml to install the new role.
Then, add the role into server.yml :

roles:
    ... other Trellis roles ...
    - { role: trellis-monit, tags: [monit]}

By default, the role will copy all monit configuration file located in the monit folder at the root of the Trellis project.

monit
│   nginx.conf.j2
│   mysql.conf.j2
│   memcached.conf.j2
│   php7.1-fpm.conf.j2
│   ...

Here a really basic example for the Nginx service

check process nginx with pidfile /var/run/nginx.pid
    start program = "/etc/init.d/nginx start"
    stop program  = "/etc/init.d/nginx stop"
    group www-data

Check out the Monit documentation for other examples.

Role Variables

You can use these variables to configure Monit like you want. The variables could be add into group_vars/all/main.yml

# Check service every X seconds
monit_daemon: 120

# Delay the first service check
monit_start_delay: false

# Path of monit files
monit_log_file: /var/log/monit.log
monit_pid_file: /var/run/monit.pid
monit_id_file: /var/lib/monit/id
monit_state_file: /var/lib/monit/state

# Event queue setup (Use if mail server not available)
monit_event_queue: true
monit_event_queue_file: /var/lib/monit/events
monit_event_queue_limit: 100

# Active mail server for alert delivery
monit_smtp: false

# If you active the mail server, you will need to define the sysadmin email
# with `monit_smtp_sysadmin_email` variable

# The role will use the Trellis mail variable by default but you can overwrite it
# monit_smtp_host: "mail.bar.baz"
# monit_smtp_port: "25"
# monit_smtp_username: "user"
# vault_monit_smtp_password: "password"
# monit_smtp_hostname: "mail.bar"
# monit_smtp_sender_address: "[email protected]"

# You can avoid getting alerts with this filter
# monit_alert_filters:
#   - instance
#   - action
monit_alert_filters: []

# Enable Web Interface
monit_httpd: false

# Set the port for the Web Interface
monit_httpd_port: 2812

# Set the ssl directory for the Web Interface
monit_ssl_directory_name: "{{ nginx_path }}/ssl/monit"

# Set the credentiels for the Web Interface
monit_httpd_username: admin
vault_monit_httpd_password: monit

# Create a Nginx configuration for the web interface
monit_httpd_nginx: true

# Set the server_name for Nginx configuration
monit_httpd_server_name: host.example.com
monit_httpd_location: /monit/

# Set the folder with services monitoring files
monit_configuration_path: monit

# Use to delete all files missing a corresponding template in your local machine's
monit_configuration_cleanup: true

trellis-monit's People

Contributors

alexandcote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

trellis-monit's Issues

AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'

Hello after installing the scripts I get the following error after running
ansible-playbook server.yml -e env=staging

TASK [TypistTech.trellis-newrelic-php : Template New Relic .ini file out to mods-available] ***************************************************************************************
System info:
  Ansible 2.9.0; Darwin
  Trellis 1.3.0: December 7th, 2019
---------------------------------------------------
AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'
fatal: [**IP ADRESS**]: FAILED! => {"changed": false}

Using letsencrypt keys ?

Hi,
Any idea on how to make this work with LE keys ?
If i manually change the nginx config for mysite.com to :

server_name monit.mysite.com;
   ssl_certificate         /etc/nginx/ssl/letsencrypt/mysite.com-bundled.cert;
   ssl_certificate_key     /etc/nginx/ssl/letsencrypt/mysite.com.key;

I can use the same keys that trellis created for mysite.com. But there no way I can do the same by using trellis-monit onfigs only.

Deploy error and syntax error in variables

Hi, I'm trying to deploy role to server. I can't do it:

ERROR! the role '2kloc.trellis-monit' was not found in /Volumes/B/Documentos/trellis2/ansible/roles:/Volumes/B/Documentos/trellis2/ansible/vendor/roles:/Volumes/B/Documentos/trellis2/ansible

The error appears to have been in '/Volumes/B/Documentos/trellis2/ansible/server.yml': line 43, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - { role: wordpress-setup, tags: [wordpress, wordpress-setup, letsencrypt] }
    - { role: 2kloc.trellis-monit, tags: [monit] }
      ^ here

I can deploy role just changing server role line to:

- { role: trellis-monit, tags: [monit] }

Is it right?

Also, I get a syntax error in the first variable found in monit/monit.conf.j2:

# Check service every X seconds
monit_daemon: 120;

The error is: /etc/monit/conf.d/monit.conf:2: Error: syntax error 'monit_daemon'

How can be it fixed?

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.