From e784e03300e0c055bf64999f1146590df10d3f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Tue, 7 May 2013 20:52:04 +0300 Subject: [PATCH] nagios: Added TCP connect check support. --- nagios/manifests/target.pp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/nagios/manifests/target.pp b/nagios/manifests/target.pp index 612ebc0..237e0c8 100644 --- a/nagios/manifests/target.pp +++ b/nagios/manifests/target.pp @@ -100,6 +100,42 @@ class nagios::target::smtp inherits nagios::target { } +# Configure tcp connect service target. +# +# === Parameters +# +# $name: +# Short name +# $port: +# Port where to connect +# $description: +# Description of service. Defaults to $name +# +# === Sample usage +# +# nagios::target::tcp { "git": +# port => "9418", +# description => "GIT", +# } +# +define nagios::target::tcp($port, $description=undef) { + + include nagios::target + + if ! $description { + $description = $name + } + + @@nagios::service { "${::homename}_${name}": + command => "check_tcp!${port}", + description => $description, + group => $nagios::target::group, + host => $::homename, + } + +} + + # Configure nagios nrpe target. # class nagios::target::nrpe inherits nagios::target {