Files
confdroid_nagios/doc/file.README.html
2026-03-12 11:05:14 +01:00

427 lines
17 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: README
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> &raquo;
<span class="title">File: README</span>
</div>
<div id="search">
<a class="full_list_link" id="puppet_class_list_link"
href="puppet_class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'>
<h1 id="label-Readme">Readme</h1>
<p><a href="https://jenkins.confdroid.com/job/confdroid_nagios/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_nagios&amp;style=plastic"></a> <a href="https://sonarqube.confdroid.com/dashboard?id=confdroid_nagios"><img src="https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_nagios&amp;metric=security_hotspots&amp;token=sqb_927c2cd1f1b90805cde962af0f5eda9ec936eb6f"></a></p>
<ul><li>
<p><a href="#readme">Readme</a></p>
</li><li>
<p><a href="#synopsis">Synopsis</a></p>
</li><li>
<p><a href="#warning">WARNING</a></p>
</li><li>
<p><a href="#features">Features</a></p>
</li><li>
<p><a href="#repo-documentation">Repo Documentation</a></p>
</li><li>
<p><a href="#dependencies">Dependencies</a></p>
</li><li>
<p><a href="#deployment">Deployment</a></p>
</li><li>
<p><a href="#configuration">Configuration</a></p>
<ul><li>
<p><a href="#configuring-ui-user-access">configuring UI user access</a></p>
</li><li>
<p><a href="#additional-ui-users">Additional UI users</a></p>
</li><li>
<p><a href="#adding-contacts">Adding contacts</a></p>
</li><li>
<p><a href="#adding-contact-groups">Adding contact groups</a></p>
</li><li>
<p><a href="#adding-host-groups">Adding host groups</a></p>
</li><li>
<p><a href="#adding-service-groups">Adding service groups</a></p>
</li><li>
<p><a href="#adding-time-periods">Adding time periods</a></p>
</li><li>
<p><a href="#adding-custom-commands">Adding custom commands</a></p>
</li><li>
<p><a href="#adding-templates">Adding templates</a></p>
</li></ul>
</li><li>
<p><a href="#puppetdb">PuppetDB</a></p>
</li><li>
<p><a href="#selinux">SELINUX</a></p>
</li><li>
<p><a href="#support">Support</a></p>
</li><li>
<p><a href="#tests">Tests</a></p>
</li><li>
<p><a href="#contact-us">Contact Us</a></p>
</li><li>
<p><a href="#disclaimer">Disclaimer</a></p>
</li></ul>
<h2 id="label-Synopsis">Synopsis</h2>
<p>Nagios is a powerful open source software solution for monitoring your IT environments.</p>
<p><code>confdroid_nagios</code> is a Puppet module allowing to fully automate the setup &amp; configuration of the Nagios server, as well as actively adding client hosts and services to the monitoring environment through defines and <code>PuppetDB</code>.</p>
<p>At this stage, the module is being redeveloped and being built to the latest standards for Puppet 8.</p>
<h2 id="label-WARNING">WARNING</h2>
<blockquote>
<p><strong>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</strong></p>
</blockquote>
<h2 id="label-Features">Features</h2>
<ul><li>
<p>if FQDN equals the specified <code>ng_nagios_server</code>, nagios server with all required specs is installed, else only nagios client packages and the target specs</p>
</li><li>
<p>an additional directory /etc/nagios/conf.d is created to place the custom checks etc. without being overwritten by updates.</p>
</li><li>
<p>contacts and contactgroups are separated and filled in via define</p>
</li><li>
<p>hostgroups are filled in via define, hosts are added dynamically via target.pp.</p>
</li><li>
<p>configures all required directories for server and clients and sets proper permissions and selinux contexts</p>
</li><li>
<p>configures the main nagios configuration file and sets values as (pre)configured per values in params, which can be overwritten.</p>
</li><li>
<p>if <code>ng_include_nrpe</code>is set to <code>true</code>, the confdroid_nrpe module is automatically applied on clients (<a href="https://sourcecode.confdroid.com/confdroid/confdroid_nrpe">confdroid_nrpe</a> must be in the catalogue then)</p>
</li></ul>
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
<p>See the full Puppet documentation including parameters in <code>docs/index.html</code></p>
<h2 id="label-Dependencies">Dependencies</h2>
<p>All dependencies must be included in the catalogue.</p>
<ul><li>
<p><code>puppetlabs-firewall</code></p>
</li><li>
<p><code>puppetlabs-stdlib</code></p>
</li><li>
<p><code>puppetlabs-concat</code></p>
</li><li>
<p><code>puppetlabs-nagios_core</code></p>
</li></ul>
<h2 id="label-Deployment">Deployment</h2>
<ul><li>
<p>native Puppet deployment</p>
</li></ul>
<p>via site.pp or nodes.pp</p>
<pre class="code ruby"><code class="ruby">node &#39;example.example.net&#39; {
include confdroid_nagios
}
</code></pre>
<ul><li>
<p>through Foreman:</p>
</li></ul>
<p>In order to apply parameters through Foreman, <strong>confdroid_nagios::params</strong>- must be added to the host or host group in question.</p>
<p>See <a href="https://confdroid.com/2017/05/deploying-our-puppet-modules/">more details about class deployment on confdroid.com</a>.</p>
<h2 id="label-Configuration">Configuration</h2>
<h3 id="label-configuring+UI+user+access">configuring UI user access</h3>
<p>Main access to the user interface requires defining an administrative user and password via <code>ng_main_user</code> and <code>ng_main_password</code>. The password should be encrypted like this:</p>
<pre class="code ruby"><code class="ruby">htpasswd -B -n testuser
New password:
Re-type new password:
</code></pre>
<p>This results in</p>
<pre class="code ruby"><code class="ruby">testuser: $2y$05$rNy/P22OfYZlpdEPnCAIg.OUizRD34P7pDRwUGiaYjH44PcRuZ2ia
</code></pre>
<p>Use that value to override the default password in ENC or Hiera, if you use it.</p>
<h3 id="label-Additional+UI+users">Additional UI users</h3>
<p>The main user is automatically created. If you want to add more users, this should be done via the define <code>confdroid_nagios::server::access</code>. In your control repo, site.pp etc. address the access define like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::server::access { &#39;example&#39;:
ng_htpasswd_user =&gt; &#39;example_user&#39;,
ng_htpasswd_password =&gt; &#39;example_password_encrypted&#39;
}
</code></pre>
<h3 id="label-Adding+contacts">Adding contacts</h3>
<p>In order to add contacts for the notifications, address the define <code>confdroid_nagios::nagios::objects::add_contact</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::add_contact { &#39;example_user&#39;:
ng_contact_name =&gt; &#39;example_user&#39;,
ng_contact_alias =&gt; &#39;Example User&#39;,
ng_contact_groups =&gt; &#39;admins&#39;,
ng_contact_email =&gt; &#39;example@example.net&#39;,
}
</code></pre>
<p>This requires the contact groups to be in place as well.</p>
<p>Alternatively you also can create a custom class within this module and use the export command like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_contact { &#39;ops&#39;:
ensure =&gt; present,
alias =&gt; &#39;Operations&#39;,
contact_name =&gt; &#39;ops&#39;,
contactgroups =&gt; &#39;operations&#39;,
email =&gt; &#39;ops@example.net&#39;,
can_submit_commands =&gt; &#39;1&#39;,
register =&gt; &#39;1&#39;,
use =&gt; &#39;generic-contact&#39;,
target =&gt; $ng_target_base_contact,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
}
</code></pre>
<h3 id="label-Adding+contact+groups">Adding contact groups</h3>
<p>In order to add contact groups for the notifications, address the define <code>confdroid_nagios::nagios::objects::add_contactgroups</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::add_contactgroups { &#39;example_group&#39;:
ng_contactgroup_name =&gt; &#39;example_group&#39;,
ng_contactgroup_alias =&gt; &#39;Example Group&#39;,
ng_contactgroup_register =&gt; &#39;1&#39;,
}
</code></pre>
<p>Alternatively you also can create a custom class within this module and use the export command like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_contactgroup { &#39;operations&#39;:
ensure =&gt; present,
alias =&gt; &#39;Operations Team&#39;,
contactgroup_name =&gt; &#39;operations&#39;,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
register =&gt; &#39;1&#39;,
target =&gt; $ng_tgt_contactgroup_base,
}
</code></pre>
<h3 id="label-Adding+host+groups">Adding host groups</h3>
<p>In order to add host groups, address the define <code>confdroid_nagios::nagios::objects::add_hostgroups</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::add_hostgroups { &#39;example_hostgroup&#39;:
ng_hostgroup_name =&gt; &#39;example_hostgroup&#39;,
ng_hostgroup_alias =&gt; &#39;Example Hostgroup&#39;,
}
</code></pre>
<p>Alternatively you also can create a custom class within this module and use the export command like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_hostgroup { &#39;rhel-servers&#39;:
ensure =&gt; present,
hostgroup_name =&gt; &#39;rhel-servers&#39;,
alias =&gt; &#39;RHEL Servers&#39;,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
register =&gt; &#39;1&#39;,
target =&gt; $ng_target_hostgroup_base,
}
</code></pre>
<p>Hosts themselves will be populated through the target.pp dynamically.</p>
<h3 id="label-Adding+service+groups">Adding service groups</h3>
<p>In order to add service groups, address the define <code>confdroid_nagios::nagios::objects::add_servicegroups</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::add_servicegroups { &#39;example_servicegroup&#39;:
ng_servicegroup_name =&gt; &#39;example_servicegroup&#39;,
ng_servicegroup_alias =&gt; &#39;Example servicegroup&#39;,
}
</code></pre>
<p>Alternatively you also can create a custom class within this module and use the export command like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_servicegroup { &#39;network-services&#39;:
ensure =&gt; present,
servicegroup_name =&gt; &#39;network-services&#39;,
alias =&gt; &#39;Network Services&#39;,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
register =&gt; &#39;1&#39;,
target =&gt; $ng_target_svcgrp_base,
}
</code></pre>
<h3 id="label-Adding+time+periods">Adding time periods</h3>
<p>In order to add time periods, address the define <code>confdroid_nagios::nagios::objects::add_timeperiods</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::add_timeperiods { &#39;example_timeperiod&#39;:
ng_timep_name =&gt; &#39;example_timeperiod&#39;,
ng_timep_alias =&gt; &#39;Example timeperiod&#39;,
ng_timep_monday =&gt; &#39;00:00-00:00&#39;,
ng_timep_tuesday =&gt; &#39;00:00-00:00&#39;,
ng_timep_wednesday =&gt; &#39;00:00-00:00&#39;,
ng_timep_thursday =&gt; &#39;00:00-00:00&#39;,
ng_timep_friday =&gt; &#39;00:00-00:00&#39;,
ng_timep_saturday =&gt; &#39;00:00-00:00&#39;,
ng_timep_sunday =&gt; &#39;00:00-00:00&#39;,
}
</code></pre>
<p>Alternatively you also can create a custom class within this module and use the export command like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_timeperiod { &#39;office_hours&#39;:
ensure =&gt; present,
timeperiod_name =&gt; &#39;office_hours&#39;,
alias =&gt; &#39;Office hours only, 5 Days A Week 09-05&#39;,
monday =&gt; &#39;09:00-17:00&#39;,
tuesday =&gt; &#39;09:00-17:00&#39;,
wednesday =&gt; &#39;09:00-17:00&#39;,
thursday =&gt; &#39;09:00-17:00&#39;,
friday =&gt; &#39;09:00-17:00&#39;,
saturday =&gt; &#39;00:00-00:00&#39;,
sunday =&gt; &#39;00:00-00:00&#39;,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
register =&gt; &#39;1&#39;,
target =&gt; $ng_tgt_timeperiods_base,
}
</code></pre>
<h3 id="label-Adding+custom+commands">Adding custom commands</h3>
<p>Commands are defined in <code>confdroid_nagios::nagios::objects::commands</code> and deployed /etc/nagios/conf.d/nagios_commands_base.cfg through PuppetDB exports like this:</p>
<pre class="code ruby"><code class="ruby">@@nagios_command { &#39;check_disk&#39;:
ensure =&gt; present,
command_name =&gt; &#39;check_disk&#39;,
command_line =&gt; &#39;$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$&#39;,
owner =&gt; $ng_user,
group =&gt; $ng_user,
mode =&gt; &#39;0640&#39;,
target =&gt; $ng_target_command,
}
</code></pre>
<h3 id="label-Adding+templates">Adding templates</h3>
<p>In order to add time periods, address the define <code>confdroid_nagios::nagios::objects::add_templates</code> in your config repo, site.pp etc. like this:</p>
<pre class="code ruby"><code class="ruby">confdroid_nagios::nagios::objects::templates { &#39;generic contact&#39;:
ng_template_object =&gt; &#39;contact&#39;,
ng_template_object_name =&gt; &#39;generic-contact&#39;,
}
</code></pre>
<h2 id="label-PuppetDB">PuppetDB</h2>
<p>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 <a href="https://gitlab.confdroid.com/puppet/cd_puppetdb">cd_puppetdb</a> is available to automate this task for you as well within a few minutes.</p>
<h2 id="label-SELINUX">SELINUX</h2>
<p>All files and directories are configured with correct selinux context. If selinux is disabled, these contexts are ignored.</p>
<h2 id="label-Support">Support</h2>
<ul><li>
<p>OS: Rocky 9</p>
</li><li>
<p>Puppet 7 # Puppet does not support Nagios in Puppet 8 anymore, although it still works</p>
</li></ul>
<h2 id="label-Tests">Tests</h2>
<ul><li>
<p>Puppet Lint</p>
</li><li>
<p>excluded tests:</p>
<ul><li>
<p><code>--no-variable_scope-check</code>: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.</p>
</li></ul>
</li><li>
<p>Puppet Parser</p>
</li><li>
<p>ERB Template Parser</p>
</li><li>
<p>Sonar Quality Gate</p>
</li></ul>
<h2 id="label-Contact+Us">Contact Us</h2>
<ul><li>
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
</li><li>
<p><a href="https://feedback.confdroid.com/">Feedback Portal</a></p>
</li></ul>
<h2 id="label-Disclaimer">Disclaimer</h2>
<p>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.</p>
</div></div>
<div id="footer">
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
</div>
</div>
</body>
</html>