2021-09-13 14:00:17 +02:00
# Readme
2026-03-05 11:29:25 +01:00
[](https://jenkins.confdroid.com/job/confdroid_nagios/)
2026-02-11 17:34:45 +01:00
[](https://sonarqube.confdroid.com/dashboard?id=confdroid_nagios)
2026-02-02 23:38:50 +01:00
- [Readme ](#readme )
- [Synopsis ](#synopsis )
- [WARNING ](#warning )
- [Features ](#features )
2026-03-01 16:15:06 +01:00
- [Repo Documentation ](#repo-documentation )
- [Dependencies ](#dependencies )
- [Deployment ](#deployment )
- [Configuration ](#configuration )
2026-03-01 15:12:15 +01:00
- [configuring UI user access ](#configuring-ui-user-access )
- [Additional UI users ](#additional-ui-users )
- [Adding contacts ](#adding-contacts )
- [Adding contact groups ](#adding-contact-groups )
2026-03-01 15:51:27 +01:00
- [Adding host groups ](#adding-host-groups )
2026-03-02 00:55:03 +01:00
- [Adding service groups ](#adding-service-groups )
2026-03-02 14:25:35 +01:00
- [Adding time periods ](#adding-time-periods )
- [Adding custom commands ](#adding-custom-commands )
- [Adding templates ](#adding-templates )
2026-02-02 23:38:50 +01:00
- [PuppetDB ](#puppetdb )
- [SELINUX ](#selinux )
- [Support ](#support )
- [Tests ](#tests )
- [Contact Us ](#contact-us )
- [Disclaimer ](#disclaimer )
2021-09-13 14:00:17 +02:00
## Synopsis
2017-07-20 14:47:24 +01:00
Nagios is a powerful open source software solution for monitoring your IT environments.
2026-02-19 16:49:23 +01:00
`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` .
2017-07-20 14:47:24 +01:00
2026-02-21 13:18:33 +01:00
At this stage, the module is being redeveloped and being built to the latest standards for Puppet 8.
2021-09-13 14:00:17 +02:00
## 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***
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## Features
2017-07-20 14:47:24 +01:00
2026-02-13 15:45:09 +01:00
- 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
2026-03-01 16:31:12 +01:00
- 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
2026-03-01 16:50:24 +01:00
- hostgroups are filled in via define, hosts are added dynamically via target.pp.
2026-02-21 13:44:41 +01:00
- configures all required directories for server and clients and sets proper permissions and selinux contexts
2026-02-21 14:04:06 +01:00
- configures the main nagios configuration file and sets values as (pre)configured per values in params, which can be overwritten.
- if `ng_include_nrpe` is set to `true` , the confdroid_nrpe module is automatically applied on clients ([confdroid_nrpe ](https://sourcecode.confdroid.com/confdroid/confdroid_nrpe ) must be in the catalogue then)
2026-02-13 15:45:09 +01:00
2026-03-01 16:15:06 +01:00
## 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
```ruby
node 'example.example.net' {
include confdroid_nagios
}
```
- through Foreman:
2026-03-01 17:02:30 +01:00
In order to apply parameters through Foreman, **confdroid_nagios::params ** - must be added to the host or host group in question.
2026-03-01 16:15:06 +01:00
See [more details about class deployment on confdroid.com ](https://confdroid.com/2017/05/deploying-our-puppet-modules/ ).
## Configuration
2026-03-01 15:12:15 +01:00
### configuring UI user access
2026-02-28 15:52:55 +01:00
2026-03-01 17:02:30 +01:00
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:
2026-02-28 15:52:55 +01:00
```bash
htpasswd -B -n testuser
New password:
Re-type new password:
```
This results in
```text
testuser: $2y$05$rNy/P22OfYZlpdEPnCAIg.OUizRD34P7pDRwUGiaYjH44PcRuZ2ia
```
Use that value to override the default password in ENC or Hiera, if you use it.
2026-03-01 15:12:15 +01:00
### Additional UI users
2026-02-28 15:52:55 +01:00
2026-03-02 15:01:55 +01:00
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:
2026-02-28 15:52:55 +01:00
```puppet
confdroid_nagios::server::access { 'example':
ng_htpasswd_user => 'example_user',
ng_htpasswd_password => 'example_password_encrypted'
}
2026-03-01 15:12:15 +01:00
```
### 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:
```puppet
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.
2026-03-02 15:01:55 +01:00
Alternatively you also can create a custom class within this module and use the export command like this:
```puppet
@@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',
}
```
2026-03-01 15:12:15 +01:00
### 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:
```puppet
confdroid_nagios::nagios::objects::add_contactgroups { 'example_group':
ng_contactgroup_name => 'example_group',
ng_contactgroup_alias => 'Example Group',
ng_contactgroup_register => '1',
}
2026-02-28 15:52:55 +01:00
```
2026-02-14 21:21:43 +01:00
2026-03-02 15:01:55 +01:00
Alternatively you also can create a custom class within this module and use the export command like this:
```puppet
@@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,
}
```
2026-03-01 15:51:27 +01:00
### 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:
```puppet
confdroid_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
ng_hostgroup_name => 'example_hostgroup',
ng_hostgroup_alias => 'Example Hostgroup',
}
```
2026-03-02 15:01:55 +01:00
Alternatively you also can create a custom class within this module and use the export command like this:
```puppet
@@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.
2026-03-01 15:51:27 +01:00
2026-03-02 00:55:03 +01:00
### Adding service groups
2026-03-02 15:01:55 +01:00
In order to add service groups, address the define `confdroid_nagios::nagios::objects::add_servicegroups` in your config repo, site.pp etc. like this:
```puppet
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:
```puppet
@@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,
}
```
2026-03-02 00:55:03 +01:00
2026-03-02 14:25:35 +01:00
### Adding time periods
2026-03-02 00:55:03 +01:00
2026-03-02 15:01:55 +01:00
In order to add time periods, address the define `confdroid_nagios::nagios::objects::add_timeperiods` in your config repo, site.pp etc. like this:
```puppet
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:
```puppet
@@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,
}
```
2026-03-02 00:55:03 +01:00
2026-03-02 14:25:35 +01:00
### Adding custom commands
2026-03-02 00:55:03 +01:00
2026-03-02 15:01:55 +01:00
Commands are defined in `confdroid_nagios::nagios::objects::commands` and deployed /etc/nagios/conf.d/nagios_commands_base.cfg through PuppetDB exports like this:
```puppet
@@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,
}
```
2026-03-02 00:55:03 +01:00
2026-03-02 14:25:35 +01:00
### Adding templates
2026-03-02 15:01:55 +01:00
In order to add time periods, address the define `confdroid_nagios::nagios::objects::add_templates` in your config repo, site.pp etc. like this:
```puppet
confdroid_nagios::nagios::objects::templates { 'generic contact':
ng_template_object => 'contact',
ng_template_object_name => 'generic-contact',
}
```
2021-09-13 14:00:17 +02:00
## PuppetDB
2017-07-20 14:47:24 +01:00
2025-05-21 12:02:34 +02:00
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 ](https://gitlab.confdroid.com/puppet/cd_puppetdb ) is available to automate this task for you as well within a few minutes.
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## SELINUX
2017-07-20 14:47:24 +01:00
All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.
2021-09-13 14:00:17 +02:00
## Support
2026-02-12 16:49:36 +01:00
- OS: Rocky 9
- Puppet 7 # Puppet does not support Nagios in Puppet 8 anymore, although it still works
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## Tests
2017-07-20 14:47:24 +01:00
2026-02-12 16:49:36 +01:00
- 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
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## Contact Us
2017-07-20 14:47:24 +01:00
2026-02-12 16:49:36 +01:00
- [contact Us ](https://confdroid.com/contact/ )
- [Feedback Portal ](https://feedback.confdroid.com/ )
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## Disclaimer
2026-03-01 15:51:27 +01:00
confdroid as entity is entirely independent from Puppet. We provide custom configuration modules, written for specific purposes and specific environments.
2017-07-20 14:47:24 +01:00
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.