Files
confdroid_nagios/README.md

151 lines
7.3 KiB
Markdown
Raw Normal View History

2021-09-13 14:00:17 +02:00
# Readme
2025-05-21 12:02:34 +02:00
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=cd_nagios)](https://jenkins.confdroid.com/job/cd_nagios/)
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
[[_TOC_]]
## Synopsis
2017-07-20 14:47:24 +01:00
Nagios is a powerful open source software solution for monitoring your IT environments.
2021-09-13 14:37:12 +02:00
`cd_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
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
Installation:
2021-09-13 14:00:17 +02:00
2017-07-28 13:16:40 +01:00
* Nagios Server instance:
* install httpd via cd_apache
* install Nagios server binaries on Nagios server
* Nagios clients:
* install client binaries like nagios plugins etc.
2017-07-30 20:34:53 +01:00
* include NRPE via `cd_nrpe` (optional)
2017-07-30 14:56:40 +01:00
2017-07-20 14:47:24 +01:00
Configuration
2021-09-13 14:00:17 +02:00
2017-07-20 14:47:24 +01:00
* configure all aspects of Nagios on server
2017-07-30 14:56:40 +01:00
* manage nagios service user
2017-07-20 14:47:24 +01:00
* manage directories (filesystem permissions, selinux )
2021-09-13 14:10:27 +02:00
* manage `cgi.cfg` through parameters
* manage `nagios.cfg` through parameters
2017-07-25 15:48:39 +01:00
* manage Nagios users through external Puppet rules via define
* manage Nagios commands through Puppet exports
* manage Nagios template definitions through external Puppet rules via define
* manage Nagios main contacts through Puppet exports. Additional contacts can be created through external Puppet rules via define, to avoid having to alter the module code.
2021-09-13 14:10:27 +02:00
* manage Nagios main contact groups through Puppet exports. Additional contact groups can be created through external Puppet rules via define, to avoid having to alter the module code.
* manage Nagios main host groups through Puppet exports. Additional host groups can be created through external Puppet rules via define, to avoid having to alter the module code.
* manage Nagios main service groups through Puppet exports. Additional service groups can be created through external Puppet rules via define, to avoid having to alter the module code.
2021-09-13 14:37:12 +02:00
* manage Nagios main time periods through Puppet exports. Additional time periods can be created through external Puppet rules via define, to avoid having to alter the module code.
2017-07-20 14:47:24 +01:00
* configure firewall (optional)
* configure selinux policies (optional)
2021-09-13 14:45:56 +02:00
* configure forwarding http to https (optional)
2017-07-21 15:38:51 +01:00
* manage TLS certificates through certbot (optional)
2018-04-29 11:52:22 +02:00
* manage `$user$` arguments in resource file via define
2017-07-20 14:47:24 +01:00
Service
2021-09-13 14:00:17 +02:00
2017-07-20 14:47:24 +01:00
* manage Nagios service on server
2017-07-27 13:46:46 +01:00
Monitoring
2021-09-13 14:00:17 +02:00
2017-07-27 13:46:46 +01:00
* monitor Nagios host
* monitor Nagios service
2017-07-28 12:21:20 +01:00
* monitor clients:
* ping
* root partition
* swap usage
* logged-in local users
* amount of total processes
* amount of zombie processes
* current Load
2017-07-27 13:46:46 +01:00
2021-09-13 14:00:17 +02:00
## Repo Documentation
See the full Puppet documentation including parameters in `docs/index.html`
## Dependencies
2017-07-20 14:47:24 +01:00
All dependencies must be included in the catalogue.
2025-05-21 12:02:34 +02:00
* [cd_resources](https://gitlab.confdroid.com/puppet/cd_resources) for Yum repos.
* [cd_apache](https://gitlab.confdroid.com/puppet/cd_apache) for installing httpd
* [cd_firewall](https://gitlab.confdroid.com/puppet/cd_firewall) or [puppetlabs firewall](https://github.com/puppetlabs/puppetlabs-firewall) (optional)
* [cd_selinux](https://gitlab.confdroid.com/puppet/cd_selinux) for selinux policy adjustments
* [cd_certbot](https://gitlab.confdroid.com/puppet/cd_certbot) to auto-manage TLS certificates (optional)
* [cd_nrpe](https://gitlab.confdroid.com/puppet/cd_nrpe) to manage NRPE (optional)
* [cd_stdlib](https://gitlab.confdroid.com/puppet/cd_stdlib) or [puppetlabs stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) to facilitate concat
* [cd_concat](https://gitlab.confdroid.com/puppet/cd_stdlib) or [puppetlabs concat](https://github.com/puppetlabs/puppetlabs-concat) to concatenate configuration files from different sources.
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
## Deployment
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
* native Puppet deployment
2017-07-20 14:47:24 +01:00
via site.pp or nodes.pp
2021-09-13 14:00:17 +02:00
```ruby
2017-07-20 14:47:24 +01:00
node 'example.example.net' {
2018-04-12 13:02:41 +02:00
include cd_nagios
2017-07-20 14:47:24 +01:00
}
```
2021-09-13 14:00:17 +02:00
* through Foreman:
2017-07-20 14:47:24 +01:00
2021-09-13 14:51:43 +02:00
In order to apply parameters through Foreman, **__cd_nagios::params__** must be added to the host or host group in question.
2017-07-20 14:47:24 +01:00
2021-09-13 14:00:17 +02:00
See [more details about class deployment on Confdroid.com](https://confdroid.com/2017/05/deploying-our-puppet-modules/).
2017-07-20 14:47:24 +01:00
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
## Certbot
2021-09-13 14:51:43 +02:00
This module can optionally setup [certbot](https://certbot.eff.org/) TLS certificate management for the front-end GUI. In order to do so, set `$ng_enable_certbot` as well as `$ng_use_https` to `true` (default). Effectively, this will manage the certs before even installing Nagios, so there will be no problems with the Nagios showing up with a self-signed certificate. Once enabled, the module will go and try to obtain a certificate automatically. For this to work, you need to have proper DNS resolution set up for your domain / nagios server. Certs are also automatically renewed.
2017-07-23 14:13:02 +01:00
If you prefer to use https but use self-signed certs or your own CA, simply set to false. This will point the SSL vhost config file to the default location for TLS certificates.
2017-07-23 11:54:58 +01:00
2021-09-13 14:00:17 +02:00
## httpd vHost files
2021-09-13 14:56:13 +02:00
by default, Nagios creates its own `nagios.conf` file, which is not a vhost file and relies on the main `ssl.conf`. However, as Nagios might be running on a regular web server with various other web instances (not recommended through for performance reasons), we do not want to manage `ssl.conf` directly, hence the module creates a vhost for the SSL host.
2021-09-13 14:00:17 +02:00
## Client Connections
2017-07-23 11:54:58 +01:00
2017-07-28 13:49:05 +01:00
In order to monitor clients, NAGIOS must be able to connect to them. There are multiple ways of doing so, the most common ones being NRPE and SSH.
2021-09-13 14:56:13 +02:00
So far this module works through the usage of NRPE, which by default is enabled. Class cd_nagios::client::nrpe configures `nrpe.cfg` and opens the required firewall port on clients (optional,default).
2017-07-28 13:49:05 +01:00
2021-09-13 14:00:17 +02:00
## Known Problems
2018-10-19 18:14:32 +02:00
* Collected resources import ordering problem: The module might try to import collected facts before nagios is even installed.
2021-09-13 14:00:17 +02:00
## Support
2018-10-19 18:50:30 +02:00
* OS: CentOS 7
2021-09-13 14:00:17 +02:00
* Puppet 5
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
* 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
2021-09-13 14:00:17 +02:00
* 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
[contact Us](https://confdroid.com/contact/)
2021-09-13 14:00:17 +02:00
## Disclaimer
2017-07-20 14:47:24 +01:00
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.