Vagrant: Create and populate Icinga 2 Web MySQL and PostgreSQL databases
refs #4464
This commit is contained in:
parent
6928a806ab
commit
9b203ce698
|
@ -454,3 +454,35 @@ populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicechec
|
|||
Cmmi['icinga-mysql'],
|
||||
Cmmi['icinga-pgsql'] ]
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Following section creates and populates MySQL and PostgreSQL Icinga 2 Web databases
|
||||
#
|
||||
exec { 'create-mysql-icingaweb-db':
|
||||
unless => 'mysql -uicingaweb -picinga icingaweb',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \
|
||||
GRANT ALL ON icingaweb.* TO icingaweb@localhost \
|
||||
IDENTIFIED BY \'icinga\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec{ 'create-pgsql-icingaweb-db':
|
||||
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icingaweb\'" | grep -q 1',
|
||||
command => 'sudo -u postgres psql -c "CREATE ROLE icingaweb WITH LOGIN PASSWORD \'icinga\';" && \
|
||||
sudo -u postgres createdb -O icingaweb -E UTF8 icingaweb && \
|
||||
sudo -u postgres createlang plpgsql icingaweb',
|
||||
require => Service['postgresql']
|
||||
}
|
||||
|
||||
exec { 'populate-icingaweb-mysql-db':
|
||||
unless => 'mysql -uicingaweb -picinga icingaweb -e "SELECT * FROM account;" &> /dev/null',
|
||||
command => 'mysql -uicingaweb -picinga icingaweb < /vagrant/etc/schema/users.mysql.sql',
|
||||
require => [ Exec['create-mysql-icingaweb-db'] ]
|
||||
}
|
||||
|
||||
exec { 'populate-icingweba-pgsql-db':
|
||||
unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null',
|
||||
command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/users.pgsql.sql',
|
||||
require => [ Exec['create-pgsql-icingaweb-db'] ]
|
||||
}
|
||||
|
|
|
@ -76,6 +76,11 @@ local icinga_unittest icinga_unittest trust
|
|||
host icinga_unittest icinga_unittest 127.0.0.1/32 trust
|
||||
host icinga_unittest icinga_unittest ::1/128 trust
|
||||
|
||||
# icingaweb
|
||||
local icingaweb icingaweb trust
|
||||
host icingaweb icingaweb 127.0.0.1/32 trust
|
||||
host icingaweb icingaweb ::1/128 trust
|
||||
|
||||
# "local" is for Unix domain socket connections only
|
||||
local all all ident
|
||||
# IPv4 local connections:
|
||||
|
|
32
README.md
32
README.md
|
@ -6,7 +6,6 @@
|
|||
|
||||
## Vagrant
|
||||
|
||||
|
||||
> **Note** that the deployment of the virtual machine is tested against Vagrant starting with version 1.1.
|
||||
> Unfortunately older versions will not work.
|
||||
|
||||
|
@ -24,7 +23,7 @@ have to do is install Vagrant and run:
|
|||
|
||||
After you should be able to browse [localhost:8080/icinga2-web](http://localhost:8080/icinga2-web).
|
||||
|
||||
### Environment
|
||||
### Environment
|
||||
|
||||
**Forwarded ports**:
|
||||
|
||||
|
@ -113,7 +112,7 @@ Configuration can be adjusted and recreated with **/usr/local/share/misc/monitor
|
|||
|
||||
vagrant provision
|
||||
|
||||
in the host after any modification to the script just mentioned.
|
||||
in the host after any modification to the script just mentioned.
|
||||
|
||||
#### MK Livestatus
|
||||
|
||||
|
@ -151,30 +150,30 @@ Examples to query our database instance:
|
|||
This is what the **dc=icinga,dc=org** *DIT* looks like:
|
||||
|
||||
> dn: dc=icinga,dc=org
|
||||
>
|
||||
>
|
||||
> dn: ou=people,dc=icinga,dc=org
|
||||
>
|
||||
>
|
||||
> dn: ou=groups,dc=icinga,dc=org
|
||||
>
|
||||
>
|
||||
> dn: cn=Users,ou=groups,dc=icinga,dc=org
|
||||
> cn: Users
|
||||
> uniqueMember: cn=Jon Doe,ou=people,dc=icinga,dc=org
|
||||
> uniqueMember: cn=Jane Smith,ou=people,dc=icinga,dc=org
|
||||
> uniqueMember: cn=John Q. Public,ou=people,dc=icinga,dc=org
|
||||
> uniqueMember: cn=Richard Roe,ou=people,dc=icinga,dc=org
|
||||
>
|
||||
>
|
||||
> dn: cn=John Doe,ou=people,dc=icinga,dc=org
|
||||
> cn: John Doe
|
||||
> uid: jdoe
|
||||
>
|
||||
>
|
||||
> dn: cn=Jane Smith,ou=people,dc=icinga,dc=org
|
||||
> cn: Jane Smith
|
||||
> uid: jsmith
|
||||
>
|
||||
>
|
||||
> dn: cn=John Q. Public,ou=people,dc=icinga,dc=org
|
||||
> cn: John Q. Public
|
||||
> uid: jqpublic
|
||||
>
|
||||
>
|
||||
> dn: cn=Richard Roe,ou=people,dc=icinga,dc=org
|
||||
> cn: Richard Roe
|
||||
> uid: rroe
|
||||
|
@ -183,9 +182,9 @@ All users share the password `password`.
|
|||
|
||||
#### Testing the code
|
||||
|
||||
All software required to run tests is installed in the virtual machine.
|
||||
All software required to run tests is installed in the virtual machine.
|
||||
In order to run all tests you have to execute the following commands:
|
||||
|
||||
|
||||
vagrant ssh -c /vagrant/test/php/runtests
|
||||
vagrant ssh -c /vagrant/test/php/checkswag
|
||||
vagrant ssh -c /vagrant/test/js/runtests
|
||||
|
@ -203,3 +202,12 @@ code style issues.
|
|||
|
||||
cd /usr/local/icinga2
|
||||
./sbin/icinga2 -c etc/icinga2/icinga2.conf.dist
|
||||
|
||||
## Log into Icinga 2 Web
|
||||
|
||||
If you've configure LDAP as authentication backend (which is the default) use the following login credentials:
|
||||
|
||||
> **Username**: jdoe
|
||||
> **Password**: password
|
||||
|
||||
Have a look at [LDAP example data](#ldap example data) for more accounts.
|
||||
|
|
Loading…
Reference in New Issue