2017-07-30 12:32:29 +01:00
|
|
|
## cd_nrpe::commands::definition_rules.pp
|
|
|
|
|
# Module name: cd_nrpe
|
|
|
|
|
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
|
|
|
|
# # License:
|
|
|
|
|
# This file is part of cd_nrpe.
|
|
|
|
|
#
|
|
|
|
|
# cd_nrpe is used for providing automatic configuration of NRPE.
|
|
|
|
|
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
# @summary manage command definitions via define and Puppet rules.
|
2017-07-30 12:50:55 +01:00
|
|
|
# @example
|
|
|
|
|
# cd_nrpe::commands::definitions { 'check_users':
|
|
|
|
|
# ne_check_cmd => 'check_users',
|
|
|
|
|
# ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
2017-07-30 13:17:19 +01:00
|
|
|
# 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
|
|
|
###############################################################################
|
2017-07-30 12:42:09 +01:00
|
|
|
class cd_nrpe::commands::definition_rules (
|
2017-07-30 12:32:29 +01:00
|
|
|
|
|
|
|
|
) inherits cd_nrpe::params {
|
|
|
|
|
|
|
|
|
|
if $ne_manage_cmds == true {
|
|
|
|
|
|
2017-07-30 21:26:22 +01:00
|
|
|
require cd_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:
|
|
|
|
|
ensure => present,
|
|
|
|
|
path => $ne_cmd_file,
|
2017-07-30 13:32:50 +01:00
|
|
|
owner => $ne_user,
|
|
|
|
|
group => $ne_user,
|
2017-07-30 12:32:29 +01:00
|
|
|
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
|
|
|
|
|
|
2017-07-30 12:50:55 +01:00
|
|
|
cd_nrpe::commands::definitions { 'check_users':
|
|
|
|
|
ne_check_cmd => 'check_users',
|
|
|
|
|
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
|
2017-07-30 13:17:19 +01:00
|
|
|
ne_cmd_comment => 'check the amount of user logged in locally',
|
2017-07-30 12:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
2017-07-30 13:06:19 +01:00
|
|
|
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$',
|
|
|
|
|
}
|
2017-07-30 12:32:29 +01:00
|
|
|
|
2017-07-30 13:06:19 +01:00
|
|
|
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$',
|
|
|
|
|
}
|
2017-07-30 12:32:29 +01:00
|
|
|
}
|
|
|
|
|
}
|