Puppet Class: confdroid_nagios::nagios::objects::add_hostgroup_rules

Inherits:
confdroid_nagios::params
Defined in:
manifests/nagios/objects/add_hostgroup_rules.pp

Summary

Class manages /etc/nagios_conf.d/nagios_hostgroups_add.cfg and additional hostgroups through external Puppet rules via define.

Overview

confdroid_nagios::nagios::objects::add_hostgroup_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)

Examples:

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


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'manifests/nagios/objects/add_hostgroup_rules.pp', line 12

class confdroid_nagios::nagios::objects::add_hostgroup_rules (

) inherits confdroid_nagios::params {
  if $ng_nagios_server == $fqdn {
    # manage /etc/nagios_conf.d/nagios_hostgroups_add.cfg

    concat { $ng_tgt_hostgroup_add:
      ensure   => present,
      path     => $ng_tgt_hostgroup_add,
      owner    => 'nagios',
      group    => 'nagios',
      mode     => '0640',
      selrange => s0,
      selrole  => object_r,
      seltype  => nagios_etc_t,
      seluser  => system_u,
      notify   => Service[$ng_service],
    }

    # manage file header

    concat::fragment { 'hostgroups_header':
      target  => $ng_tgt_hostgroup_add,
      content => template($ng_tgt_hostgrp_head_erb),
      order   => '000',
    }

    # add hostgroup rules through defines and parameters
    confdroid_nagios::nagios::objects::add_hostgroups { $ng_hostgroup_name:
      ng_hostgroup_name  => $ng_hostgroup_name,
      ng_hostgroup_alias => $ng_hostgroup_alias,
    }
  }
}