2016-10-17 04:05:49 +02:00
|
|
|
class zulip_ops::nagios {
|
|
|
|
include zulip_ops::base
|
|
|
|
include zulip_ops::apache
|
2016-04-04 04:13:34 +02:00
|
|
|
include zulip::nagios
|
2013-02-07 22:20:10 +01:00
|
|
|
|
2013-11-08 21:17:14 +01:00
|
|
|
$nagios_packages = [# Packages needed for Nagios
|
|
|
|
"nagios3",
|
|
|
|
]
|
2013-02-07 22:20:10 +01:00
|
|
|
package { $nagios_packages: ensure => "installed" }
|
|
|
|
|
|
|
|
apache2site { 'nagios':
|
|
|
|
require => [File['/etc/apache2/sites-available/'],
|
|
|
|
Apache2mod['headers'], Apache2mod['ssl'],
|
|
|
|
],
|
|
|
|
ensure => present,
|
|
|
|
}
|
2013-05-31 21:50:57 +02:00
|
|
|
|
|
|
|
file { "/etc/nagios3/":
|
|
|
|
recurse => true,
|
|
|
|
purge => false,
|
|
|
|
require => Package[nagios3],
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
mode => 644,
|
2016-10-17 04:05:49 +02:00
|
|
|
source => "puppet:///modules/zulip_ops/nagios3/",
|
2013-06-14 20:15:12 +02:00
|
|
|
notify => Service["nagios3"],
|
|
|
|
}
|
|
|
|
|
2017-10-06 04:08:50 +02:00
|
|
|
file { "/etc/nagios3/conf.d/contacts.cfg":
|
|
|
|
require => Package[nagios3],
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
mode => 644,
|
|
|
|
content => template("zulip_ops/nagios3/contacts.cfg.template.erb"),
|
|
|
|
notify => Service["nagios3"],
|
|
|
|
}
|
2017-10-06 04:06:28 +02:00
|
|
|
file { "/etc/nagios3/conf.d/hosts.cfg":
|
|
|
|
require => Package[nagios3],
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
mode => 644,
|
|
|
|
content => template("zulip_ops/nagios3/hosts.cfg.template.erb"),
|
|
|
|
notify => Service["nagios3"],
|
|
|
|
}
|
|
|
|
|
2016-07-21 07:56:00 +02:00
|
|
|
$nagios_format_users = join($zulip_ops::base::users, ",")
|
|
|
|
file { "/etc/nagios3/cgi.cfg":
|
|
|
|
require => Package[nagios3],
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
mode => 644,
|
|
|
|
content => template("zulip_ops/nagios3/cgi.cfg.template.erb"),
|
|
|
|
notify => Service["nagios3"],
|
|
|
|
}
|
|
|
|
|
2013-06-14 20:15:12 +02:00
|
|
|
service { "nagios3":
|
|
|
|
ensure => running,
|
|
|
|
}
|
|
|
|
|
2016-07-21 07:54:35 +02:00
|
|
|
file { [ '/etc/nagios3/conf.d/extinfo_nagios2.cfg',
|
|
|
|
'/etc/nagios3/conf.d/services_nagios2.cfg',
|
|
|
|
'/etc/nagios3/conf.d/contacts_nagios2.cfg',
|
|
|
|
'/etc/nagios3/conf.d/hostgroups_nagios2.cfg',
|
|
|
|
'/etc/nagios3/conf.d/localhost_nagios2.cfg',
|
|
|
|
]:
|
|
|
|
ensure => absent,
|
|
|
|
}
|
|
|
|
|
2013-08-07 18:22:36 +02:00
|
|
|
file { '/etc/nagios3/conf.d/zulip_nagios.cfg':
|
|
|
|
ensure => file,
|
|
|
|
mode => 644,
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
2013-10-04 19:14:13 +02:00
|
|
|
source => '/root/zulip/api/integrations/nagios/zulip_nagios.cfg',
|
2017-05-16 06:49:37 +02:00
|
|
|
notify => Service["nagios3"],
|
2013-08-07 18:22:36 +02:00
|
|
|
}
|
2016-08-03 21:53:03 +02:00
|
|
|
|
|
|
|
$hosts = $zulip_ops::base::hosts
|
|
|
|
file { '/etc/nagios3/conf.d/zulip_autossh.cfg':
|
|
|
|
ensure => file,
|
|
|
|
mode => 644,
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
content => template('zulip_ops/nagios_autossh.template.erb'),
|
2017-05-16 06:49:37 +02:00
|
|
|
notify => Service["nagios3"],
|
2016-08-03 21:53:03 +02:00
|
|
|
}
|
2013-08-07 18:22:36 +02:00
|
|
|
|
2013-06-14 20:15:12 +02:00
|
|
|
exec { "fix_nagios_permissions":
|
|
|
|
command => "dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw",
|
|
|
|
unless => "bash -c 'ls -ld /var/lib/nagios3/rw | grep ^drwx--s--- -q'",
|
|
|
|
notify => Service["nagios3"],
|
|
|
|
}
|
|
|
|
exec { "fix_nagios_permissions2":
|
|
|
|
command => "dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3",
|
|
|
|
unless => "bash -c 'ls -ld /var/lib/nagios3 | grep ^drwxr-x--x -q'",
|
|
|
|
notify => Service["nagios3"],
|
2013-05-31 21:50:57 +02:00
|
|
|
}
|
|
|
|
|
2013-02-13 22:19:08 +01:00
|
|
|
# TODO: Install our API
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|