summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apache.pp10
-rw-r--r--manifests/base.pp182
-rw-r--r--manifests/debian.pp7
-rw-r--r--manifests/defaults/commands.pp239
-rw-r--r--manifests/init.pp3
-rw-r--r--manifests/nrpe.pp5
-rw-r--r--manifests/nrpe/base.pp50
-rw-r--r--manifests/nrpe/debian.pp6
-rw-r--r--manifests/service.pp20
-rw-r--r--manifests/service/mysql.pp2
-rw-r--r--manifests/stored_config.pp19
-rw-r--r--manifests/target.pp14
12 files changed, 304 insertions, 253 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp
index a90d0ee..f6ec39a 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -1,22 +1,24 @@
class nagios::apache(
$allow_external_cmd = false,
$manage_shorewall = false,
- $manage_munin = false
+ $manage_munin = false,
+ $stored_config = true
) {
class{'nagios':
httpd => 'apache',
allow_external_cmd => $allow_external_cmd,
manage_munin => $manage_munin,
manage_shorewall => $manage_shorewall,
+ stored_config => $stored_config
}
case $::operatingsystem {
'debian': {
file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf":
ensure => present,
- source => [ "puppet:///site_nagios/configs/${::fqdn}/apache2.conf",
- "puppet:///site_nagios/configs/apache2.conf",
- "puppet:///nagios/configs/apache2.conf"],
+ source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/apache2.conf",
+ "puppet:///modules/site_nagios/configs/apache2.conf",
+ "puppet:///modules/nagios/configs/apache2.conf"],
}
apache::config::global { "nagios3.conf":
diff --git a/manifests/base.pp b/manifests/base.pp
index 0f8b777..3a0765a 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -23,7 +23,8 @@ class nagios::base {
"puppet:///modules/nagios/configs/${::operatingsystem}/nagios.cfg",
"puppet:///modules/nagios/configs/nagios.cfg" ],
notify => Service['nagios'],
- mode => 0644, owner => root, group => root;
+ mode => 0644, owner => root, group => root,
+ require => Package['nagios'],
}
file { 'nagios_cgi_cfg':
@@ -35,13 +36,15 @@ class nagios::base {
"puppet:///modules/nagios/configs/cgi.cfg" ],
mode => '0644', owner => 'root', group => 0,
notify => Service['apache'],
+ require => Package['nagios'],
}
file { 'nagios_htpasswd':
path => "${nagios::defaults::vars::int_cfgdir}/htpasswd.users",
source => [ "puppet:///modules/site_nagios/htpasswd.users",
"puppet:///modules/nagios/htpasswd.users" ],
- mode => 0640, owner => root, group => apache;
+ mode => 0640, owner => root, group => apache,
+ require => Package['nagios'],
}
file { 'nagios_private':
@@ -50,7 +53,8 @@ class nagios::base {
purge => true,
recurse => true,
notify => Service['nagios'],
- mode => '0750', owner => root, group => nagios;
+ mode => '0750', owner => root, group => nagios,
+ require => Package['nagios'],
}
file { 'nagios_private_resource_cfg':
@@ -58,7 +62,8 @@ class nagios::base {
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';
+ owner => root, group => nagios, mode => '0640',
+ require => Package['nagios'],
}
file { 'nagios_confd':
@@ -67,90 +72,82 @@ class nagios::base {
purge => true,
recurse => true,
notify => Service['nagios'],
- mode => '0750', owner => root, group => nagios;
- }
- Nagios_command <<||>>
- Nagios_contactgroup <<||>>
- Nagios_contact <<||>>
- Nagios_hostdependency <<||>>
- Nagios_hostescalation <<||>>
- Nagios_hostextinfo <<||>>
- Nagios_hostgroup <<||>>
- Nagios_host <<||>>
- Nagios_servicedependency <<||>>
- Nagios_serviceescalation <<||>>
- Nagios_servicegroup <<||>>
- Nagios_serviceextinfo <<||>>
- Nagios_service <<||>>
- Nagios_timeperiod <<||>>
-
- Nagios_command <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_contact <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_contactgroup <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_host <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_hostdependency <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg",
- notify => Service['nagios'],
- }
- Nagios_hostescalation <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg",
- notify => Service['nagios'],
- }
- Nagios_hostextinfo <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_hostgroup <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_service <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_servicegroup <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg",
- notify => Service['nagios'],
- }
- Nagios_servicedependency <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_serviceescalation <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_serviceextinfo <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
- }
- Nagios_timeperiod <||> {
- target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg",
- require => File['nagios_confd'],
- notify => Service['nagios'],
+ mode => '0750', owner => root, group => nagios,
+ require => Package['nagios'],
}
+ if ( $nagios::stored_config == true ) {
+ include nagios::stored_config
+ }
+ Nagios_command <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_contact <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_contactgroup <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_host <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_hostdependency <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg",
+ notify => Service['nagios'],
+ require => Package['nagios'],
+ }
+ Nagios_hostescalation <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg",
+ notify => Service['nagios'],
+ require => Package['nagios'],
+ }
+ Nagios_hostextinfo <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_hostgroup <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_service <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_servicegroup <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg",
+ notify => Service['nagios'],
+ require => Package['nagios'],
+ }
+ Nagios_servicedependency <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_serviceescalation <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_serviceextinfo <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
+ Nagios_timeperiod <||> {
+ target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg",
+ require => [ File['nagios_confd'], Package['nagios'] ],
+ notify => Service['nagios'],
+ }
file{[ "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg",
"${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg",
@@ -170,7 +167,8 @@ class nagios::base {
ensure => file,
replace => false,
notify => Service['nagios'],
- mode => 0644, owner => root, group => 0;
+ mode => 0644, owner => root, group => 0,
+ require => Package['nagios'],
}
# manage nagios cfg files
@@ -181,6 +179,12 @@ class nagios::base {
recurse => true,
purge => true,
notify => Service['nagios'],
- mode => 0755, owner => root, group => root;
+ mode => 0755, owner => root, group => root,
+ require => Package['nagios'],
}
+
+ file { [ '/usr/lib64', '/usr/lib64/nagios', '/usr/lib64/nagios/plugins/' ]:
+ ensure => directory
+ }
+
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 0f451e3..f26bd97 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -18,13 +18,15 @@ class nagios::debian inherits nagios::base {
path => "${nagios::defaults::vars::int_cfgdir}/commands.cfg",
ensure => present,
notify => Service['nagios'],
- mode => 0644, owner => root, group => root;
+ mode => 0644, owner => root, group => root,
+ require => Package['nagios'],
}
file { "${nagios::defaults::vars::int_cfgdir}/stylesheets":
ensure => directory,
purge => false,
recurse => true,
+ require => Package['nagios'],
}
if $nagios::allow_external_cmd {
@@ -33,16 +35,19 @@ class nagios::debian inherits nagios::base {
unless => 'dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3',
logoutput => false,
notify => Service['nagios'],
+ require => Package['nagios'],
}
exec { 'nagios_external_cmd_perms_1':
command => 'chmod 0751 /var/lib/nagios3 && chown nagios:nagios /var/lib/nagios3',
unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3`" = "751 nagios nagios"',
notify => Service['nagios'],
+ require => Package['nagios'],
}
exec { 'nagios_external_cmd_perms_2':
command => 'chmod 2751 /var/lib/nagios3/rw && chown nagios:www-data /var/lib/nagios3/rw',
unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3/rw`" = "2751 nagios www-data"',
notify => Service['nagios'],
+ require => Package['nagios'],
}
}
}
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp
index bb19638..07d2b1d 100644
--- a/manifests/defaults/commands.pp
+++ b/manifests/defaults/commands.pp
@@ -5,135 +5,138 @@ class nagios::defaults::commands {
# 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$';
- check_git:
- command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418';
- }
+ 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_openvpn_server':
+ command_line => '$USER1$/check_openvpn_server.pl -H $HOSTADDRESS$ -p 1194';
+ 'check_openvpn_server_ip_port':
+ command_line => '$USER1$/check_openvpn_server.pl -H $ARG1$ -p $ARG2$';
+ '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$';
+ 'check_git':
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418';
}
- default: {
- nagios_command {
- check_dummy:
- command_line => '$USER1$/check_dummy $ARG1$';
- check_ping:
- command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$';
- check-host-alive:
- command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1';
- check_tcp:
- command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$';
- check_udp:
- command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$';
- check_load:
- command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$';
- check_disk:
- command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$';
- check_all_disks:
- command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e';
- check_ssh:
- command_line => '$USER1$/check_ssh $HOSTADDRESS$';
- check_ssh_port:
- command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
- 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:
- command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- 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$ -p $ARG2$ -u $ARG3$ -e $ARG4$';
- 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:
- command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$';
- 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$';
- check_git:
- command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418';
- }
+ }
+ default: {
+ nagios_command {
+ 'check_dummy':
+ command_line => '$USER1$/check_dummy $ARG1$';
+ 'check_ping':
+ command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$';
+ 'check-host-alive':
+ command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1';
+ 'check_tcp':
+ command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$';
+ 'check_udp':
+ command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$';
+ 'check_load':
+ command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$';
+ 'check_disk':
+ command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$';
+ 'check_all_disks':
+ command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e';
+ 'check_ssh':
+ command_line => '$USER1$/check_ssh $HOSTADDRESS$';
+ 'check_ssh_port':
+ command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
+ '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':
+ command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ '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$ -p $ARG2$ -u $ARG3$ -e $ARG4$';
+ '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':
+ command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$';
+ '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$';
+ 'check_git':
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418';
}
+ }
}
- # commands for services defined by other modules
+ # commands for services defined by other modules
- nagios_command {
- # from apache module
- http_port:
- command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ nagios_command {
+ # 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$';
+ '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 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$ $ARG7$ $ARG8$';
+ # from mysql module
+ 'check_mysql_health':
+ command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$ $ARG7$ $ARG8$';
- # better check_dns
- check_dns2:
- command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$';
-
- # dnsbl checking
- check_dnsbl:
- command_line => '$USER1$/check_dnsbl -H $ARG1$';
- }
+ # better check_dns
+ 'check_dns2':
+ command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$';
- # notification commands
+ # dnsbl checking
+ 'check_dnsbl':
+ command_line => '$USER1$/check_dnsbl -H $ARG1$';
+ }
- $mail_cmd_location = $::operatingsystem ? {
- centos => '/bin/mail',
- default => '/usr/bin/mail'
- }
+ # notification commands
- 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\" | ${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\$\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Service Alert: \$HOSTALIAS\$/\$SERVICEDESC\$ is \$SERVICESTATE\$ **\" \$CONTACTEMAIL\$";
- }
+ $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\" | ${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\$\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Service Alert: \$HOSTALIAS\$/\$SERVICEDESC\$ is \$SERVICESTATE\$ **\" \$CONTACTEMAIL\$";
+ }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 5cbd3f3..1221950 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -19,7 +19,8 @@ class nagios(
$httpd = 'apache',
$allow_external_cmd = false,
$manage_shorewall = false,
- $manage_munin = false
+ $manage_munin = false,
+ $stored_config = true
) {
case $nagios::httpd {
'absent': { }
diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp
index 5c05ed4..8482df8 100644
--- a/manifests/nrpe.pp
+++ b/manifests/nrpe.pp
@@ -8,6 +8,11 @@ class nagios::nrpe {
include nagios::nrpe::freebsd
}
+ 'Debian','Ubuntu': {
+ if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/run/nagios/nrpe.pid' }
+ if $nagios_plugin_dir == '' { $nagios_plugin_dir = '/usr/lib/nagios/plugins' }
+ include nagios::nrpe::debian
+ }
default: {
if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/run/nrpe.pid' }
if $nagios_plugin_dir == '' { $nagios_plugin_dir = '/usr/lib/nagios/plugins' }
diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp
index 17abb04..162abd6 100644
--- a/manifests/nrpe/base.pp
+++ b/manifests/nrpe/base.pp
@@ -2,31 +2,31 @@ class nagios::nrpe::base {
if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/etc/nagios' }
if $processorcount == '' { $processorcount = 1 }
-
- package { "nagios-nrpe-server": ensure => present;
- "nagios-plugins-basic": ensure => present;
- "libwww-perl": ensure => present; # for check_apache
- }
+
+ # libwww-perl for check_apache
+ package { [ 'nagios-nrpe-server', 'nagios-plugins-basic', 'libwww-perl' ]:
+ ensure => present;
+ }
# Special-case lenny. the package doesn't exist
- if $lsbdistcodename != 'lenny' {
- package { "libnagios-plugin-perl": ensure => present; }
+ if $::lsbdistcodename != 'lenny' {
+ package { 'libnagios-plugin-perl': ensure => present; }
}
-
- file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]:
- ensure => directory }
+
+ file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]:
+ ensure => directory }
if $nagios_nrpe_dont_blame == '' { $nagios_nrpe_dont_blame = 1 }
file { "$nagios_nrpe_cfgdir/nrpe.cfg":
- content => template('nagios/nrpe/nrpe.cfg'),
- owner => root, group => 0, mode => 644;
+ content => template('nagios/nrpe/nrpe.cfg'),
+ owner => root, group => root, mode => '0644';
}
-
+
# default commands
- nagios::nrpe::command { "basic_nrpe":
- source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.${fqdn}.cfg",
- "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg",
- "puppet:///modules/nagios/nrpe/nrpe_commands.cfg" ],
+ nagios::nrpe::command { 'basic_nrpe':
+ source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.${::fqdn}.cfg",
+ 'puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg',
+ 'puppet:///modules/nagios/nrpe/nrpe_commands.cfg' ],
}
# the check for load should be customized for each server based on number
# of CPUs and the type of activity.
@@ -36,15 +36,15 @@ class nagios::nrpe::base {
$critical_1_threshold = 10 * $processorcount
$critical_5_threshold = 9 * $processorcount
$critical_15_threshold = 8 * $processorcount
- nagios::nrpe::command { "check_load":
- command_line => "${nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}",
+ nagios::nrpe::command { 'check_load':
+ command_line => "${::nagios::nrpe::nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}",
}
- service { "nagios-nrpe-server":
- ensure => running,
- enable => true,
- pattern => "nrpe",
- subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"],
- require => Package["nagios-nrpe-server"],
+ service { 'nagios-nrpe-server':
+ ensure => running,
+ enable => true,
+ pattern => 'nrpe',
+ subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"],
+ require => Package['nagios-nrpe-server'],
}
}
diff --git a/manifests/nrpe/debian.pp b/manifests/nrpe/debian.pp
new file mode 100644
index 0000000..fcaf851
--- /dev/null
+++ b/manifests/nrpe/debian.pp
@@ -0,0 +1,6 @@
+class nagios::nrpe::debian inherits nagios::nrpe::base {
+ include nagios::nrpe::linux
+ Service['nagios-nrpe-server'] {
+ hasstatus => false,
+ }
+}
diff --git a/manifests/service.pp b/manifests/service.pp
index 134d1f7..c214d7e 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -12,7 +12,7 @@ define nagios::service (
$contact_groups = '',
$use = 'generic-service',
$service_description = 'absent',
- $use_nrpe = '',
+ $use_nrpe = false,
$nrpe_args = '',
$nrpe_timeout = 10
) {
@@ -30,20 +30,22 @@ define nagios::service (
if $check_comand == 'absent' {
fail("Must pass a check_command to ${name} if it should be present")
}
- if ($use_nrpe == 'true') {
- include nagios::command::nrpe_timeout
+ if $use_nrpe == true {
+ include nagios::command::nrpe_timeout
if ($nrpe_args != '') {
- $real_check_command = "check_nrpe_timeout!$nrpe_timeout!$check_command!\"$nrpe_args\""
- } else {
- $real_check_command = "check_nrpe_1arg_timeout!$nrpe_timeout!$check_command"
- }
- } else {
+ $real_check_command = "check_nrpe_timeout!$nrpe_timeout!$check_command!\"$nrpe_args\""
+ }
+ else {
+ $real_check_command = "check_nrpe_1arg_timeout!$nrpe_timeout!$check_command"
+ }
+ }
+ else {
$real_check_command = "$check_command"
}
Nagios_service["${real_name}"] {
- check_command => $check_command,
+ check_command => $real_check_command,
host_name => $host_name,
use => $use,
service_description => $service_description ?{
diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp
index 2c74717..9559b17 100644
--- a/manifests/service/mysql.pp
+++ b/manifests/service/mysql.pp
@@ -27,7 +27,7 @@ define nagios::service::mysql(
if $check_warning != undef {
$real_check_warning = "!--warning $check_warning"
}
-
+
if $check_critical != undef {
$real_check_critical = "!--critical $check_critical"
}
diff --git a/manifests/stored_config.pp b/manifests/stored_config.pp
new file mode 100644
index 0000000..5afda04
--- /dev/null
+++ b/manifests/stored_config.pp
@@ -0,0 +1,19 @@
+class nagios::stored_config {
+ # collect exported resources
+
+ Nagios_command <<||>>
+ Nagios_contactgroup <<||>>
+ Nagios_contact <<||>>
+ Nagios_hostdependency <<||>>
+ Nagios_hostescalation <<||>>
+ Nagios_hostextinfo <<||>>
+ Nagios_hostgroup <<||>>
+ Nagios_host <<||>>
+ Nagios_servicedependency <<||>>
+ Nagios_serviceescalation <<||>>
+ Nagios_servicegroup <<||>>
+ Nagios_serviceextinfo <<||>>
+ Nagios_service <<||>>
+ Nagios_timeperiod <<||>>
+
+}
diff --git a/manifests/target.pp b/manifests/target.pp
index f9b7e13..aaa67cf 100644
--- a/manifests/target.pp
+++ b/manifests/target.pp
@@ -4,19 +4,23 @@ class nagios::target(
$parents = 'absent',
$address = $::ipaddress,
$nagios_alias = $::hostname,
- $hostgroups = 'absent'
+ $hostgroups = 'absent',
+ $notes = 'absent'
){
@@nagios_host { $::fqdn:
address => $address,
- alias => $nagios_alias,
- use => 'generic-host',
+ alias => $nagios_alias,
+ use => 'generic-host',
}
if ($parents != 'absent') {
- Nagios_host["${::fqdn}"] { parents => $parents }
+ Nagios_host[ $::fqdn ] { parents => $parents }
}
if ($hostgroups != 'absent') {
- Nagios_host["${::fqdn}"] { hostgroups => $hostgroups }
+ Nagios_host[ $::fqdn ] { hostgroups => $hostgroups }
+ }
+ if ($notes != 'absent') {
+ Nagios_host[ $::fqdn ] { notes => $notes }
}
}