Code Monkey home page Code Monkey logo

ansible-role-monit's Introduction

Monit

Ansible role for configuring Monit. Sample usage see example.yml.

Install

Install this role with ansible-galaxy.

$ ansible-galaxy install pgolm.monit

Requirements

An Ansible ready host.

Role Variables

  • monit_cycle: Time between checks in seconds. Defaults to 120.
  • monit_log_destination: Where the log will be written. Can be a path to a file or "syslog", which will write to syslog daemon. Defaults to /var/log/monit.log.
  • monit_state_file: State file path. Defaults to /var/lib/monit/state.
  • monit_id_file: Id file path. Defaults to /var/lib/monit/id.
  • monit_eventqueue_dir: Event queue directory path. It is only used when this variable is defined. Defaults to /var/lib/monit/events.
  • monit_eventqueue_slots: Event queue slots. It is only used when monit_eventqueue_dir is defined. Defaults to 100.
  • monit_services: List of hashes of services to be monitorized by monit.
    • name: Name of the process or host.
    • type: Type of monitorization, "process", "process_by_name", "host", "filesystem" and "system" are supported.
    • target: Target of monitorization. Should be a pidfile, processname, an address or undefined, depending on the type of service.
    • start: Command that starts the service. Optional.
    • stop: Command that stop the service. Optional.
    • user: Linux username of the user starting the program. Optional.
    • group: Linux group of the user starting the program. Optional.
    • rules: List of rules to be included in this service. Optional.
  • monit_service_delete_unlisted: Remove existing service monitorization configurations not declared in the services. Defaults to true.
  • monit_mail_enabled: Enable mail alerts. Defaults to false.
  • monit_mailserver_host: Mailserver host address. Defaults to localhost.
  • monit_mailserver_port: Mailserver host port. Defaults to 25.
  • monit_mailserver_user: Username for authentication on mailserver. Optional
  • monit_mailserver_password: Password for authentication on mailserver. Optional
  • monit_mailserver_timeout: Timeout for mailserver connection. Defaults to 5.
  • monit_mailserver_ssl_version: If defined, monit will use this algorithm for SSL connection to the mail server. Possible values are SSLAUTO, SSLV2, SSLV3, TLSV1, TLSV11, TLSV12.
  • monit_alert_addresses: List of mail addresses where the alerts will be sent to.
  • monit_alert_mail_format: A hash of options for mail-format.
    • from: Sender mail address.
    • reply-to: A reply-to mail address.
    • subject: Mail subject.
    • message: Mail message body.
  • monit_webinterface_enabled: Enable monit web interface. Defaults to true.
  • monit_webinterface_bind: IP address to bind web interface. Defaults to 0.0.0.0 (listen for external requests).
  • monit_webinterface_port: Port for web interface. Defaults to 2812.
  • monit_webinterface_rw_group: Define group of users allowed to read and write on web interface. It is only applied when defined and is empty by default.
  • monit_webinterface_r_group: Define group of users allowed to read on web interface. It is only applied when defined and is empty by default.
  • monit_webinterface_acl_rules: List of ACL rules for the web interface, such as "localhost" or "hauk:password". It is only applied when defined and is empty by default. You should probably define at least one for the httpd service to start.

Custom facts

This role writes a monit_services_configured on /etc/ansible/facts.d/monit.fact in order to keep track of the configured monitors between different plays. This helps us removing unused monitors.

LICENSE

MIT

CONTRIBUTE

Feel free to contribute by add issue and pull request.

CONTRIBUTORS

ansible-role-monit's People

Contributors

amnay-mo avatar antstorm avatar astik avatar byteshiva avatar etux avatar jacoelho avatar jordiclariana avatar kh0r avatar mtpereira avatar pgolm avatar pmoust avatar roberttstephens avatar roozbehf avatar runar avatar sv3ndk avatar tomnaessens avatar vkill avatar worldofchris avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

ansible-role-monit's Issues

enable/disable one monit service

so, my solution is, that you can add Enabled: False to just one monit service and ansible will not add it to the project. It will also delete it later if changed from True to False. Default befaviour (if True or nothing specified) is True

variable undefined error

can you let me know why its throwing variable undefined!!

the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode' object has no attribute 'name'\n\nThe error appears to have been in '/root/ansible-consul-temp/roles/pgolm.monit/tasks/monitors.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: monitors - Write monitors\n ^ here\n

"Remove unused monitors" fails when running with `--check`

When running a play with --check flag, the task fails with the following message:

TASK [monit : monitors - Remove unused monitors] *******************************
fatal: [123.345.567.789]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout_lines'"}
	to retry, use: --limit @/Users/koenpunt/.../ansible/playbook.retry

"Make sure the PostgreSQL users are present" task fails

I have such error

TASK [ANXS.postgresql : PostgreSQL | Make sure the PostgreSQL users are present] ***
fatal: [163.172.154.240]: FAILED! => {"failed": true, "msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of '/tmp/ansible-tmp-1489444628.62-212718584096187/': Operation not permitted\nchown: changing ownership of '/tmp/ansible-tmp-1489444628.62-212718584096187/postgresql_user.py': Operation not permitted\n). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}
	to retry, use: --limit @/eqa/standalone/ansible_provision/install_postgre.retry

It appears only when I setup Postgres on Scaleway VPS.
Error doesn't appear when I setup Postgres on DigitalOcean VPS.
Any ideas ?

Default `monit_eventqueue_dir` is not set

README says monit_eventqueue_dir defaults to /var/lib/monit/events however this is not the case in defaults/main.yml.

This means the monitrc.j2 template never adds the set eventqueue block:

{% if monit_eventqueue_dir is defined %}
set eventqueue
  basedir {{ monit_eventqueue_dir | default('/var/lib/monit/events') }}
  slots {{ monit_eventqueue_slots | default(100) }}
{% endif %}

Which means alerts don't send.

web interface template broken

The webinterface template, as it is now, causes the following message in the logs when launching monit:
monit: monit httpd not started since no connect allowed

In the monit documentation: https://mmonit.com/monit/documentation/monit.html, the syntax is:

  SET HTTPD PORT <number> [ADDRESS <hostname | IP-address>]
      [SSL <ENABLE | DISABLE>]
      [PEMFILE <path>]
      [CLIENTPEMFILE <path>]
      [ALLOWSELFCERTIFICATION]
      [SIGNATURE <ENABLE | DISABLE>]
      ALLOW <user:password | IP-address | IP-range>+

Mistake in readme.rb

Hi. Please fix monit_service_detele_unlisted, there is mistake in word 'delete', cannot copy-paste from documentation. Thanks!

monitrc leftover and the missing /var/lib/monit

Hi,

First, thanks for the nice ansible role! It was a pleasure using it.

Running it against my CentOS7 box, I noticed two problems with the configuration:

  1. Despite the RedHat variables setting the default config file to be /etc/monit.conf, the original /etc/monitrc still remains and is loaded when the service starts and the two configurations are merged. In addition to the ambiguity it causes, a dangerous effect is that the default user/pass of admin:monit will still be active which is a security issue.
  2. I changed the value of the variable monitrc_conf to /etc/monitrc to avoid having both files on the system. This revealed another issue: the Ansible configuration file (templates/monitrc.j2) sets the id and state of the service to be in the /var/lib/monit folder, while this folder does not exist (at least not on my box). This causes the service to complain and fail to start.

I fixed these issues and a patch of the fix is attached. I can do a pull request if you agree with the changes (commit: roozbehf@f1c8f85)

fix_monitrc_conflict_on_centos7.patch.txt

Take out - or make optional - the Installation Step

I was wondering (hoping) that you could maybe make the installation step either optional or take it out completely? As the version in the standard repo's tends to be fairly out of date. And there are those of us who like to live on the edge and install via their git repo....

If that can be done, I'd use y'all's role exclusively as far as configuring my monit.... I've got my own building-role taken care of.

And I'd be happy to help contribute a macOS wing as well!

Problem defining ACL rules for the webinterface

Hello,

Thanks for this cool initiative.
I'm having an error message when activation the user interface.

Here is my defaults/main.yml file for acl rules :

monit_webinterface_acl_rules :

  • "toto:titi"
  • "localhost"

I get those error when provisioning :

<127.0.0.1> REMOTE_MODULE group name=vagrant:monit state=present
failed: [default] => (item=toto:titi) => {"failed": true, "item": "toto:titi", "name": "toto:titi"}
msg: groupadd: 'toto:titi' is not a valid group name

Why is the module group invoked here ? I thought it would just replace the rules variable in the template file of the webinterface.

Thanks
Cyrille

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.