From 989fb446c1db090f7f9a4d1401b5ba83681af581 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Thu, 26 Jun 2014 17:21:27 -0700 Subject: new resource collector for 'ps' checks --- manifests/ps.pp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 manifests/ps.pp (limited to 'manifests/ps.pp') diff --git a/manifests/ps.pp b/manifests/ps.pp new file mode 100644 index 0000000..c84f583 --- /dev/null +++ b/manifests/ps.pp @@ -0,0 +1,29 @@ +define check_mk::ps ( + $target, + $host, + $desc, + $procname = "/usr/sbin/${desc}", + $levels = '1, 1, 1, 1', + $user = undef +) { + + # lines 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. + concat::fragment { "check_mk_ps-${host}_${desc}": + target => $target, + content => $check, + order => 20 + } +} + -- cgit v1.2.3