diff options
author | Micah <micah@leap.se> | 2016-07-12 16:46:32 -0400 |
---|---|---|
committer | Micah <micah@leap.se> | 2016-07-12 16:46:32 -0400 |
commit | 56a771a3008d10720dd05fd815aeafbacdd1e08e (patch) | |
tree | 4b96fc087072834759eafd6949391de73ac43737 /puppet/modules/check_mk/manifests/ps.pp | |
parent | a75fea409bf8e62e55ba341672c202aab5fa480e (diff) |
git subrepo clone https://leap.se/git/puppet_check_mk puppet/modules/check_mk
subrepo:
subdir: "puppet/modules/check_mk"
merged: "aa02571"
upstream:
origin: "https://leap.se/git/puppet_check_mk"
branch: "master"
commit: "aa02571"
git-subrepo:
version: "0.3.0"
origin: "https://github.com/ingydotnet/git-subrepo"
commit: "1e79595"
Change-Id: I6cb060eb80966dd6ae346f7a8105289caa9ccbaf
Diffstat (limited to 'puppet/modules/check_mk/manifests/ps.pp')
-rw-r--r-- | puppet/modules/check_mk/manifests/ps.pp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/puppet/modules/check_mk/manifests/ps.pp b/puppet/modules/check_mk/manifests/ps.pp new file mode 100644 index 00000000..1171a135 --- /dev/null +++ b/puppet/modules/check_mk/manifests/ps.pp @@ -0,0 +1,34 @@ +define check_mk::ps ( + $target, + $host, + $desc, + $procname = "/usr/sbin/${desc}", + $levels = '1, 1, 1, 1', + $user = undef +) { + # This class is called on check-mk agent machines in order to create + # checks using the built-in ps check type. They create stored configs + # and then the check_mk::server::collect_ps class on the server + # generates the config file to set them up + + # lines in the ps.mk config file look like + # ( "foo.example.com", "ps", "NAME", ( "/usr/sbin/foo", 1, 1, 1, 1 ) ) + # or with a user + # ( "foo.example.com", "ps", "NAME", ( "/usr/sbin/foo", "user", 1, 1, 1, 1 ) ) + if $user { + $check = " ( \"${host}\", \"ps\", \"${desc}\", ( \"${procname}\", ${user}, ${levels} ) ),\n" + } else { + $check = " ( \"${host}\", \"ps\", \"${desc}\", ( \"${procname}\", ${levels} ) ),\n" + } + + # FIXME: we could be smarter about this and consolidate host checks + # that have identical settings and that would make the config file + # make more sense for humans. but for now we'll just do separate + # lines (which may result in a very large file, but check-mk is fine) + concat::fragment { "check_mk_ps-${host}_${desc}": + target => $target, + content => $check, + order => 20 + } +} + |