GithubHelp home page GithubHelp logo

ansible-nagios-config's Introduction

Ansible-Nagios-Config

Before going any further, this role is designed to be run on servers that have been provisioned using the npm Nagios Role. Provision a new server using this role.

What is This?

Nagios is a pain to configure, Ansible-Nagios-Config alleviates this by:

  • providing sane default settings for hosts/services.
  • automating the generation of configuration, through a simple DSL.

Usage

  • Install librarian-ansible a tool for managing your third-party Ansible dependencies.
  • Provision a new Nagios server using ansible-nagios.
  • Set the nagios_host_groups, nagios_commands, and nagios_hosts variables described in the next section of this document.
  • Create a playbook that references the ansible-nagios-config role, and use it to deploy your configuration.

Configuration

  • nagios_base_dir: the nagios installation directory. default: /usr/local/nagios
  • nagios_object_dir: the nagios object directory. default: {{nagios_base_dir}}/etc/objects
  • nagios_cfg_dir_enabled: if true, configures nagios_object_dir as a cfg_dir. default: false
  • nagios_user: id of nagios user. default: nagios
  • nagios_group: id of nagios group. default: nagios

nagios_hosts

Used to describe the hosts you would like to monitor with Nagios:

  • name: the name of the host, used to reference it in host_groups.
  • address: the actual address of the host.
  • other variables: other variables represent host_groups that the host belongs to, e.g., www, aws.
nagios_hosts:
  - {name: 'www', address: 'www.example.com', www: true, aws: true}
  - {name: 'redis', address: 'redis.example.com', redis: true, aws: true}

nagios_groups

Used to organize your hosts into types of servers, e.g., web, redis, MySQL, and to describe the checks that should be applied to these groups.

nagios_host_groups:
  - name: 'www'
    alias: 'Web Servers'
    checks:
      - {command: 'check_http_npmjs_org', description: 'Check HTTP'}
      - {command: 'check_nrpe2!check_disk_nrpe', description: 'Disk Space Left'}
  - name: 'aws'
    alias: 'AWS Servers'
  - name: 'redis'
    alias: 'Redis Server'
    checks:
      - {command: 'check_nrpe2!check_disk_nrpe', description: 'Disk Space Left'}

nagios_commands

Describe custom commands that can be used to perform host checks:

nagios_commands:
  - {name: 'check_http_npmjs_org', command: '$USER1$/check_http -H npmjs.org -I $HOSTADDRESS$ $ARG1$'}
  - {name: 'check_nrpe2', command: '$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$'}

ansible-nagios-config's People

Stargazers

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

Watchers

 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

ansible-nagios-config's Issues

TASK: [bcoe.nagios-config | create services.cfg] failed

Hi there,

When I use ansible-nagios-config to add new host monitor I obtain this error:

TASK: [bcoe.nagios-config | create services.cfg] ******************************
fatal: [nagios_host.com] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'dict object' has no attribute 'checks'", 'failed': True}
fatal: [nagios_host.com] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'dict object' has no attribute 'checks'", 'failed': True}

FATAL: all hosts have already failed -- aborting

Regards!

Invert Host and HostGroup dependencies. Have host declare group memberships.

Currently we declare a hostgroup with the members.

This makes the members line churn as any server added or removed will alter these lines.
Obviously, there are worse things in the world. This is automated so people shouldn't have to look at this, but there will always be the times when a person needs to look at this.

One solution is to have hosts declare their group membership.

define hostgroup {
  hostgroup_name all-prod
}

define hostgroup {
  hostgroup_name web-app-prod
}

define host {
    host_name  production-web-app-1
    notes      i-deadbeef
    use        generic-remote-host
    address    127.0.0.1
    hostgroups all-prod,web-app-prod
}

If we use the above approach, adding and removing hosts generate clean diffs.

Note: we can use the same approach with services and servicegroups

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.