nagios4 stuffs
This commit is contained in:
parent
4f58c7860f
commit
64aed0bc2e
2 changed files with 60 additions and 8 deletions
|
@ -24,11 +24,6 @@ class eid::nagios_monitor {
|
||||||
#class {'nagioscfg::slack': domain => 'sunet.slack.com', token => safe_hiera('slack_token','') } ->
|
#class {'nagioscfg::slack': domain => 'sunet.slack.com', token => safe_hiera('slack_token','') } ->
|
||||||
class {'nagioscfg::passive': enable_notifications => '1', obsess_over_services => '0', obsess_over_hosts => '0', nagios_config_file => '/etc/nagios4/nagios.cfg'}
|
class {'nagioscfg::passive': enable_notifications => '1', obsess_over_services => '0', obsess_over_hosts => '0', nagios_config_file => '/etc/nagios4/nagios.cfg'}
|
||||||
|
|
||||||
sunet::misc::htpasswd_user { $web_admin_user :
|
|
||||||
filename => "/etc/nagios4/htpasswd.users",
|
|
||||||
password => $web_admin_pw,
|
|
||||||
group => 'www-data',
|
|
||||||
}
|
|
||||||
|
|
||||||
package {'apache2': ensure => 'latest'}
|
package {'apache2': ensure => 'latest'}
|
||||||
service { 'apache2':
|
service { 'apache2':
|
||||||
|
@ -36,21 +31,30 @@ class eid::nagios_monitor {
|
||||||
enable => true,
|
enable => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'a2enconf nagios4-cgi.conf':
|
file { '/etc/nagios4/apache2.conf':
|
||||||
creates => '/etc/apache2/conf-enabled/nagios4-cgi.conf',
|
ensure => file,
|
||||||
notify => Service['apache2'],
|
mode => '0644',
|
||||||
|
content => template('eid/monitor/apache2.conf.erb'),
|
||||||
|
notify => Service['apache2'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/apache2/conf-enabled/nagios4-cgi.conf':
|
file { '/etc/apache2/conf-enabled/nagios4-cgi.conf':
|
||||||
ensure => link,
|
ensure => link,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exec { 'a2enconf nagios4-cgi.conf':
|
||||||
|
creates => '/etc/apache2/conf-enabled/nagios4-cgi.conf',
|
||||||
|
notify => Service['apache2'],
|
||||||
|
}
|
||||||
|
|
||||||
exec { 'a2enmod auth_digest authz_groupfile':
|
exec { 'a2enmod auth_digest authz_groupfile':
|
||||||
subscribe => File['/etc/apache2/conf-enabled/nagios4-cgi.conf'],
|
subscribe => File['/etc/apache2/conf-enabled/nagios4-cgi.conf'],
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
notify => Service['apache2'],
|
notify => Service['apache2'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Run this manually 'htdigest -c /etc/nagios4/htdigest.users Nagios4 nagiosadmin' and enter the password in $web_admin_pw
|
||||||
|
|
||||||
file {
|
file {
|
||||||
'/root/MONITOR_WEB_PASSWORD':
|
'/root/MONITOR_WEB_PASSWORD':
|
||||||
content => sprintf("%s\n%s\n", $web_admin_user, $web_admin_pw),
|
content => sprintf("%s\n%s\n", $web_admin_user, $web_admin_pw),
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
# apache configuration for nagios 4.x
|
||||||
|
|
||||||
|
ScriptAlias /cgi-bin/nagios4 /usr/lib/cgi-bin/nagios4
|
||||||
|
ScriptAlias /nagios4/cgi-bin /usr/lib/cgi-bin/nagios4
|
||||||
|
|
||||||
|
# Where the stylesheets (config files) reside
|
||||||
|
Alias /nagios4/stylesheets /etc/nagios4/stylesheets
|
||||||
|
|
||||||
|
# Where the HTML pages live
|
||||||
|
Alias /nagios4 /usr/share/nagios4/htdocs
|
||||||
|
|
||||||
|
<DirectoryMatch (/usr/share/nagios4/htdocs|/usr/lib/cgi-bin/nagios4|/etc/nagios4/stylesheets)>
|
||||||
|
Options FollowSymLinks
|
||||||
|
DirectoryIndex index.php index.html
|
||||||
|
AllowOverride AuthConfig
|
||||||
|
#
|
||||||
|
# The default Debian nagios4 install sets use_authentication=0 in
|
||||||
|
# /etc/nagios4/cgi.cfg, which turns off nagos's internal authentication.
|
||||||
|
# This is insecure. As a compromise this default apache2 configuration
|
||||||
|
# only allows private IP addresses access.
|
||||||
|
#
|
||||||
|
# The <Files>...</Files> below shows how you can secure the nagios4
|
||||||
|
# web site so anybody can view it, but only authenticated users can issue
|
||||||
|
# commands (such as silence notifications). To do that replace the
|
||||||
|
# "Require all granted" with "Require valid-user", and use htdigest
|
||||||
|
# program from the apache2-utils package to add users to
|
||||||
|
# /etc/nagios4/htdigest.users.
|
||||||
|
#
|
||||||
|
# A step up is to insist all users validate themselves by moving
|
||||||
|
# the stanza's in the <Files>..<Files> into the <DirectoryMatch>.
|
||||||
|
# Then by setting use_authentication=1 in /etc/nagios4/cgi.cfg you
|
||||||
|
# can configure which people get to see a particular service from
|
||||||
|
# within the nagios configuration.
|
||||||
|
#
|
||||||
|
#Require ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
|
||||||
|
AuthDigestDomain "Nagios4"
|
||||||
|
AuthDigestProvider file
|
||||||
|
AuthUserFile "/etc/nagios4/htdigest.users"
|
||||||
|
AuthGroupFile "/etc/group"
|
||||||
|
AuthName "Nagios4"
|
||||||
|
AuthType Digest
|
||||||
|
#Require all granted
|
||||||
|
Require valid-user
|
||||||
|
</DirectoryMatch>
|
||||||
|
|
||||||
|
<Directory /usr/share/nagios4/htdocs>
|
||||||
|
Options +ExecCGI
|
||||||
|
</Directory>
|
Loading…
Add table
Reference in a new issue