Puppet Class: confdroid_nrpe::commands::definition_rules

Inherits:
confdroid_nrpe::params
Defined in:
manifests/commands/definition_rules.pp

Summary

manage command definitions via define and Puppet rules.

Overview

confdroid_nrpe::commands::definition_rules.pp Module name: confdroid_nrpe Author: 12ww1160 (12ww1160@ConfDroid.com)

Examples:

confdroid_nrpe::commands::definitions { 'check_users':
  ne_check_cmd      => 'check_users',
  ne_cmd_argstring  => '-w $ARG1$ -c $ARG2$',
  ne_cmd_comment    => 'check the amount of user logged in locally',
}


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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'manifests/commands/definition_rules.pp', line 12

class confdroid_nrpe::commands::definition_rules (

) inherits confdroid_nrpe::params {
  if $ne_manage_cmds == true {
    require confdroid_nrpe::main::files

    # manage the commands.cfg file

    concat { $ne_cmd_file:
      ensure   => present,
      path     => $ne_cmd_file,
      owner    => $ne_user,
      group    => $ne_user,
      mode     => '0640',
      selrange => s0,
      selrole  => object_r,
      seltype  => nrpe_etc_t,
      seluser  => system_u,
      notify   => Service[$ne_service],
    }

    # manage the file header

    concat::fragment { 'nrpe_cmd_header':
      target  => $ne_cmd_file,
      content => template($ne_cmd_head_erb),
      order   => '000',
    }

    # basic example rules

    confdroid_nrpe::commands::definitions { 'check_users':
      ne_check_name    => 'check_users',
      ne_check_cmd     => 'check_users',
      ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
      ne_cmd_comment   => 'check the amount of user logged in locally',
    }

    confdroid_nrpe::commands::definitions { 'check_load':
      ne_check_name    => 'check_load',
      ne_check_cmd     => 'check_load',
      ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
    }

    confdroid_nrpe::commands::definitions { 'check_disk':
      ne_check_name    => 'check_disk',
      ne_check_cmd     => 'check_disk',
      ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -p $ARG3$',
    }

    confdroid_nrpe::commands::definitions { 'check_procs':
      ne_check_name    => 'check_procs',
      ne_check_cmd     => 'check_procs',
      ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -s $ARG3$',
    }

    confdroid_nrpe::commands::definitions { 'check_swap':
      ne_check_name    => 'check_swap',
      ne_check_cmd     => 'check_swap',
      ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
    }

    confdroid_nrpe::commands::definitions { 'check_fail2ban':
      ne_check_name    => 'check_fail2ban',
      ne_check_cmd     => 'check_procs',
      ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
    }
  }
}