summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apache.pp19
-rw-r--r--manifests/base.pp138
-rw-r--r--manifests/centos.pp2
-rw-r--r--manifests/command/imap_pop3.pp14
-rw-r--r--manifests/command/smtp.pp14
-rw-r--r--manifests/debian.pp2
-rw-r--r--manifests/defaults.pp2
-rw-r--r--manifests/defaults/commands.pp116
-rw-r--r--manifests/defaults/host_templates.pp12
-rw-r--r--manifests/defaults/hostgroups.pp20
-rw-r--r--manifests/defaults/plugins.pp10
-rw-r--r--manifests/defaults/service_templates.pp18
-rw-r--r--manifests/defaults/templates.pp13
-rw-r--r--manifests/defaults/vars.pp10
-rw-r--r--manifests/irc_bot.pp93
-rw-r--r--manifests/nsca/client.pp6
-rw-r--r--manifests/nsca/server.pp6
-rw-r--r--manifests/plugin.pp9
-rw-r--r--manifests/plugin/deploy.pp30
-rw-r--r--manifests/plugin/scriptpaths.pp6
-rw-r--r--manifests/service.pp20
-rw-r--r--manifests/service/http.pp4
-rw-r--r--manifests/service/mysql.pp83
-rw-r--r--manifests/service/smtp.pp50
-rw-r--r--manifests/service/ssmtp.pp32
-rw-r--r--manifests/target/fqdn.pp (renamed from manifests/target/nat.pp)2
26 files changed, 548 insertions, 183 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp
index 36994f8..c560e5b 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -1,4 +1,21 @@
-class nagios::apache {
+class nagios::apache inherits ::apache {
$nagios_httpd = 'apache'
include nagios
+
+ case $operatingsystem {
+ 'debian': {
+ file { "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf":
+ ensure => present,
+ source => ["puppet:///site-nagios/configs/${fqdn}/apache2.conf",
+ "puppet:///site-nagios/configs/apache2.conf",
+ "puppet:///nagios/configs/apache2.conf"],
+ }
+
+ apache::config::global { "nagios3.conf":
+ ensure => link,
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf",
+ require => File["${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf"],
+ }
+ }
+ }
}
diff --git a/manifests/base.pp b/manifests/base.pp
index 6bf2533..8b96308 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,4 +1,6 @@
class nagios::base {
+ # include the variables
+ include nagios::defaults::vars
package { 'nagios':
alias => 'nagios',
@@ -14,38 +16,37 @@ class nagios::base {
# this file should contain all the nagios_puppet-paths:
file { 'nagios_main_cfg':
- path => "${nagios_cfgdir}/nagios.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/nagios.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/nagios.cfg",
- "puppet://$server/modules/site-nagios/configs/nagios.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/nagios.cfg",
- "puppet://$server/modules/nagios/configs/nagios.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/nagios.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet:///modules/site-nagios/configs/nagios.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet:///modules/nagios/configs/nagios.cfg" ],
notify => Service['nagios'],
mode => 0644, owner => root, group => root;
}
file { 'nagios_cgi_cfg':
- path => "${nagios_cfgdir}/cgi.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/cgi.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/cgi.cfg",
- "puppet://$server/modules/site-nagios/configs/cgi.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/cgi.cfg",
- "puppet://$server/modules/nagios/configs/cgi.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/cgi.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/cgi.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet:///modules/site-nagios/configs/cgi.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet:///modules/nagios/configs/cgi.cfg" ],
mode => '0644', owner => 'root', group => 0,
notify => Service['apache'],
}
file { 'nagios_htpasswd':
- path => "${nagios_cfgdir}/htpasswd.users",
- source => [ "puppet://$server/modules/site-nagios/htpasswd.users",
- "puppet://$server/modules/nagios/htpasswd.users",
- "puppet://$server/files/etc/nagios3/htpasswd.users" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/htpasswd.users",
+ source => [ "puppet:///modules/site-nagios/htpasswd.users",
+ "puppet:///modules/nagios/htpasswd.users" ],
mode => 0640, owner => root, group => apache;
}
file { 'nagios_private':
- path => "${nagios_cfgdir}/private/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
purge => true,
recurse => true,
@@ -54,96 +55,123 @@ class nagios::base {
}
file { 'nagios_private_resource_cfg':
- path => "${nagios_cfgdir}/private/resource.cfg",
- source => "puppet://$server/modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/resource.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ "puppet:///modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ],
notify => Service['nagios'],
owner => root, group => nagios, mode => '0640';
}
file { 'nagios_confd':
- path => "${nagios_cfgdir}/conf.d/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
purge => true,
recurse => true,
notify => Service['nagios'],
mode => '0750', owner => root, group => nagios;
}
-
+ Package <<| tag == 'nagios::plugin::deploy::package' |>>
+ File <<| tag == 'nagios::plugin::deploy::file' |>>
Nagios_command <<||>>
- Nagios_contact <<||>>
Nagios_contactgroup <<||>>
- Nagios_host <<||>>
+ Nagios_contact <<||>>
+ Nagios_hostdependency <<||>>
+ Nagios_hostescalation <<||>>
Nagios_hostextinfo <<||>>
Nagios_hostgroup <<||>>
- Nagios_hostgroupescalation <<||>>
- Nagios_service <<||>>
+ Nagios_host <<||>>
Nagios_servicedependency <<||>>
Nagios_serviceescalation <<||>>
+ Nagios_servicegroup <<||>>
Nagios_serviceextinfo <<||>>
+ Nagios_service <<||>>
Nagios_timeperiod <<||>>
+ File <<| tag == 'nagios_plugin' |>>
Nagios_command <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_command.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_contact <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_contactgroup <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_host <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_host.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg",
+ require => File['nagios_confd'],
+ notify => Service['nagios'],
+ }
+ Nagios_hostdependency <||> {
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg",
+ notify => Service['nagios'],
+ }
+ Nagios_hostescalation <||> {
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg",
notify => Service['nagios'],
}
Nagios_hostextinfo <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_hostgroup <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
- Nagios_hostgroupescalation <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
+ Nagios_service <||> {
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
- Nagios_service <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_service.cfg",
+ Nagios_servicegroup <||> {
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg",
notify => Service['nagios'],
}
Nagios_servicedependency <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_serviceescalation <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_serviceextinfo <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_timeperiod <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
- file{[ "${nagios_cfgdir}/conf.d/nagios_command.cfg",
- "${nagios_cfgdir}/conf.d/nagios_contact.cfg",
- "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
- "${nagios_cfgdir}/conf.d/nagios_host.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
- "${nagios_cfgdir}/conf.d/nagios_service.cfg",
- "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
- "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
- "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
- "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]:
+ file{[ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]:
ensure => file,
replace => false,
notify => Service['nagios'],
@@ -153,8 +181,8 @@ class nagios::base {
# manage nagios cfg files
# must be defined after exported resource overrides and cfg file defs
file { 'nagios_cfgdir':
- path => "${nagios_cfgdir}/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
recurse => true,
purge => true,
diff --git a/manifests/centos.pp b/manifests/centos.pp
index 4d9507b..35379b8 100644
--- a/manifests/centos.pp
+++ b/manifests/centos.pp
@@ -1,6 +1,6 @@
class nagios::centos inherits nagios::base {
- package { [ 'nagios-plugins', 'nagios-plugins-smtp','nagios-plugins-http', 'nagios-plugins-ssh', 'nagios-plugins-udp', 'nagios-plugins-tcp', 'nagios-plugins-dig', 'nagios-plugins-nrpe', 'nagios-plugins-load', 'nagios-plugins-dns', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-users', 'nagios-plugins-ldap', 'nagios-plugins-disk', 'nagios-plugins-swap', 'nagios-plugins-nagios', 'nagios-plugins-perl', 'nagios-plugins-ntp', 'nagios-plugins-snmp' ]:
+ package { [ 'nagios-plugins', 'nagios-plugins-smtp','nagios-plugins-http', 'nagios-plugins-ssh', 'nagios-plugins-tcp', 'nagios-plugins-dig', 'nagios-plugins-nrpe', 'nagios-plugins-load', 'nagios-plugins-dns', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-users', 'nagios-plugins-ldap', 'nagios-plugins-disk', 'nagios-plugins-swap', 'nagios-plugins-nagios', 'nagios-plugins-perl', 'nagios-plugins-ntp', 'nagios-plugins-snmp' ]:
ensure => 'present',
notify => Service['nagios'],
}
diff --git a/manifests/command/imap_pop3.pp b/manifests/command/imap_pop3.pp
new file mode 100644
index 0000000..174b09c
--- /dev/null
+++ b/manifests/command/imap_pop3.pp
@@ -0,0 +1,14 @@
+class nagios::command::imap_pop3 {
+ nagios_command{
+ 'check_imap':
+ command_line => '$USER1$/check_imap -H $ARG1$ -p $ARG2$';
+ 'check_imap_ssl':
+ command_line => '$USER1$/check_imap -H $ARG1$ -p $ARG2$ -S';
+ 'check_pop3':
+ command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$';
+ 'check_pop3_ssl':
+ command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S';
+ 'check_managesieve':
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p 2000';
+ }
+}
diff --git a/manifests/command/smtp.pp b/manifests/command/smtp.pp
new file mode 100644
index 0000000..04f8543
--- /dev/null
+++ b/manifests/command/smtp.pp
@@ -0,0 +1,14 @@
+class nagios::command::smtp {
+ nagios_command{
+ 'check_smtp':
+ command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$';
+ 'check_smtp_tls':
+ command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$ -S';
+ 'check_smtp_cert':
+ command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$ -S -D $ARG3$';
+ 'check_ssmtp':
+ command_line => '$USER1$/check_ssmtp -H $ARG1$ -p $ARG2$ -S';
+ 'check_ssmtp_cert':
+ command_line => '$USER1$/check_ssmtp -H $ARG1$ -p $ARG2$ -S -D $ARG3$';
+ }
+}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index a503324..b9e87ec 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -14,7 +14,7 @@ class nagios::debian inherits nagios::base {
File['nagios_htpasswd', 'nagios_cgi_cfg'] { group => 'www-data' }
- file { "${nagios_cfgdir}/stylesheets":
+ file { "${nagios::defaults::vars::int_nagios_cfgdir}/stylesheets":
ensure => directory,
purge => false,
recurse => true,
diff --git a/manifests/defaults.pp b/manifests/defaults.pp
index 32ba335..7c25ac9 100644
--- a/manifests/defaults.pp
+++ b/manifests/defaults.pp
@@ -8,5 +8,5 @@ class nagios::defaults {
include nagios::defaults::hostgroups
include nagios::defaults::templates
include nagios::defaults::timeperiods
-
+ include nagios::defaults::plugins
}
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp
index c3190af..f542d7b 100644
--- a/manifests/defaults/commands.pp
+++ b/manifests/defaults/commands.pp
@@ -1,55 +1,91 @@
class nagios::defaults::commands {
- # common service commands
+ include nagios::command::smtp
+ include nagios::command::imap_pop3
- nagios_command {
- check_dummy:
+ # common service commands
+ case $operatingsystem {
+ debian,ubuntu: {
+ nagios_command {
+ check_dummy:
+ command_line => '$USER1$/check_dummy $ARG1$';
+ check_https_cert:
+ command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ check_http_url:
+ command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$';
+ check_http_url_regex:
+ command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$';
+ check_https_url:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$';
+ check_https_url_regex:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$';
+ check_mysql_db:
+ command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$';
+ check_ntp_time:
+ command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
+ check_silc:
+ command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
+ check_sobby:
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$';
+ check_jabber:
+ command_line => '$USER1$/check_jabber -H $ARG1$';
+ }
+ }
+ default: {
+ nagios_command {
+ check_dummy:
command_line => '$USER1$/check_dummy $ARG1$';
- check_ping:
+ check_ping:
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$';
- check-host-alive:
+ check-host-alive:
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1';
- check_tcp:
+ check_tcp:
command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$';
- check_udp:
+ check_udp:
command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$';
- check_load:
+ check_load:
command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$';
- check_disk:
+ check_disk:
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$';
- check_all_disks:
+ check_all_disks:
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e';
- check_ssh:
+ check_ssh:
command_line => '$USER1$/check_ssh $HOSTADDRESS$';
- check_ssh_port:
+ check_ssh_port:
command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
- check_http:
+ check_ssh_port_host:
+ command_line => '$USER1$/check_ssh -p $ARG1$ $ARG2$';
+ check_http:
command_line => '$USER1$/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_https:
+ check_https:
command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_https_cert:
+ check_https_cert:
command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_http_url:
+ check_http_url:
command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$';
- check_http_url_regex:
+ check_http_url_regex:
command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$';
- check_https_url:
+ check_https_url:
command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$';
- check_https_url_regex:
+ check_https_url_regex:
command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$';
- check_mysql:
+ check_mysql:
command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$';
- check_mysql_db:
+ check_mysql_db:
command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$';
- check_ntp_time:
+ check_ntp_time:
command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
- check_silc:
+ check_silc:
command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
- check_sobby:
+ check_sobby:
command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$';
- check_jabber:
+ check_jabber:
command_line => '$USER1$/check_jabber -H $ARG1$';
- }
+ check_git:
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418';
+ }
+ }
+ }
# commands for services defined by other modules
@@ -57,19 +93,41 @@ class nagios::defaults::commands {
# from apache module
http_port:
command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+
+ check_http_port_url_content:
+ command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$';
+ check_https_port_url_content:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$';
+ check_http_url_content:
+ command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -s $ARG3$';
+ check_https_url_content:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -s $ARG3$';
+
# from bind module
check_dig2:
command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$';
+
+ # from mysql module
+ check_mysql_health:
+ command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$';
+
+ # better check_dns
+ check_dns2:
+ command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$';
}
# notification commands
+ $mail_cmd_location = $operatingsystem ? {
+ centos => '/bin/mail',
+ default => '/usr/bin/mail'
+ }
+
nagios_command {
'notify-host-by-email':
- command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$';
+ command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\nHost: \\$HOSTNAME\\$\\nState: \$HOSTSTATE\$\\nAddress: \$HOSTADDRESS\$\\nInfo: \$HOSTOUTPUT\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Host Alert: \$HOSTNAME\$ is \$HOSTSTATE\$ **\" \$CONTACTEMAIL\$";
'notify-service-by-email':
- command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$'
-
+ command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nService: \$SERVICEDESC\$\\nHost: \$HOSTALIAS\$\\nAddress: \$HOSTADDRESS\$\\nState: \$SERVICESTATE\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nAdditional Info:\\n\\n\$SERVICEOUTPUT\$\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Service Alert: \$HOSTALIAS\$/\$SERVICEDESC\$ is \$SERVICESTATE\$ **\" \$CONTACTEMAIL\$";
}
}
diff --git a/manifests/defaults/host_templates.pp b/manifests/defaults/host_templates.pp
index 699b965..0f47324 100644
--- a/manifests/defaults/host_templates.pp
+++ b/manifests/defaults/host_templates.pp
@@ -12,12 +12,12 @@ class nagios::defaults::host_templates {
process_perf_data => '1',
retain_status_information => '1',
retain_nonstatus_information => '1',
- check_command => 'check-host-alive',
- max_check_attempts => '10',
- notification_interval => '0',
- notification_period => '24x7',
- notification_options => 'd,u,r',
- contact_groups => 'admins',
+ check_command => 'check-host-alive',
+ max_check_attempts => '10',
+ notification_interval => '0',
+ notification_period => '24x7',
+ notification_options => 'd,u,r',
+ contact_groups => 'admins',
register => '0',
}
diff --git a/manifests/defaults/hostgroups.pp b/manifests/defaults/hostgroups.pp
index 3a4f4d1..8715ade 100644
--- a/manifests/defaults/hostgroups.pp
+++ b/manifests/defaults/hostgroups.pp
@@ -1,13 +1,11 @@
class nagios::defaults::hostgroups {
-
- nagios_hostgroup {
- 'all':
- alias => 'All Servers',
- members => '*';
- 'debian-servers':
- alias => 'Debian GNU/Linux Servers';
- 'centos-servers':
- alias => 'CentOS GNU/Linux Servers';
- }
-
+ nagios_hostgroup {
+ 'all':
+ alias => 'All Servers',
+ members => '*';
+ 'debian-servers':
+ alias => 'Debian GNU/Linux Servers';
+ 'centos-servers':
+ alias => 'CentOS GNU/Linux Servers';
+ }
}
diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp
new file mode 100644
index 0000000..842f9ce
--- /dev/null
+++ b/manifests/defaults/plugins.pp
@@ -0,0 +1,10 @@
+class nagios::defaults::plugins {
+
+ nagios::plugin {
+ 'check_mysql_health':
+ source => 'nagios/plugins/check_mysql_health';
+ 'check_dns2':
+ source => 'nagios/plugins/check_dns2';
+ }
+
+}
diff --git a/manifests/defaults/service_templates.pp b/manifests/defaults/service_templates.pp
index 326ce05..84740af 100644
--- a/manifests/defaults/service_templates.pp
+++ b/manifests/defaults/service_templates.pp
@@ -17,15 +17,15 @@ class nagios::defaults::service_templates {
process_perf_data => '1',
retain_status_information => '1',
retain_nonstatus_information => '1',
- notification_interval => '0',
- is_volatile => '0',
- check_period => '24x7',
- normal_check_interval => '5',
- retry_check_interval => '1',
- max_check_attempts => '4',
- notification_period => '24x7',
- notification_options => 'w,u,c,r',
- contact_groups => 'admins',
+ notification_interval => '0',
+ is_volatile => '0',
+ check_period => '24x7',
+ normal_check_interval => '5',
+ retry_check_interval => '1',
+ max_check_attempts => '4',
+ notification_period => '24x7',
+ notification_options => 'w,u,c,r',
+ contact_groups => 'admins',
register => '0',
}
diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp
index 5a3d23d..c97eee4 100644
--- a/manifests/defaults/templates.pp
+++ b/manifests/defaults/templates.pp
@@ -1,12 +1,13 @@
class nagios::defaults::templates {
+ include nagios::defaults::vars
file { 'nagios_templates':
- path => "${nagios::nagios_cfgdir}/conf.d/nagios_templates.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/nagios_templates.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/nagios_templates.cfg",
- "puppet://$server/modules/site-nagios/configs/nagios_templates.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/nagios_templates.cfg",
- "puppet://$server/modules/nagios/configs/nagios_templates.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_templates.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios_templates.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios_templates.cfg",
+ "puppet:///modules/site-nagios/configs/nagios_templates.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/nagios_templates.cfg",
+ "puppet:///modules/nagios/configs/nagios_templates.cfg" ],
notify => Service['nagios'],
mode => 0644, owner => root, group => root;
}
diff --git a/manifests/defaults/vars.pp b/manifests/defaults/vars.pp
new file mode 100644
index 0000000..6302f13
--- /dev/null
+++ b/manifests/defaults/vars.pp
@@ -0,0 +1,10 @@
+class nagios::defaults::vars {
+ case $nagios_cfgdir {
+ '': { $int_nagios_cfgdir = $operatingsystem ? {
+ centos => '/etc/nagios/',
+ default => '/etc/nagios3'
+ }
+ }
+ default: { $int_nagios_cfgdir = $nagios_cfgdir }
+ }
+}
diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp
new file mode 100644
index 0000000..961755a
--- /dev/null
+++ b/manifests/irc_bot.pp
@@ -0,0 +1,93 @@
+class nagios::irc_bot {
+ if ( ! ($nagios_nsa_server and $nagios_nsa_nickname and $nagios_nsa_channel) ) {
+ fail("Please provide values at least for \$nagios_nsa_server, \$nagios_nsa_nickname and \$nagios_nsa_channel")
+ }
+
+ $nagios_nsa_socket = $nagios_nsa_socket ? {
+ '' => $operatingsystem ? {
+ centos => '/var/run/nagios-nsa/nsa.socket',
+ default => '/var/run/nagios3/nsa.socket'
+ },
+ default => $nagios_nsa_socket,
+ }
+ $nagios_nsa_pidfile = $nagios_nsa_pidfile ? {
+ '' => $operatingsystem ? {
+ centos => '/var/run/nagios-nsa/nsa.pid',
+ default => '/var/run/nagios3/nsa.pid'
+ },
+ default => $nagios_nsa_pidfile,
+ }
+ $nagios_nsa_port = $nagios_nsa_port ? {
+ '' => '6667',
+ default => $nagios_nsa_port,
+ }
+ $nagios_nsa_realname = $nagios_nsa_realname ? {
+ '' => 'Nagios',
+ default => $nagios_nsa_realname,
+ }
+
+ if (! $nagios_nsa_password) {
+ $nagios_nsa_password = ''
+ }
+
+ file { "/usr/local/bin/riseup-nagios-client.pl":
+ owner => root, group => root, mode => 0755,
+ source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl",
+ }
+ file { "/usr/local/bin/riseup-nagios-server.pl":
+ owner => root, group => root, mode => 0755,
+ source => "puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl",
+ }
+ file { "/etc/init.d/nagios-nsa":
+ owner => root, group => root, mode => 0755,
+ content => template("nagios/irc_bot/${operatingsystem}/nagios-nsa.sh.erb"),
+ require => File["/usr/local/bin/riseup-nagios-server.pl"],
+ }
+ file { "/etc/nagios_nsa.cfg":
+ ensure => present,
+ owner => nagios, group => root, mode => 0400,
+ content => template('nagios/irc_bot/nsa.cfg.erb'),
+ }
+
+ package { "libnet-irc-perl":
+ ensure => present,
+ }
+
+ service { "nagios-nsa":
+ ensure => "running",
+ hasstatus => true,
+ require => [File["/etc/nagios_nsa.cfg"],
+ Package["libnet-irc-perl"],
+ Service['nagios'] ],
+ }
+
+ case $operatingsystem {
+ centos: {
+ Package['libnet-irc-perl']{
+ name => 'perl-Net-IRC',
+ }
+ Service['nagios-nsa']{
+ enable => true,
+ }
+ }
+ debian,ubuntu: {
+ exec { "nagios_nsa_init_script":
+ command => "/usr/sbin/update-rc.d nagios-nsa defaults",
+ unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa",
+ require => File["/etc/init.d/nagios-nsa"],
+ before => Service['nagios-nsa'],
+ }
+ }
+ }
+
+ nagios_command {
+ "notify-by-irc":
+ command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"';
+ "host-notify-by-irc":
+ command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"';
+ }
+
+ if $use_shorewall {
+ include shorewall::rules::out::irc
+ }
+}
diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp
index b4ca878..6e2c472 100644
--- a/manifests/nsca/client.pp
+++ b/manifests/nsca/client.pp
@@ -3,9 +3,9 @@ class nagios::nsca::client {
package { 'nsca': ensure => installed }
file { '/etc/send_nsca.cfg':
- source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/send_nsca.cfg",
- "puppet://${server}/site-nagios/nsca/send_nsca.cfg",
- "puppet://${server}/nagios/nsca/send_nsca.cfg" ],
+ source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/send_nsca.cfg",
+ "puppet:///modules/site-nagios/nsca/send_nsca.cfg",
+ "puppet:///modules/nagios/nsca/send_nsca.cfg" ],
owner => 'nagios',
group => 'nogroup',
mode => '400',
diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp
index 8cdfe75..9239f21 100644
--- a/manifests/nsca/server.pp
+++ b/manifests/nsca/server.pp
@@ -9,9 +9,9 @@ class nagios::nsca::server {
}
file { '/etc/nsca.cfg':
- source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/nsca.cfg",
- "puppet://${server}/site-nagios/nsca/nsca.cfg",
- "puppet://${server}/modules/nagios/nsca/nsca.cfg" ],
+ source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/nsca.cfg",
+ "puppet:///modules/site-nagios/nsca/nsca.cfg",
+ "puppet:///modules/nagios/nsca/nsca.cfg" ],
owner => 'nagios',
group => 'nogroup',
mode => '400',
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 4789345..abaa6e5 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -1,13 +1,18 @@
define nagios::plugin(
+ $source = 'absent',
$ensure = present
){
- file{$name:
+ @@file{$name:
path => $hardwaremodel ? {
'x86_64' => "/usr/lib64/nagios/plugins/$name",
default => "/usr/lib/nagios/plugins/$name",
},
ensure => $ensure,
- source => "puppet://$server/modules/nagios/plugins/$name",
+ source => $source ? {
+ 'absent' => "puppet:///modules/nagios/plugins/$name",
+ default => "puppet:///modules/$source"
+ },
+ tag => 'nagios_plugin',
require => Package['nagios-plugins'],
owner => root, group => 0, mode => 0755;
}
diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp
new file mode 100644
index 0000000..75f87d7
--- /dev/null
+++ b/manifests/plugin/deploy.pp
@@ -0,0 +1,30 @@
+define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $require_package = 'nagios-plugins') {
+ $plugin_src = $ensure ? {
+ 'present' => $name,
+ 'absent' => $name,
+ default => $ensure
+ }
+ $real_source = $source ? {
+ '' => "nagios/plugins/$plugin_src",
+ default => $source
+ }
+
+ if !defined(Package[$require_package]) {
+ @@package { $require_package:
+ ensure => installed,
+ tag => "nagios::plugin::deploy::package";
+ }
+ }
+
+ include nagios::plugin::scriptpaths
+ @@file { "nagios_plugin_${name}":
+ path => "$nagios::plugin::scriptpaths::script_path/${name}",
+ source => "puppet://$server/modules/$real_source",
+ mode => 0755, owner => root, group => 0,
+ require => Package[$require_package],
+ tag => "nagios::plugin::deploy::file";
+ }
+
+ # register the plugin
+ @@nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] }
+}
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
new file mode 100644
index 0000000..6065709
--- /dev/null
+++ b/manifests/plugin/scriptpaths.pp
@@ -0,0 +1,6 @@
+class nagios::plugin::scriptpaths {
+ case $hardwaremodel {
+ x86_64: { $script_path = "/usr/lib64/nagios/plugins/" }
+ default: { $script_path = "/usr/lib/nagios/plugins" }
+ }
+}
diff --git a/manifests/service.pp b/manifests/service.pp
index 3e732b7..afc8650 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -10,7 +10,7 @@ define nagios::service (
$notification_period = '',
$notification_options = '',
$contact_groups = '',
- $use = 'absent',
+ $use = 'generic-service',
$service_description = 'absent' )
{
@@ -22,7 +22,12 @@ define nagios::service (
ensure => $ensure,
check_command => $check_command,
host_name => $host_name,
+ use => $use,
notify => Service[nagios],
+ service_description => $service_description ?{
+ 'absent' => $name,
+ default => $service_description
+ }
}
if ($check_period != '') {
@@ -53,17 +58,8 @@ define nagios::service (
Nagios_service["${real_name}"] { notification_options => $notification_options }
}
- if ($use == 'absent') {
- Nagios_service["${real_name}"] { use => 'generic-service' }
- } else {
- Nagios_service["${real_name}"] { use => $use }
+ if ($contact_groups != '') {
+ Nagios_service["${real_name}"] { contact_groups => $contact_groups }
}
-
- if ($service_description == 'absent') {
- Nagios_service["${real_name}"] { service_description => $name }
- } else {
- Nagios_service["${real_name}"] { service_description => $service_description }
- }
-
}
diff --git a/manifests/service/http.pp b/manifests/service/http.pp
index 5fd9890..8fd5059 100644
--- a/manifests/service/http.pp
+++ b/manifests/service/http.pp
@@ -8,6 +8,7 @@ define nagios::service::http(
$check_domain = 'absent',
$check_url = '/',
$check_code = 'OK',
+ $use = 'generic-service',
$ssl_mode = false
){
$real_check_domain = $check_domain ? {
@@ -18,12 +19,14 @@ define nagios::service::http(
'force',true,'only': {
nagios::service{"https_${name}_${check_code}":
ensure => $ensure,
+ use => $use,
check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
case $ssl_mode {
'force': {
nagios::service{"httprd_${name}":
ensure => $ensure,
+ use => $use,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'",
}
}
@@ -34,6 +37,7 @@ define nagios::service::http(
false,true: {
nagios::service{"http_${name}_${check_code}":
ensure => $ensure,
+ use => $use,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
}
diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp
index ca2ae15..d501f06 100644
--- a/manifests/service/mysql.pp
+++ b/manifests/service/mysql.pp
@@ -1,48 +1,47 @@
-# Checks a mysql instance via tcp or socket
+# Checks a mysql instance via tcp or socket
define nagios::service::mysql(
- $ensure = present,
- $check_hostname = 'absent',
- $check_port = '3306',
- $check_username = 'nagios',
- $check_password = '',
- $check_database = 'absent',
- $check_mode = 'tcp'
-){
- if ($check_hostname == 'absent') {
- fail("Please specify a hostname, ip address or socket to check a mysql instance.")
- }
-
- case $check_mode {
- 'tcp': {
- if ($check_hostname == 'localhost') {
- $real_check_hostname = '127.0.0.1'
- }
- else {
- $real_check_hostname = $check_hostname
- }
- }
- default: {
- if ($check_hostname == '127.0.0.1') {
- $real_check_hostname = 'localhost'
- }
- else {
- $real_check_hostname = $check_hostname
- }
- }
- }
+ $ensure = present,
+ $check_host = 'absent',
+ $check_port = '3306',
+ $check_username = 'nagios',
+ $check_password = $nagios_mysql_password,
+ $check_database = 'information_schema',
+ $check_warning = undef,
+ $check_critical = undef,
+ $check_health_mode = $name,
+ $check_name = undef,
+ $check_name2 = undef,
+ $check_regexp = undef,
+ $check_units = undef,
+ $check_mode = 'tcp' )
+{
- if ($check_database == 'absent') {
- nagios::service { 'mysql':
- ensure => $ensure,
- check_command => "check_mysql!${real_check_hostname}!${check_port}!${check_username}!${check_password}",
- }
+ if ($check_host == 'absent') {
+ fail("Please specify a hostname, ip address or socket to check a mysql instance.")
+ }
+
+ case $check_mode {
+ 'tcp': {
+ if ($check_host == 'localhost') {
+ $real_check_host = '127.0.0.1'
+ }
+ else {
+ $real_check_host = $check_host
+ }
}
- else {
- nagios::service { "mysql_${check_database}":
- ensure => $ensure,
- check_command => "check_mysql_db!${real_check_hostname}!${check_port}!${check_username}!${check_password}!${check_database}",
- }
+ default: {
+ if ($check_host == '127.0.0.1') {
+ $real_check_host = 'localhost'
+ }
+ else {
+ $real_check_host = $check_host
+ }
}
-
+ }
+
+ nagios::service { "mysql_health_${name}":
+ ensure => $ensure,
+ check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}",
+ }
}
diff --git a/manifests/service/smtp.pp b/manifests/service/smtp.pp
new file mode 100644
index 0000000..14237a9
--- /dev/null
+++ b/manifests/service/smtp.pp
@@ -0,0 +1,50 @@
+# true:
+# - true : check tls and plain connect *defualt*
+# - false : check plain connection only
+# cert_days:
+# If tls is used add an additionl check
+# to check for validity for cert.
+# - 'absent' : do not execute that check
+# - INTEGER : Minimum number of days a certificate
+# has to be valid. Default: 10
+define nagios::service::smtp(
+ $ensure = 'present',
+ $host = 'absent',
+ $port = '25',
+ $tls = true,
+ $cert_days = 10
+){
+ $real_host = $host ? {
+ 'absent' => $name,
+ default => $host
+ }
+
+ nagios::service{
+ "smtp_${name}_${port}":
+ ensure => $ensure;
+ "smtp_tls_${name}_${port}":
+ ensure => $tls ? {
+ true => $ensure,
+ default => 'absent'
+ };
+ "smtp_tls_cert_${name}_${port}":
+ ensure => $cert_days ? {
+ 'absent' => 'absent',
+ default => $ensure
+ };
+ }
+
+ if $ensure != 'absent' {
+ Nagios::Service["smtp_${name}_${port}"]{
+ check_command => "check_smtp!${real_host}!${port}",
+ }
+ Nagios::Service["smtp_tls_${name}_${port}"]{
+ check_command => "check_smtp_tls!${real_host}!${port}",
+ }
+ if $cert_days != 'absent' {
+ Nagios::Service["smtp_tls_cert_${name}_${port}"]{
+ check_command => "check_smtp_cert!${real_host}!${port}!${cert_days}",
+ }
+ }
+ }
+}
diff --git a/manifests/service/ssmtp.pp b/manifests/service/ssmtp.pp
new file mode 100644
index 0000000..b05678a
--- /dev/null
+++ b/manifests/service/ssmtp.pp
@@ -0,0 +1,32 @@
+define nagios::service::ssmtp(
+ $ensure = 'present',
+ $host = 'absent',
+ $port = '465',
+ $cert_days = 10
+){
+ $real_host = $host ? {
+ 'absent' => $name,
+ default => $host
+ }
+
+ nagios::service{
+ "ssmtp_${name}_${port}":
+ ensure => $ensure;
+ "ssmtp_cert_${name}_${port}":
+ ensure => $cert_days ? {
+ 'absent' => 'absent',
+ default => $ensure
+ };
+ }
+
+ if $ensure != 'absent' {
+ Nagios::Service["ssmtp_${name}_${port}"]{
+ check_command => "check_ssmtp!${real_host}!${port}",
+ }
+ if $cert_days != 'absent' {
+ Nagios::Service["ssmtp_cert_${name}_${port}"]{
+ check_command => "check_ssmtp_cert!${real_host}!${port}!${cert_days}",
+ }
+ }
+ }
+}
diff --git a/manifests/target/nat.pp b/manifests/target/fqdn.pp
index abb0a1e..acac5d6 100644
--- a/manifests/target/nat.pp
+++ b/manifests/target/fqdn.pp
@@ -1,4 +1,4 @@
-class nagios::target::nat inherits nagios::target {
+class nagios::target::fqdn inherits nagios::target {
Nagios_host["${fqdn}"] { address => "${fqdn}" }