2026-02-10 17:43:42 +01:00
|
|
|
## confdroid_nrpe::commands::definition_rules.pp
|
|
|
|
|
# Module name: confdroid_nrpe
|
|
|
|
|
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
2017-07-30 12:32:29 +01:00
|
|
|
# @summary manage command definitions via define and Puppet rules.
|
2017-07-30 12:50:55 +01:00
|
|
|
# @example
|
2026-02-10 17:43:42 +01:00
|
|
|
# confdroid_nrpe::commands::definitions { 'check_users':
|
2025-05-12 16:58:52 +02:00
|
|
|
# ne_check_cmd => 'check_users',
|
|
|
|
|
# ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
|
|
|
|
# ne_cmd_comment => 'check the amount of user logged in locally',
|
2017-07-30 12:50:55 +01:00
|
|
|
# }
|
2017-07-30 12:32:29 +01:00
|
|
|
###############################################################################
|
2026-02-10 17:43:42 +01:00
|
|
|
class confdroid_nrpe::commands::definition_rules (
|
2017-07-30 12:32:29 +01:00
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
) inherits confdroid_nrpe::params {
|
2017-07-30 12:32:29 +01:00
|
|
|
if $ne_manage_cmds == true {
|
2026-02-10 17:43:42 +01:00
|
|
|
require confdroid_nrpe::main::files
|
2017-07-30 21:21:12 +01:00
|
|
|
|
2017-07-30 12:32:29 +01:00
|
|
|
# manage the commands.cfg file
|
|
|
|
|
|
|
|
|
|
concat { $ne_cmd_file:
|
2025-05-12 16:58:52 +02:00
|
|
|
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],
|
2017-07-30 12:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# manage the file header
|
|
|
|
|
|
|
|
|
|
concat::fragment { 'nrpe_cmd_header':
|
2025-05-12 16:58:52 +02:00
|
|
|
target => $ne_cmd_file,
|
|
|
|
|
content => template($ne_cmd_head_erb),
|
|
|
|
|
order => '000',
|
2017-07-30 12:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# basic example rules
|
|
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
confdroid_nrpe::commands::definitions { 'check_users':
|
2026-03-11 16:54:35 +01:00
|
|
|
ne_check_name => 'check_users',
|
2025-05-12 16:58:52 +02:00
|
|
|
ne_check_cmd => 'check_users',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
|
|
|
|
ne_cmd_comment => 'check the amount of user logged in locally',
|
2017-07-30 12:50:55 +01:00
|
|
|
}
|
2026-03-11 16:54:35 +01:00
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
confdroid_nrpe::commands::definitions { 'check_load':
|
2026-03-11 16:54:35 +01:00
|
|
|
ne_check_name => 'check_load',
|
2025-05-12 16:58:52 +02:00
|
|
|
ne_check_cmd => 'check_load',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
2017-07-30 13:06:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
confdroid_nrpe::commands::definitions { 'check_disk':
|
2026-03-11 16:54:35 +01:00
|
|
|
ne_check_name => 'check_disk',
|
2025-05-12 16:58:52 +02:00
|
|
|
ne_check_cmd => 'check_disk',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -p $ARG3$',
|
2017-07-30 13:06:19 +01:00
|
|
|
}
|
2017-07-30 12:32:29 +01:00
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
confdroid_nrpe::commands::definitions { 'check_procs':
|
2026-03-11 16:54:35 +01:00
|
|
|
ne_check_name => 'check_procs',
|
2025-05-12 16:58:52 +02:00
|
|
|
ne_check_cmd => 'check_procs',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$ -s $ARG3$',
|
2017-07-30 13:06:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-10 17:43:42 +01:00
|
|
|
confdroid_nrpe::commands::definitions { 'check_swap':
|
2026-03-11 16:54:35 +01:00
|
|
|
ne_check_name => 'check_swap',
|
2025-05-12 16:58:52 +02:00
|
|
|
ne_check_cmd => 'check_swap',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
2017-07-30 13:06:19 +01:00
|
|
|
}
|
2026-03-11 16:30:12 +01:00
|
|
|
|
|
|
|
|
confdroid_nrpe::commands::definitions { 'check_fail2ban':
|
2026-03-11 16:48:50 +01:00
|
|
|
ne_check_name => 'check_fail2ban',
|
2026-03-11 16:30:12 +01:00
|
|
|
ne_check_cmd => 'check_procs',
|
2026-03-11 16:48:50 +01:00
|
|
|
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
2026-03-11 16:30:12 +01:00
|
|
|
}
|
2017-07-30 12:32:29 +01:00
|
|
|
}
|
|
|
|
|
}
|