Vagrant/Icinga w/ MySQL: Add proper apache configuration
Icinga with IDOUtils running on a MySQL database is now available via /icinga-mysql refs #4216
This commit is contained in:
parent
9eafe3b54a
commit
fc370f7801
|
@ -1,7 +1,7 @@
|
|||
include apache
|
||||
include php
|
||||
include mysql
|
||||
include pgsql
|
||||
include php
|
||||
|
||||
Exec { path => '/bin:/usr/bin:/sbin' }
|
||||
|
||||
|
@ -10,7 +10,7 @@ exec { 'create-mysql-icinga-db':
|
|||
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
||||
GRANT ALL ON icinga.* TO icinga@localhost \
|
||||
IDENTIFIED BY \'icinga\';"',
|
||||
require => Service['mysqld'],
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec{ 'create-pgsql-icinga-db':
|
||||
|
@ -25,9 +25,9 @@ $icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel',
|
|||
'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]
|
||||
package { $icinga_packages: ensure => installed }
|
||||
|
||||
|
||||
group { 'icinga-cmd':
|
||||
ensure => present,
|
||||
members => 'www-data'
|
||||
ensure => present
|
||||
}
|
||||
|
||||
user { 'icinga':
|
||||
|
@ -36,13 +36,23 @@ user { 'icinga':
|
|||
managehome => false
|
||||
}
|
||||
|
||||
user { 'apache':
|
||||
groups => 'icinga-cmd',
|
||||
require => [Package["${apache::apache}"], Group['icinga-cmd']]
|
||||
}
|
||||
|
||||
cmmi { 'icinga-mysql':
|
||||
url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download',
|
||||
output => 'icinga-1.9.1.tar.gz',
|
||||
flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \
|
||||
--enable-idoutils --with-init-dir=/tmp/icinga-mysql/etc/init.d',
|
||||
--enable-idoutils --with-init-dir=/tmp/icinga-mysql/etc/init.d \
|
||||
--with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \
|
||||
--with-cgiurl=/icinga-mysql/cgi-bin \
|
||||
--with-http-auth-file=/usr/share/icinga/htpasswd.users',
|
||||
creates => '/usr/local/icinga-mysql',
|
||||
require => User['icinga']
|
||||
make => 'make all && make fullinstall install-config',
|
||||
require => User['icinga'],
|
||||
notify => Service["${apache::apache}"]
|
||||
}
|
||||
|
||||
file { '/etc/init.d/icinga-mysql':
|
||||
|
@ -60,9 +70,14 @@ cmmi { 'icinga-pgsql':
|
|||
output => 'icinga-1.9.1.tar.gz',
|
||||
flags => '--prefix=/usr/local/icinga-pgsql \
|
||||
--with-command-group=icinga-cmd --enable-idoutils \
|
||||
--with-init-dir=/tmp/icinga-pgsql/etc/init.d',
|
||||
--with-init-dir=/tmp/icinga-pgsql/etc/init.d \
|
||||
--with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \
|
||||
--with-cgiurl=/icinga-pgsql/cgi-bin \
|
||||
--with-http-auth-file=/usr/share/icinga/htpasswd.users',
|
||||
creates => '/usr/local/icinga-pgsql',
|
||||
require => User['icinga']
|
||||
make => 'make all && make install install-base install-cgis install-html install-init install-commandmode install-idoutils install-config',
|
||||
require => User['icinga'],
|
||||
notify => Service["${apache::apache}"]
|
||||
}
|
||||
|
||||
file { '/etc/init.d/icinga-pgsql':
|
||||
|
@ -76,13 +91,13 @@ file { '/etc/init.d/ido2db-pgsql':
|
|||
}
|
||||
|
||||
exec { 'populate-icinga-mysql-db':
|
||||
unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" > /dev/null',
|
||||
unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
|
||||
command => 'mysql -uicinga -picinga icinga < /usr/local/src/icinga-mysql/icinga-1.9.1/module/idoutils/db/mysql/mysql.sql',
|
||||
require => [Cmmi['icinga-mysql'], Exec['create-mysql-icinga-db']]
|
||||
}
|
||||
|
||||
exec { 'populate-icinga-pgsql-db':
|
||||
unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" > /dev/null',
|
||||
unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null',
|
||||
command => 'sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-1.9.1/module/idoutils/db/pgsql/pgsql.sql',
|
||||
require => [Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db']]
|
||||
}
|
||||
|
@ -159,3 +174,9 @@ exec { 'iptables-allow-http':
|
|||
unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables'
|
||||
}
|
||||
|
||||
exec { 'icinga-htpasswd':
|
||||
creates => '/usr/share/icinga/htpasswd.users',
|
||||
command => 'mkdir /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga',
|
||||
require => Package["${apache::apache}"]
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ class apache {
|
|||
|
||||
service { $apache:
|
||||
ensure => running,
|
||||
alias => 'apache',
|
||||
require => Package['apache']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ define cmmi(
|
|||
$output,
|
||||
$flags,
|
||||
$creates,
|
||||
$make='make all && make fullinstall && make install-config',
|
||||
$make='make all && make install',
|
||||
) {
|
||||
|
||||
Exec { path => '/bin:/usr/bin' }
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class php {
|
||||
|
||||
package { 'php':
|
||||
ensure => installed,
|
||||
ensure => installed,
|
||||
require => Package["${apache::apache}"]
|
||||
}
|
||||
|
||||
|
|
33
README.md
33
README.md
|
@ -18,7 +18,7 @@ After you should be able to browse [localhost:8080/icinga2-web](http://localhost
|
|||
|
||||
#### Environment
|
||||
|
||||
Forwarded ports:
|
||||
**Forwarded ports**:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -38,19 +38,40 @@ Forwarded ports:
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
Installed packages:
|
||||
**Installed packages**:
|
||||
|
||||
* Apache2 with PHP library
|
||||
* PHP with MySQL libray
|
||||
* MySQL server and client software
|
||||
* PostgreSQL server and client software
|
||||
* [Icinga prerequisites](http://docs.icinga.org/latest/en/quickstart-idoutils.html#installpackages)
|
||||
|
||||
Installed users and groups:
|
||||
**Installed users and groups**:
|
||||
|
||||
* User icinga with group icinga and icinga-cmd
|
||||
* Webserver user added to group icinga-cmd
|
||||
|
||||
Installed software:
|
||||
**Installed files**:
|
||||
|
||||
* Icinga with IDOUtils using a MySQL database
|
||||
* Icinga with IDOUtils using a PostgreSQL database
|
||||
* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both instances
|
||||
|
||||
**Installed software**:
|
||||
|
||||
* Icinga 1.9.1 with IDOUtils using a MySQL database
|
||||
* Icinga 1.9.1 with IDOUtils using a PostgreSQL database
|
||||
|
||||
##### Icinga with IDOUtils using a MySQL database
|
||||
|
||||
**Installation path**: `/usr/local/icinga-mysql`
|
||||
|
||||
**Services**:
|
||||
|
||||
* `icinga-mysql`
|
||||
* `ido2db-mysql`
|
||||
|
||||
Connect to the **icinga mysql database** using the following command:
|
||||
|
||||
mysql -u icinga -p icinga icinga
|
||||
|
||||
Access the **Classic UI** (CGIs) via [localhost:8080/icinga-mysql](http://localhost:8080/icinga-mysql).
|
||||
For logging into the Icinga classic web interface use user *icingaadmin* with password *icinga*.
|
||||
|
|
Loading…
Reference in New Issue