From e66581b620d89e81ec02754005f3e3fa2bc603cf Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 25 Oct 2015 16:28:46 +0100 Subject: add an imap_login check --- manifests/command/imap_pop3.pp | 5 ++++- manifests/plugins/imap_login.pp | 7 +++++++ manifests/service/imap_login.pp | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 manifests/plugins/imap_login.pp create mode 100644 manifests/service/imap_login.pp (limited to 'manifests') diff --git a/manifests/command/imap_pop3.pp b/manifests/command/imap_pop3.pp index f3637a7..fbe4182 100644 --- a/manifests/command/imap_pop3.pp +++ b/manifests/command/imap_pop3.pp @@ -1,7 +1,8 @@ # manage mail checks class nagios::command::imap_pop3 { + require ::nagios::plugins::imap_login case $::operatingsystem { - debian,ubuntu: { } # Debian/Ubuntu already define those checks + 'Debian','Ubuntu': { } # Debian/Ubuntu already define those checks default: { nagios_command { 'check_imap': @@ -21,5 +22,7 @@ class nagios::command::imap_pop3 { command_line => '$USER1$/check_tcp -H $ARG1$ -p 4190'; 'check_managesieve_legacy': command_line => '$USER1$/check_tcp -H $ARG1$ -p 2000'; + 'check_imap_login': + command_line => '$USER1$/check_imap_login -H $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$'; } } diff --git a/manifests/plugins/imap_login.pp b/manifests/plugins/imap_login.pp new file mode 100644 index 0000000..bb53b81 --- /dev/null +++ b/manifests/plugins/imap_login.pp @@ -0,0 +1,7 @@ +# a simple imap login check +class nagios::plugins::imap_login { + nagios::plugin { 'check_imap_login': + source => 'nagios/plugins/check_imap_login', + } +} + diff --git a/manifests/service/imap_login.pp b/manifests/service/imap_login.pp new file mode 100644 index 0000000..53c432a --- /dev/null +++ b/manifests/service/imap_login.pp @@ -0,0 +1,20 @@ +# a imap login check +define nagios::service::imap_login( + $username, + $password, + $warning = 5, + $critical = 10, + $host = $::fqdn, + $ensure = 'present', +){ + nagios::service{ + "imap_login_${name}": + ensure => $ensure; + } + + if $ensure != 'absent' { + Nagios::Service["imap_login_${name}"]{ + check_command => "check_imap_login!${host}!${username}!${password}!${warning}!${critical}", + } + } +} -- cgit v1.2.3