2026-03-12 12:19:18 +01:00
2026-03-12 12:19:18 +01:00
2026-03-12 12:17:14 +01:00
2026-03-09 16:14:46 +01:00
2026-02-13 14:04:37 +01:00
2026-02-06 15:47:22 +01:00
2017-07-20 14:47:24 +01:00
2026-03-12 11:03:01 +01:00

Readme

Build Status Security Hotspots

Synopsis

Nagios is a powerful open source software solution for monitoring your IT environments.

confdroid_nagios is a Puppet module allowing to fully automate the setup & configuration of the Nagios server, as well as actively adding client hosts and services to the monitoring environment through defines and PuppetDB.

At this stage, the module is being redeveloped and being built to the latest standards for Puppet 8.

WARNING

Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production

Features

  • if FQDN equals the specified ng_nagios_server, nagios server with all required specs is installed, else only nagios client packages and the target specs
  • an additional directory /etc/nagios/conf.d is created to place the custom checks etc. without being overwritten by updates.
  • contacts and contactgroups are separated and filled in via define
  • hostgroups are filled in via define, hosts are added dynamically via target.pp.
  • configures all required directories for server and clients and sets proper permissions and selinux contexts
  • configures the main nagios configuration file and sets values as (pre)configured per values in params, which can be overwritten.
  • if ng_include_nrpeis set to true, the confdroid_nrpe module is automatically applied on clients (confdroid_nrpe must be in the catalogue then)

Repo Documentation

See the full Puppet documentation including parameters in docs/index.html

Dependencies

All dependencies must be included in the catalogue.

  • puppetlabs-firewall
  • puppetlabs-stdlib
  • puppetlabs-concat
  • puppetlabs-nagios_core

Deployment

  • native Puppet deployment

via site.pp or nodes.pp

node 'example.example.net' {
  include confdroid_nagios
}
  • through Foreman:

In order to apply parameters through Foreman, confdroid_nagios::params- must be added to the host or host group in question.

See more details about class deployment on confdroid.com.

Configuration

configuring UI user access

Main access to the user interface requires defining an administrative user and password via ng_main_user and ng_main_password. The password should be encrypted like this:

htpasswd -B -n  testuser
New password: 
Re-type new password: 

This results in

testuser: $2y$05$rNy/P22OfYZlpdEPnCAIg.OUizRD34P7pDRwUGiaYjH44PcRuZ2ia

Use that value to override the default password in ENC or Hiera, if you use it.

Additional UI users

The main user is automatically created. If you want to add more users, this should be done via the define confdroid_nagios::server::access. In your control repo, site.pp etc. address the access define like this:

confdroid_nagios::server::access { 'example':
  ng_htpasswd_user     => 'example_user',
  ng_htpasswd_password => 'example_password_encrypted'
}

Adding contacts

In order to add contacts for the notifications, address the define confdroid_nagios::nagios::objects::add_contact in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::add_contact { 'example_user':
    ng_contact_name   =>  'example_user',
    ng_contact_alias  =>  'Example User',
    ng_contact_groups =>  'admins',
    ng_contact_email  =>  'example@example.net',
  }

This requires the contact groups to be in place as well.

Alternatively you also can create a custom class within this module and use the export command like this:

  @@nagios_contact { 'ops':
      ensure              => present,
      alias               => 'Operations',
      contact_name        => 'ops',
      contactgroups       => 'operations',
      email               => 'ops@example.net',
      can_submit_commands => '1',
      register            => '1',
      use                 => 'generic-contact',
      target              => $ng_target_base_contact,
      owner               => $ng_user,
      group               => $ng_user,
      mode                => '0640',
    }

Adding contact groups

In order to add contact groups for the notifications, address the define confdroid_nagios::nagios::objects::add_contactgroups in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::add_contactgroups { 'example_group':
    ng_contactgroup_name      => 'example_group',
    ng_contactgroup_alias     => 'Example Group',
    ng_contactgroup_register  => '1',
  }

Alternatively you also can create a custom class within this module and use the export command like this:

  @@nagios_contactgroup { 'operations':
    ensure            => present,
    alias             => 'Operations Team',
    contactgroup_name => 'operations',
    owner             => $ng_user,
    group             => $ng_user,
    mode              => '0640',
    register          => '1',
    target            => $ng_tgt_contactgroup_base,
  }

Adding host groups

In order to add host groups, address the define confdroid_nagios::nagios::objects::add_hostgroups in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
    ng_hostgroup_name   => 'example_hostgroup',
    ng_hostgroup_alias  => 'Example Hostgroup',
  }

Alternatively you also can create a custom class within this module and use the export command like this:

  @@nagios_hostgroup { 'rhel-servers':
    ensure         => present,
    hostgroup_name => 'rhel-servers',
    alias          => 'RHEL Servers',
    owner          => $ng_user,
    group          => $ng_user,
    mode           => '0640',
    register       => '1',
    target         => $ng_target_hostgroup_base,
  }

Hosts themselves will be populated through the target.pp dynamically.

Adding service groups

In order to add service groups, address the define confdroid_nagios::nagios::objects::add_servicegroups in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
    ng_servicegroup_name   => 'example_servicegroup',
    ng_servicegroup_alias  => 'Example servicegroup',
  }

Alternatively you also can create a custom class within this module and use the export command like this:

  @@nagios_servicegroup { 'network-services':
    ensure            => present,
    servicegroup_name => 'network-services',
    alias             => 'Network Services',
    owner             => $ng_user,
    group             => $ng_user,
    mode              => '0640',
    register          => '1',
    target            => $ng_target_svcgrp_base,
  }

Adding time periods

In order to add time periods, address the define confdroid_nagios::nagios::objects::add_timeperiods in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::add_timeperiods { 'example_timeperiod':
    ng_timep_name        => 'example_timeperiod',
    ng_timep_alias       => 'Example timeperiod',
    ng_timep_monday      => '00:00-00:00',
    ng_timep_tuesday     => '00:00-00:00',
    ng_timep_wednesday   => '00:00-00:00',
    ng_timep_thursday    => '00:00-00:00',
    ng_timep_friday      => '00:00-00:00',
    ng_timep_saturday    => '00:00-00:00',
    ng_timep_sunday      => '00:00-00:00',
  }

Alternatively you also can create a custom class within this module and use the export command like this:

  @@nagios_timeperiod { 'office_hours':
    ensure          => present,
    timeperiod_name => 'office_hours',
    alias           => 'Office hours only, 5 Days A Week 09-05',
    monday          => '09:00-17:00',
    tuesday         => '09:00-17:00',
    wednesday       => '09:00-17:00',
    thursday        => '09:00-17:00',
    friday          => '09:00-17:00',
    saturday        => '00:00-00:00',
    sunday          => '00:00-00:00',
    owner           => $ng_user,
    group           => $ng_user,
    mode            => '0640',
    register        => '1',
    target          => $ng_tgt_timeperiods_base,
  }

Adding custom commands

Commands are defined in confdroid_nagios::nagios::objects::commands and deployed /etc/nagios/conf.d/nagios_commands_base.cfg through PuppetDB exports like this:

  @@nagios_command { 'check_disk':
    ensure       => present,
    command_name => 'check_disk',
    command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',
    owner        => $ng_user,
    group        => $ng_user,
    mode         => '0640',
    target       => $ng_target_command,
  }

Adding templates

In order to add time periods, address the define confdroid_nagios::nagios::objects::add_templates in your config repo, site.pp etc. like this:

  confdroid_nagios::nagios::objects::templates { 'generic contact':
    ng_template_object      => 'contact',
    ng_template_object_name => 'generic-contact',
  }

PuppetDB

A working instance of PuppetDB connected to the Puppet master is required for this to work. Installation and configuration of PuppetDB is out of scope for this module, however cd_puppetdb is available to automate this task for you as well within a few minutes.

SELINUX

All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.

Support

  • OS: Rocky 9
  • Puppet 7 # Puppet does not support Nagios in Puppet 8 anymore, although it still works

Tests

  • Puppet Lint
    • excluded tests:
      • --no-variable_scope-check: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.
  • Puppet Parser
  • ERB Template Parser
  • Sonar Quality Gate

Contact Us

Disclaimer

confdroid as entity is entirely independent from Puppet. We provide custom configuration modules, written for specific purposes and specific environments. The modules are tested and supported only as documented, and require testing in designated environments (i.e. lab or development environments) for parameter tuning etc. before deploying into production environments.

Description
Puppet 8 module to dynamically manage nagios
Readme 2.2 MiB
Languages
Puppet 48.5%
Pascal 31.9%
HTML 19.6%