Files
confdroid_nrpe/manifests/commands/definition_rules.pp
2025-05-12 16:58:52 +02:00

70 lines
2.0 KiB
Puppet

## cd_nrpe::commands::definition_rules.pp
# Module name: cd_nrpe
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary manage command definitions via define and Puppet rules.
# @example
# cd_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',
# }
###############################################################################
class cd_nrpe::commands::definition_rules (
) inherits cd_nrpe::params {
if $ne_manage_cmds == true {
require cd_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
cd_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',
}
cd_nrpe::commands::definitions { 'check_load':
ne_check_cmd => 'check_load',
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
}
cd_nrpe::commands::definitions { 'check_disk':
ne_check_cmd => 'check_disk',
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -p $ARG3$',
}
cd_nrpe::commands::definitions { 'check_procs':
ne_check_cmd => 'check_procs',
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -s $ARG3$',
}
cd_nrpe::commands::definitions { 'check_swap':
ne_check_cmd => 'check_swap',
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
}
}
}