mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
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 apache
|
||||||
include php
|
|
||||||
include mysql
|
include mysql
|
||||||
include pgsql
|
include pgsql
|
||||||
|
include php
|
||||||
|
|
||||||
Exec { path => '/bin:/usr/bin:/sbin' }
|
Exec { path => '/bin:/usr/bin:/sbin' }
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ exec { 'create-mysql-icinga-db':
|
|||||||
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
||||||
GRANT ALL ON icinga.* TO icinga@localhost \
|
GRANT ALL ON icinga.* TO icinga@localhost \
|
||||||
IDENTIFIED BY \'icinga\';"',
|
IDENTIFIED BY \'icinga\';"',
|
||||||
require => Service['mysqld'],
|
require => Service['mysqld']
|
||||||
}
|
}
|
||||||
|
|
||||||
exec{ 'create-pgsql-icinga-db':
|
exec{ 'create-pgsql-icinga-db':
|
||||||
@ -25,9 +25,9 @@ $icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel',
|
|||||||
'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]
|
'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]
|
||||||
package { $icinga_packages: ensure => installed }
|
package { $icinga_packages: ensure => installed }
|
||||||
|
|
||||||
|
|
||||||
group { 'icinga-cmd':
|
group { 'icinga-cmd':
|
||||||
ensure => present,
|
ensure => present
|
||||||
members => 'www-data'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user { 'icinga':
|
user { 'icinga':
|
||||||
@ -36,13 +36,23 @@ user { 'icinga':
|
|||||||
managehome => false
|
managehome => false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user { 'apache':
|
||||||
|
groups => 'icinga-cmd',
|
||||||
|
require => [Package["${apache::apache}"], Group['icinga-cmd']]
|
||||||
|
}
|
||||||
|
|
||||||
cmmi { 'icinga-mysql':
|
cmmi { 'icinga-mysql':
|
||||||
url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download',
|
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',
|
output => 'icinga-1.9.1.tar.gz',
|
||||||
flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \
|
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',
|
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':
|
file { '/etc/init.d/icinga-mysql':
|
||||||
@ -60,9 +70,14 @@ cmmi { 'icinga-pgsql':
|
|||||||
output => 'icinga-1.9.1.tar.gz',
|
output => 'icinga-1.9.1.tar.gz',
|
||||||
flags => '--prefix=/usr/local/icinga-pgsql \
|
flags => '--prefix=/usr/local/icinga-pgsql \
|
||||||
--with-command-group=icinga-cmd --enable-idoutils \
|
--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',
|
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':
|
file { '/etc/init.d/icinga-pgsql':
|
||||||
@ -76,13 +91,13 @@ file { '/etc/init.d/ido2db-pgsql':
|
|||||||
}
|
}
|
||||||
|
|
||||||
exec { 'populate-icinga-mysql-db':
|
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',
|
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']]
|
require => [Cmmi['icinga-mysql'], Exec['create-mysql-icinga-db']]
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'populate-icinga-pgsql-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',
|
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']]
|
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',
|
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'
|
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:
|
service { $apache:
|
||||||
ensure => running,
|
ensure => running,
|
||||||
|
alias => 'apache',
|
||||||
require => Package['apache']
|
require => Package['apache']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ define cmmi(
|
|||||||
$output,
|
$output,
|
||||||
$flags,
|
$flags,
|
||||||
$creates,
|
$creates,
|
||||||
$make='make all && make fullinstall && make install-config',
|
$make='make all && make install',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Exec { path => '/bin:/usr/bin' }
|
Exec { path => '/bin:/usr/bin' }
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
class php {
|
class php {
|
||||||
|
|
||||||
package { 'php':
|
package { 'php':
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
require => Package["${apache::apache}"]
|
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
|
#### Environment
|
||||||
|
|
||||||
Forwarded ports:
|
**Forwarded ports**:
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -38,19 +38,40 @@ Forwarded ports:
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
Installed packages:
|
**Installed packages**:
|
||||||
|
|
||||||
* Apache2 with PHP library
|
* Apache2 with PHP library
|
||||||
* PHP with MySQL libray
|
* PHP with MySQL libray
|
||||||
* MySQL server and client software
|
* MySQL server and client software
|
||||||
* PostgreSQL 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
|
* User icinga with group icinga and icinga-cmd
|
||||||
* Webserver user added to group icinga-cmd
|
* Webserver user added to group icinga-cmd
|
||||||
|
|
||||||
Installed software:
|
**Installed files**:
|
||||||
|
|
||||||
* Icinga with IDOUtils using a MySQL database
|
* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both instances
|
||||||
* Icinga with IDOUtils using a PostgreSQL database
|
|
||||||
|
**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…
x
Reference in New Issue
Block a user