Merge conflicts

This commit is contained in:
Alexander Fuhr 2015-08-11 16:35:14 +02:00
commit cea3727c97
1112 changed files with 64201 additions and 27641 deletions

8
.gitattributes vendored
View File

@ -1,5 +1,11 @@
# Exclude files related to git when generating an archive
.git* export-ignore
# Exclude Vagrant and Puppet related files when generating an archive
.puppet* export-ignore
Vagrantfile export-ignore
# Normalize puppet manifests' line endings to LF on checkin and prevent conversion to CRLF when the files are checked out
.vagrant-puppet/* eol=lf
.puppet* eol=lf
# Include version information on `git archive'
/application/VERSION export-subst

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
# Except those related to git and vagrant
!.git*
!.vagrant-puppet/*
!.puppet*
# Exclude application log files
var/log/*

12
.mailmap Normal file
View File

@ -0,0 +1,12 @@
<alexander.klimov@netways.de> <Alexander.Klimov@netways.de>
<carloscesario@gmail.com> <ccesario@tecnomega.com.br>
<christopher.ruell@netways.de> <Christopher.Ruell@netways.de>
<gunnar.beutner@netways.de> <gunnar@beutner.name>
Jannis Moßhammer <jannis.mosshammer@netways.de>
<matthias.jentsch@netways.de> <mjentsch@localhost.int.netways.de>
<michael.friedrich@netways.de> <Michael.Friedrich@netways.de>
<michael.friedrich@netways.de> <michael.friedrich@gmail.com>
<thomas.gelf@netways.de> <thomas@gelf.net>
Thomas Gelf <thomas.gelf@netways.de> <root@squeeze-devel1.osmc.lab>
Thomas Gelf <thomas.gelf@netways.de> <tgelf@tgelf-web2dep.(none)>
Sylph Lin <sylph.lin@gmail.com>

22
.puppet/TODO.md Normal file
View File

@ -0,0 +1,22 @@
Fix steps that are always provisioned:
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[statusdata]/Parent_dirs[/etc/icinga2/features-enabled/statusdata.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/statusdata.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[constants]/Parent_dirs[/etc/icinga2/constants.conf]/Exec[parent_dirs-/etc/icinga2/constants.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/commands]/Parent_dirs[/etc/icinga2/conf.d/commands.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/commands.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[command]/Parent_dirs[/etc/icinga2/features-enabled/command.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/command.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icingaweb2_dev/Pgsql::Database::Populate[icingaweb]/Exec[populate-icingaweb-pgsql-db]/returns: executed successfully
==> default: Notice: /Stage[main]/Php/Exec[php-timezone]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/test-config]/Parent_dirs[/etc/icinga2/conf.d/test-config.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/test-config.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[populate-openldap]/returns: executed successfully
==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[configure-Monitoring-Generator-TestConfig]/returns: executed successfully
==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[make-Monitoring-Generator-TestConfig]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[compatlog]/Parent_dirs[/etc/icinga2/features-enabled/compatlog.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/compatlog.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Parent_dirs[/etc/icinga2/features-enabled/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-mysql.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Apache/Service[httpd]: Triggered 'refresh' from 1 events
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-monitoring-module]/returns: executed successfully
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-test-module]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Icinga2::Config[features-available/ido-mysql]/Parent_dirs[/etc/icinga2/features-available/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-mysql.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Icinga2::Config[features-available/ido-pgsql]/Parent_dirs[/etc/icinga2/features-available/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-pgsql.conf]/returns: executed successfully
==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Parent_dirs[/etc/icinga2/features-enabled/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-pgsql.conf]/returns: executed successfully
Fix provisioning for CentOS 7

View File

@ -0,0 +1,8 @@
---
icingaweb2::config: /etc/icingaweb2
icingaweb2::log: /var/log/icingaweb2/icingaweb2.log
icingaweb2::web_path: icingaweb2
icingaweb2::db_user: icingaweb2
icingaweb2::db_pass: icingaweb2
icingaweb2::db_name: icingaweb2
icingaweb2::group: icingaweb2

9
.puppet/hiera/hiera.yaml Normal file
View File

@ -0,0 +1,9 @@
---
:backends:
- yaml
:hierarchy:
- common
:yaml:
:datadir: /vagrant/.puppet/hiera

View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e
if which puppet >/dev/null 2>&1; then
exit 0
fi
RELEASEVER=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
case $RELEASEVER in
6|7)
PUPPET="http://yum.puppetlabs.com/puppetlabs-release-el-${RELEASEVER}.noarch.rpm"
;;
*)
echo "Unknown release version: $RELEASEVER" >&2
exit 1
;;
esac
echo "Adding puppet repository.."
rpm --import "https://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs"
rpm -Uvh $PUPPET >/dev/null
echo "Installing puppet.."
yum install -y puppet >/dev/null

17
.puppet/manifests/site.pp Normal file
View File

@ -0,0 +1,17 @@
stage { 'repositories':
before => Stage['main'],
}
node default {
class { 'epel':
stage => repositories,
}
include icinga2_dev
include icingaweb2_dev
include motd
file { '/etc/profile.d/env.sh':
source => 'puppet:////vagrant/.puppet/files/etc/profile.d/env.sh'
}
@user { vagrant: ensure => present }
User <| title == vagrant |> { groups +> hiera('icingaweb2::group') }
}

View File

@ -13,20 +13,31 @@
# include apache
#
class apache {
$apache = $::operatingsystem ? {
/(Debian|Ubuntu)/ => 'apache2',
/(RedHat|CentOS|Fedora)/ => 'httpd'
}
$user = $::operatingsystem ? {
/(Debian|Ubuntu)/ => 'www-data',
/(RedHat|CentOS|Fedora)/ => 'apache'
}
package { $apache:
ensure => installed,
alias => 'apache'
ensure => latest,
alias => 'apache',
}
service { $apache:
ensure => running,
enable => true,
alias => 'apache',
require => Package['apache']
require => Package['apache'],
}
@user { $user:
alias => 'apache',
}
User <| alias == apache |>
}

View File

@ -0,0 +1,15 @@
define cmmi_dir (
$configure='./configure',
$make='make && make install'
) {
Exec {
path => '/usr/bin:/bin',
cwd => "/usr/local/src/${name}",
}
exec { "configure-${name}":
command => $configure,
} -> exec { "make-${name}":
command => $make,
}
}

View File

@ -15,10 +15,10 @@
class epel {
yumrepo { 'epel':
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}",
enabled => '0',
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-${::operatingsystemmajrelease}&arch=${::architecture}",
enabled => '1',
gpgcheck => '0',
descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}"
descr => "Extra Packages for Enterprise Linux ${::operatingsystemmajrelease} - ${::architecture}"
}
}

View File

@ -0,0 +1,13 @@
# Class: git
#
# This class installs git.
#
# Sample Usage:
#
# include git
#
class git {
package { 'git':
ensure => latest,
}
}

View File

@ -0,0 +1,20 @@
define git_cmmi (
$url,
$configure='./configure',
$make='make && make install'
) {
include git
$srcDir = '/usr/local/src'
exec { "git-clone-${name}":
cwd => $srcDir,
path => '/usr/bin:/bin',
unless => "test -d '${srcDir}/${name}/.git'",
command => "git clone '${url}' '${name}'",
require => Class['git'],
} -> cmmi_dir { $name:
configure => $configure,
make => $make,
}
}

View File

@ -0,0 +1,42 @@
# Define: icinga2::config
#
# Provide Icinga 2 configuration file
#
# Parameters:
#
# [*source*] - where to take the file from
#
# Requires:
#
# icinga2
#
# Sample Usage:
#
# icinga2::config { 'constants';
# source => 'puppet:///modules/icinga2_dev',
# }
#
# Provide configuration file '/etc/icinga2/constants.conf'
# from 'puppet:///modules/icinga2_dev/constants.conf'
# ('/path/to/puppet/modules/icinga2_dev/files/constants.conf')
#
define icinga2::config ($source) {
include icinga2
$path = "/etc/icinga2/${name}.conf"
parent_dirs { $path:
user => 'icinga',
require => [
User['icinga'],
File['icinga2cfgDir']
],
}
-> file { $path:
source => "${source}/${name}.conf",
owner => 'icinga',
group => 'icinga',
notify => Service['icinga2'],
require => User['icinga'],
}
}

View File

@ -0,0 +1,31 @@
# Define: icinga2::feature
#
# Enable Icinga 2 feature
#
# Requires:
#
# icinga2
#
# Sample Usage:
#
# icinga2::feature { 'example-feature'; }
#
define icinga2::feature ($ensure = 'present') {
include icinga2
$action = $ensure ? {
/(present)/ => 'enable',
/(absent)/ => 'disable',
}
$test = $ensure ? {
/(present)/ => '-e',
/(absent)/ => '! -e',
}
exec { "icinga2-feature-${action}-${name}":
unless => "/usr/bin/test ${test} /etc/icinga2/features-enabled/${name}.conf",
command => "/usr/sbin/icinga2 feature ${action} ${name}",
require => Package['icinga2'],
notify => Service['icinga2'],
}
}

View File

@ -0,0 +1,42 @@
# Class: icinga2
#
# This class installs Icinga 2.
#
# Requires:
#
# icinga_packages
# icinga2::feature
#
# Sample Usage:
#
# include icinga2
#
class icinga2 {
include icinga_packages
package { [
'icinga2', 'icinga2-doc'
]:
ensure => latest,
require => Class['icinga_packages'],
}
-> service { 'icinga2':
ensure => running,
enable => true,
require => User['icinga'],
}
user { 'icinga':
ensure => present,
}
-> file { 'icinga2cfgDir':
path => '/etc/icinga2',
ensure => directory,
links => follow,
owner => 'icinga',
group => 'icinga',
mode => '6750',
}
icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: }
}

View File

@ -0,0 +1,35 @@
# Class: icinga2_mysql
#
# This class installs Icinga 2 and Icinga-2-IDO-MySQL and set up the database for the last one.
#
# Requires:
#
# icinga_packages
# icinga2
# icinga2::feature
# icinga2::config
# mysql::database::populate
#
# Sample Usage:
#
# include icinga2_mysql
#
class icinga2_mysql {
include icinga2
include icinga_packages
package { 'icinga2-ido-mysql':
ensure => latest,
require => Class['icinga_packages'],
}
-> mysql::database::populate { 'icinga2':
username => 'icinga2',
password => 'icinga2',
privileges => 'SELECT,INSERT,UPDATE,DELETE',
schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql',
}
-> icinga2::config { 'features-available/ido-mysql':
source => 'puppet:///modules/icinga2_mysql',
}
-> icinga2::feature { 'ido-mysql': }
}

View File

@ -0,0 +1,18 @@
class icinga2_pgsql {
include icinga2
include icinga_packages
package { 'icinga2-ido-pgsql':
ensure => latest,
require => Class['icinga_packages'],
}
-> pgsql::database::populate { 'icinga2':
username => 'icinga2',
password => 'icinga2',
schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql',
}
# Because Icinga 2 does not handle more than one IDO connection properly, The ido-pgsql will not be enabled by default.
# -> icinga2::feature { 'ido-pgsql':
# source => 'puppet:///modules/icinga2_pgsql',
# }
}

View File

@ -0,0 +1,17 @@
# Class: icinga_packages
#
# This class adds the YUM repository for the Icinga packages.
#
# Sample Usage:
#
# include icinga_packages
#
class icinga_packages {
yumrepo { 'icinga_packages':
baseurl => "http://packages.icinga.org/epel/${::operatingsystemmajrelease}/snapshot/",
enabled => '1',
gpgcheck => '1',
gpgkey => 'http://packages.icinga.org/icinga.key',
descr => "Icinga Repository - ${::architecture}"
}
}

View File

@ -0,0 +1,12 @@
# TODO(el): This module is not reuseable because it relies on vagrant paths
class icingacli {
file { '/usr/local/bin/icingacli':
ensure => link,
target => '/vagrant/bin/icingacli',
}
file { '/etc/bash_completion.d/icingacli':
ensure => link,
target => '/vagrant/etc/bash_completion.d/icingacli',
}
}

View File

@ -0,0 +1,15 @@
class icingaweb2::config (
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group')
) {
group { $web_group:
ensure => present,
}
file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]:
ensure => directory,
owner => 'root',
group => $web_group,
mode => '2770',
}
}

View File

@ -0,0 +1,21 @@
define icingaweb2::config::general (
$source,
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
file { "${config}/${name}.ini":
content => template("${source}/${name}.ini.erb"),
owner => 'root',
group => $web_group,
mode => '0660',
replace => $replace,
}
}

View File

@ -0,0 +1,26 @@
define icingaweb2::config::module (
$module,
$source,
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
if ! defined(File["${config}/modules/${module}"]) {
file { "${config}/modules/${module}":
ensure => directory,
owner => 'root',
group => $web_group,
mode => '2770',
}
}
file { "${config}/modules/${module}/${name}.ini":
source => "${source}/modules/${module}/${name}.ini",
owner => 'root',
group => $web_group,
mode => '0660',
replace => $replace,
}
}

View File

@ -1,9 +1,9 @@
class monitoring-plugins {
class monitoring_plugins {
include epel
# nagios plugins from epel
package { 'nagios-plugins-all':
ensure => installed,
ensure => latest,
require => Class['epel']
}
}
}

View File

@ -0,0 +1,25 @@
class monitoring_test_config {
package { [
'perl',
'perl-Module-Install',
'perl-CPAN',
'perl-File-Which',
'perl-Time-HiRes'
]:
ensure => latest,
}
-> git_cmmi { 'Monitoring-Generator-TestConfig':
url => 'https://github.com/sni/Monitoring-Generator-TestConfig.git',
configure => 'perl Makefile.PL',
make => 'make && make test && make install',
}
-> exec { 'create_monitoring_test_config':
path => '/usr/local/bin:/usr/bin:/bin',
command => 'install -o root -g root -d /usr/local/share/misc/ && \
create_monitoring_test_config.pl -l icinga /usr/local/share/misc/monitoring_test_config',
creates => '/usr/local/share/misc/monitoring_test_config',
}
-> monitoring_test_config::populate_plugins { [
'test_hostcheck.pl', 'test_servicecheck.pl'
]: }
}

View File

@ -0,0 +1,17 @@
define monitoring_test_config::populate_plugins {
include icinga2
include monitoring_plugins
include monitoring_test_config
file { "/usr/lib64/nagios/plugins/${name}":
owner => 'icinga',
group => 'icinga',
source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}",
require => [
User['icinga'],
Exec['create_monitoring_test_config'],
Class['monitoring_plugins']
],
notify => Service['icinga2'],
}
}

View File

@ -0,0 +1,19 @@
88 88
88 ""
88
88 ,adPPYba, 88 8b,dPPYba, ,adPPYb,d8 ,adPPYYba,
88 a8" "" 88 88P' `"8a a8" `Y88 "" `Y8
88 8b 88 88 88 8b 88 ,adPPPPP88
88 "8a, ,aa 88 88 88 "8a, ,d88 88, ,88
88 `"Ybbd8"' 88 88 88 `"YbbdP"Y8 `"8bbdP"Y8
aa, ,88
"Y8bbdP"
I8, 8 ,8I 88 ad888888b,
`8b d8b d8' 88 d8" "88
"8, ,8"8, ,8" 88 a8P
Y8 8P Y8 8P ,adPPYba, 88,dPPYba, ,d8P"
`8b d8' `8b d8' a8P_____88 88P' "8a a8P"
`8a a8' `8a a8' 8PP""""""" 88 d8 a8P'
`8a8' `8a8' "8b, ,aa 88b, ,a8" d8"
`8' `8' `"Ybbd8"' 8Y"Ybbd8"' 88888888888

View File

@ -0,0 +1,7 @@
class motd {
file { '/etc/motd':
source => 'puppet:///modules/motd/motd',
owner => root,
group => root,
}
}

View File

@ -0,0 +1,33 @@
# Define: mysql::database::create
#
# Create a MySQL database
#
# Parameters:
#
# [*username*] - name of the user the database belongs to
# [*password*] - password of the user the database belongs to
# [*privileges*] - privileges of the user the database belongs to
#
# Requires:
#
# mysql
#
# Sample Usage:
#
# mysql::database::create { 'icinga2':
# username => 'icinga2',
# password => 'icinga2',
# privileges => 'SELECT,INSERT,UPDATE,DELETE',
# }
#
define mysql::database::create ($username, $password, $privileges) {
include mysql
exec { "create-mysql-${name}-db":
unless => "mysql -u${username} -p${password} ${name}",
command => "mysql -uroot -e \"CREATE DATABASE ${name}; \
GRANT ${privileges} ON ${name}.* TO ${username}@localhost \
IDENTIFIED BY '${password}';\"",
require => Class['mysql']
}
}

View File

@ -0,0 +1,39 @@
# Define: mysql::database::populate
#
# Create and populate a MySQL database
#
# Parameters:
#
# [*username*] - name of the user the database belongs to
# [*password*] - password of the user the database belongs to
# [*privileges*] - privileges of the user the database belongs to
# [*schemafile*] - file with the schema for the database
#
# Requires:
#
# mysql::database::create
#
# Sample Usage:
#
# mysql::database::populate { 'icinga2':
# username => 'icinga2',
# password => 'icinga2',
# privileges => 'SELECT,INSERT,UPDATE,DELETE',
# schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql',
# }
#
define mysql::database::populate ($username, $password, $privileges, $schemafile) {
Exec { path => '/bin:/usr/bin' }
mysql::database::create { $name:
username => $username,
password => $password,
privileges => $privileges,
}
exec { "populate-${name}-mysql-db":
onlyif => "mysql -u${username} -p${password} ${name} -e \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'",
command => "mysql -uroot ${name} < ${schemafile}",
require => Mysql::Database::Create[$name],
}
}

View File

@ -0,0 +1,54 @@
# Class: mysql
#
# This class installs the MySQL server and client software on a RHEL or CentOS
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include mysql
#
class mysql {
Exec { path => '/usr/bin' }
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
$client_package_name = 'mariadb'
$server_package_name = 'mariadb-server'
$server_service_name = 'mariadb'
$cnf = '/etc/my.cnf.d/server.cnf'
$log_error = '/var/log/mariadb/mariadb.log'
$pid_file = '/var/run/mariadb/mariadb.pid'
} else {
$client_package_name = 'mysql'
$server_package_name = 'mysql-server'
$server_service_name = 'mysqld'
$cnf = '/etc/my.cnf'
$log_error = '/var/log/mysqld.log'
$pid_file = '/var/run/mysqld/mysqld.pid'
}
package { [
$client_package_name, $server_package_name,
]:
ensure => latest,
}
service { $server_service_name:
alias => 'mysqld',
enable => true,
ensure => running,
require => Package[$server_package_name],
}
file { $cnf:
content => template('mysql/my.cnf.erb'),
notify => Service['mysqld'],
recurse => true,
require => Package[$server_package_name],
}
}

View File

@ -104,8 +104,8 @@ innodb_file_per_table
innodb_log_file_size = 64M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log-error=<%= @log_error %>
pid-file=<%= @pid_file %>
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value

View File

@ -0,0 +1,34 @@
# Class: openldap
#
# This class installs the openldap servers and clients software.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include openldap
#
class openldap {
package { ['openldap-servers', 'openldap-clients']:
ensure => latest,
}
service { 'slapd':
ensure => running,
require => Package['openldap-servers'],
}
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
openldap::schema{ 'core': }
-> openldap::schema{ 'cosine': }
-> openldap::schema{ 'inetorgperson': }
-> openldap::schema{ 'nis': }
-> openldap::schema{ 'misc': }
-> openldap::schema{ 'openldap': }
}
}

View File

@ -0,0 +1,24 @@
# define: openldap::schema
#
# Install a schema.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
define openldap::schema {
include openldap
exec { "openldap-schema-${name}":
command => "ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/${name}.ldif",
group => 'root',
require => Service['slapd'],
unless => "test -n \"$(find /etc/openldap/slapd.d/cn=config/cn=schema/ -name cn={*}${name}.ldif -print -quit)\"",
user => 'root',
}
}

View File

@ -0,0 +1,8 @@
# TODO(el): Remove this. It's always executed and hackish
define parent_dirs ($user = 'root') {
exec { "parent_dirs-${name}":
command => "mkdir -p \"\$(dirname \"\$(readlink -m '${name}')\")\"",
path => '/bin:/usr/bin',
user => $user,
}
}

View File

@ -0,0 +1,32 @@
# Define: pgsql::database::create
#
# Create a PgSQL database
#
# Parameters:
#
# [*username*] - name of the user the database belongs to
# [*password*] - password of the user the database belongs to
#
# Requires:
#
# pgsql
#
# Sample Usage:
#
# pgsql::database::create { 'icinga2':
# username => 'icinga2',
# password => 'icinga2',
# }
#
define pgsql::database::create ($username, $password) {
include pgsql
exec { "create-pgsql-${name}-db":
unless => "psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='${username}'\" | grep -q 1",
command => "psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \
createdb -O ${username} -E UTF8 -T template0 ${name} && \
(createlang plpgsql ${name} || true)",
user => 'postgres',
require => Class['pgsql']
}
}

View File

@ -0,0 +1,37 @@
# Define: pgsql::database::populate
#
# Create and populate a PgSQL database
#
# Parameters:
#
# [*username*] - name of the user the database belongs to
# [*password*] - password of the user the database belongs to
# [*schemafile*] - file with the schema for the database
#
# Requires:
#
# pgsql::database::create
#
# Sample Usage:
#
# pgsql::database::populate { 'icinga2':
# username => 'icinga2',
# password => 'icinga2',
# schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql',
# }
#
define pgsql::database::populate ($username, $password, $schemafile) {
Exec { path => '/bin:/usr/bin' }
pgsql::database::create { $name:
username => $username,
password => $password,
}
exec { "populate-${name}-pgsql-db":
onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'",
command => "psql -U ${username} -d ${name} < ${schemafile}",
user => 'postgres',
require => Pgsql::Database::Create[$name],
}
}

View File

@ -17,11 +17,10 @@ class pgsql {
Exec { path => '/sbin:/bin:/usr/bin' }
package {
'postgresql':
ensure => installed;
'postgresql-server':
ensure => installed;
package { [
'postgresql', 'postgresql-server'
]:
ensure => latest,
}
exec { 'initdb':

View File

@ -71,6 +71,11 @@ local icinga icinga trust
host icinga icinga 127.0.0.1/32 trust
host icinga icinga ::1/128 trust
# icinga2
local icinga2 icinga2 trust
host icinga2 icinga2 127.0.0.1/32 trust
host icinga2 icinga2 ::1/128 trust
# icinga_unittest
local icinga_unittest icinga_unittest trust
host icinga_unittest icinga_unittest 127.0.0.1/32 trust
@ -81,6 +86,11 @@ local icingaweb icingaweb trust
host icingaweb icingaweb 127.0.0.1/32 trust
host icingaweb icingaweb ::1/128 trust
# icingaweb2
local <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> trust
host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> 127.0.0.1/32 trust
host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> ::1/128 trust
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:

View File

@ -0,0 +1,28 @@
# Class: php
#
# This class installs php.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# apache
#
# Sample Usage:
#
# include php
#
class php {
include apache
package { 'php':
ensure => latest,
notify => Service['apache'],
require => Package['apache'],
}
php::phpd { ['error_reporting', 'timezone', 'xdebug_settings' ]: }
}

View File

@ -0,0 +1,22 @@
# define: php::phpd
#
# Provision php.d config
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
define php::phpd {
include php
file { "/etc/php.d/$name.ini":
content => template("php/$name.ini.erb"),
notify => Service['apache'],
require => Package['php'],
}
}

View File

@ -0,0 +1 @@
date.timezone = "UTC"

View File

@ -0,0 +1,29 @@
# Class: php_imagick
#
# This class installs the ImageMagick PHP module.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# php
#
# Sample Usage:
#
# include php_imagick
#
class php_imagick {
include php
$php_imagick = $::operatingsystem ? {
/(Debian|Ubuntu)/ => 'php5-imagick',
/(RedHat|CentOS|Fedora)/ => 'php-pecl-imagick',
/(SLES|OpenSuSE)/ => 'php5-imagick',
}
package { $php_imagick:
ensure => latest,
}
}

View File

@ -0,0 +1,24 @@
# Class: zend_framework
#
# This class installs the Zend Framework.
#
# Requires:
#
# epel
#
# Sample Usage:
#
# include zend_framework
#
class zend_framework {
include epel
package { [
'php-ZendFramework',
'php-ZendFramework-Db-Adapter-Pdo-Mysql',
'php-ZendFramework-Db-Adapter-Pdo-Pgsql'
]:
ensure => latest,
require => Class['epel'],
}
}

View File

@ -45,19 +45,19 @@ object HostGroup "all-hosts" {
assign where true
}
local host_types = ["ok", "random", "down", "up", "unreachable", "pending"]
var host_types = ["ok", "random", "down", "up", "unreachable", "pending"]
__for (host_type in host_types) {
for (host_type in host_types) {
object HostGroup "all-" + host_type use (host_type) {
display_name = "All " + host_type + " hosts"
assign where host.vars.check_type == host_type
}
}
local service_types = ["ok", "warning", "critical", "unknown", "flapping", "pending"]
var service_types = ["ok", "warning", "critical", "unknown", "flapping", "pending"]
// Servicegroups
__for (service_type in service_types) {
for (service_type in service_types) {
object ServiceGroup "service-" + service_type use (service_type) {
display_name = "All " + service_type + " services"
assign where service.vars.check_type == service_type
@ -68,7 +68,7 @@ __for (service_type in service_types) {
// Services
// ---------------------------------------------------------------------------------------------------------------------
__function createService(service_type, num) {
function createService(service_type, num) {
apply Service "service-" + service_type + "-" + string(num + 1) use (service_type) {
import "generic-service"
@ -80,8 +80,8 @@ __function createService(service_type, num) {
}
}
__for (num in range(4)) {
__for (service_type in service_types) {
for (num in range(4)) {
for (service_type in service_types) {
createService(service_type, num)
}
}
@ -90,7 +90,7 @@ __for (num in range(4)) {
// Hosts
// ---------------------------------------------------------------------------------------------------------------------
__function createHost(checkType, checkConfig, num, checkEnabled) {
function createHost(checkType, checkConfig, num, checkEnabled) {
object Host "test-" + checkType + "-" + string(num + 1) use (checkEnabled, checkType, checkConfig) {
import "generic-host"
address = "127.0.0.1"
@ -101,7 +101,7 @@ __function createHost(checkType, checkConfig, num, checkEnabled) {
}
}
__for (num in range(10)) {
for (num in range(10)) {
createHost("ok", [ "ok" ], num, true)
createHost("random", [ "random", "flapping" ], num, true)
createHost("down", [ "warning", "critical" ], num, true)

View File

@ -0,0 +1,35 @@
# Class: icinga2_dev
#
# This class installs Icinga 2 w/ MySQL and PostgreSQL and provides Icinga 2 test configuration.
#
# Requires:
#
# icinga2_mysql
# icinga2::config
# icinga2::feature
#
# Sample Usage:
#
# include icinga2_dev
#
class icinga2_dev {
include icinga2_mysql
include icinga2_pgsql
include monitoring_plugins
include monitoring_test_config
icinga2::config { [
'conf.d/test-config', 'conf.d/commands', 'constants'
]:
source => 'puppet:///modules/icinga2_dev',
}
icinga2::feature { 'api':
ensure => absent,
}
icinga2::feature { 'ido-pgsql':
ensure => absent,
require => Class['icinga2_pgsql'],
}
}

View File

@ -0,0 +1,12 @@
[ido-mysql]
type = ido
resource = ido-mysql
[ido-pgsql]
type = ido
resource = ido-pgsql
[livestatus]
disabled = 1
type = livestatus
resource = livestatus

View File

@ -0,0 +1,2 @@
[security]
protected_customvars = "*pw*,*pass*,community"

View File

@ -0,0 +1,2 @@
[icinga]
path = "/var/run/icinga2/cmd/icinga2.cmd"

View File

@ -6,7 +6,7 @@ olcRootPW: {SSHA}N/2WMqT8q7cElh7KUQz+p9TJbjmKv/u9
replace: olcRootDN
olcRootDN: cn=admin,cn=config
dn: olcDatabase={2}bdb,cn=config
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}MxMpLBo2/TSymoIBf/Sb5iQac7Wwiur5

View File

@ -0,0 +1,142 @@
class icingaweb2_dev (
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$web_group = hiera('icingaweb2::group'),
) {
include apache
include php
include php_imagick
include icingaweb2::config
include icingacli
include icinga_packages
include openldap
# TODO(el): Only include zend_framework. Apache does not have to be notified
class { 'zend_framework':
notify => Service['apache'],
}
# TODO(el): icinga-gui is not a icingaweb2_dev package
package { [ 'php-gd', 'php-intl', 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]:
ensure => latest,
notify => Service['apache'],
require => Class['icinga_packages'],
}
Exec { path => '/usr/local/bin:/usr/bin:/bin' }
# TODO(el): Enabling/disabling modules should be a resource
User <| alias == apache |> { groups +> $web_group }
-> exec { 'enable-monitoring-module':
command => 'icingacli module enable monitoring',
user => 'apache',
require => Class[[ 'icingacli', 'apache' ]],
}
-> exec { 'enable-test-module':
command => 'icingacli module enable test',
user => 'apache'
}
# TODO(el): 'icingacmd' is NOT a icingaweb2_dev group
group { 'icingacmd':
ensure => present,
}
User <| alias == apache |> { groups +> 'icingacmd' }
$log_dir = inline_template('<%= File.dirname(@log) %>')
file { $log_dir:
ensure => directory,
owner => 'root',
group => $web_group,
mode => '2775'
}
$icingaadminSelect = "as CNT from icingaweb_user where name = \'icingaadmin\'\" |grep -qwe \'cnt=0\'"
$icingaadminInsert = "\"INSERT INTO icingaweb_user (name, active, password_hash) VALUES (\'icingaadmin\', 1, \'\\\$1\\\$JMdnEc9M\\\$FW7yapAjv0atS43NkapGo/\');\""
mysql::database::populate { "${db_name}":
username => "${db_user}",
password => "${db_pass}",
privileges => 'ALL',
schemafile => '/vagrant/etc/schema/mysql.schema.sql',
}
-> exec { 'mysql-icingaadmin':
onlyif => "mysql -u${db_user} -p${db_pass} ${db_name} -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}",
command => "mysql -u${db_user} -p${db_pass} ${db_name} -e ${icingaadminInsert}",
}
pgsql::database::populate { "${db_name}":
username => "${db_user}",
password => "${db_pass}",
schemafile => '/vagrant/etc/schema/pgsql.schema.sql',
}
-> exec { 'pgsql-icingaadmin':
onlyif => "psql -U ${db_user} -w -d ${db_name} -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}",
command => "psql -U ${db_user} -w -d ${db_name} -c ${icingaadminInsert}",
environment => "PGPASSWORD=${db_pass}",
}
file { '/etc/httpd/conf.d/icingaweb.conf':
content => template("$name/icingaweb.conf.erb"),
notify => Service['apache'],
}
icingaweb2::config::general { 'authentication':
source => $name,
}
icingaweb2::config::general { [ 'config', 'resources', 'roles' ]:
source => $name,
replace => false,
}
icingaweb2::config::module { [ 'backends', 'config', 'instances' ]:
module => 'monitoring',
source => 'puppet:///modules/icingaweb2_dev',
}
# TODO(el): Should be a resource
package { 'iptables':
ensure => latest
}
-> exec { 'iptables-allow-http':
unless => 'grep -qe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables'
}
# TODO(el): Don't define inside a class
define openldap_file {
file { "openldap/${name}.ldif":
path => "/usr/share/openldap-servers/${name}.ldif",
source => "puppet:///modules/icingaweb2_dev/openldap/${name}.ldif",
require => Class['openldap'],
}
}
openldap_file { [ 'db', 'dit', 'users' ]: }
exec { 'populate-openldap':
# TODO(el): Split the command and use unless instead of trying to populate openldap everytime
command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true',
require => [
Service['slapd'],
File[[
'openldap/db.ldif',
'openldap/dit.ldif',
'openldap/users.ldif'
]]
],
}
# TODO(el): Should be a module
package { 'php-deepend-Mockery':
ensure => latest,
}
}

View File

@ -0,0 +1,16 @@
[autologin]
backend = external
[icingaweb-mysql]
backend = db
resource = icingaweb-mysql
[icingaweb-pgsql]
backend = db
resource = icingaweb-pgsql
[local-ldap]
backend = ldap
resource = local-ldap
user_class = inetOrgPerson
user_name_attribute = uid

View File

@ -0,0 +1,7 @@
[logging]
log = "file"
file = "<%= @log %>"
level = DEBUG
[preferences]
type = "ini"

View File

@ -0,0 +1,38 @@
Alias /<%= @web_path %> "/vagrant/public"
<Directory "/vagrant/public">
Options SymLinksIfOwnerMatch
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
</IfModule>
SetEnv ICINGAWEB_CONFIGDIR <%= @config %>
EnableSendfile Off
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /<%= @web_path %>/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
<IfModule !mod_rewrite.c>
DirectoryIndex error_norewrite.html
ErrorDocument 404 /error_norewrite.html
</IfModule>
</Directory>

View File

@ -0,0 +1,43 @@
[icingaweb-mysql]
type = db
db = mysql
host = localhost
port = 3306
username = <%= @db_user %>
password = <%= @db_pass %>
dbname = <%= @db_name %>
[icingaweb-pgsql]
type = db
db = pgsql
host = localhost
port = 5432
username = <%= @db_user %>
password = <%= @db_pass %>
dbname = <%= @db_name %>
[ido-mysql]
type = db
db = mysql
host = localhost
port = 3306
password = icinga2
username = icinga2
dbname = icinga2
[ido-pgsql]
type = db
db = pgsql
host = localhost
port = 5432
password = icinga2
username = icinga2
dbname = icinga2
[local-ldap]
type = ldap
hostname = localhost
port = 389
root_dn = "ou=people,dc=icinga,dc=org"
bind_dn = "cn=admin,cn=config"
bind_pw = admin

View File

@ -0,0 +1,3 @@
[admins]
users = icingaadmin
permissions = *

View File

@ -1,23 +0,0 @@
Alias /icingaweb /vagrant/public
<Directory "/vagrant/public/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb
EnableSendfile Off
RewriteEngine on
RewriteBase /icingaweb/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
php_value xdebug.idekey PHPSTORM
</Directory>

View File

@ -1,15 +0,0 @@
[autologin]
backend = autologin
;
; If you want to strip the domain
; strip_username_regexp = /\@[^$]+$/
[internal_ldap_authentication]
backend = ldap
resource = internal_ldap
user_class = inetOrgPerson
user_name_attribute = uid
[internal_db_authentication]
backend = db
resource = internal_db

View File

@ -1,19 +0,0 @@
[localdb]
type = ido
resource = "ido"
[locallive]
disabled = "1"
type = livestatus
resource = livestatus
[localfile]
disabled = "1"
type = statusdat
resource = statusdat
;[localfailsafe]
;enabled=false
;type = combo
;backends = localdb, locallive, localfile

View File

@ -1,2 +0,0 @@
[icinga]
path = "/var/run/icinga2/cmd/icinga2.cmd"

View File

@ -1,34 +0,0 @@
[internal_db]
type = db
db = mysql
host = localhost
port = 3306
password = icingaweb
username = icingaweb
dbname = icingaweb
[ido]
type = db
db = mysql
host = localhost
port = 3306
password = icinga2
username = icinga2
dbname = icinga2
[statusdat]
type = statusdat
status_file = /usr/local/icinga-mysql/var/status.dat
object_file = /usr/local/icinga-mysql/var/objects.cache
[livestatus]
type = livestatus
socket = /usr/local/icinga-mysql/var/rw/live
[internal_ldap]
type = ldap
hostname = localhost
port = 389
root_dn = "ou=people, dc=icinga, dc=org"
bind_dn = "cn=admin,cn=config"
bind_pw = admin

View File

@ -1,71 +0,0 @@
#!/bin/bash
#
# chkconfig: 345 99 01
#
### BEGIN INIT INFO
# Provides: icinga_command_proxy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: icinga
# Should-Stop: icinga
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
PROG="icinga_command_proxy"
BIN="/usr/local/bin/icinga_command_proxy"
if [[ -f /etc/sysconfig/$PROG ]]; then
. /etc/sysconfig/$PROG
fi
ICINGA_CMD=${ICINGA_CMD:-"/usr/local/icinga/var/rw/icinga.cmd"}
ICINGA_MYSQL_CMD=${ICINGA_MYSQL_CMD:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"}
ICINGA_PGSQL_CMD=${ICINGA_PGSQL_CMD:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"}
LOCKFILE=${LOCKFILE:-/var/lock/subsys/$PROG}
PIDFILE=${PIDFILE:-/var/lock/subsys/$PROG/$PROG.pid}
RETVAL=0
start() {
echo -n $"Starting $PROG: "
daemon --pidfile="$PIDFILE" "nohup \"$BIN\" \"$ICINGA_CMD\" \"$ICINGA_MYSQL_CMD\" \"$ICINGA_PGSQL_CMD\" >/dev/null 2>&1 &"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch "$LOCKFILE"
return $RETVAL
}
stop() {
echo -n $"Stopping $PROG: "
killproc -p "$PIDFILE" "$BIN"
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p "$PIDFILE" "$BIN"
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $PROG {start|stop|restart|status}"
RETVAL=2
esac
exit $RETVAL

View File

@ -1,16 +0,0 @@
______ ___
/\__ _\ __ /'___`\
\/_/\ \/ ___ /\_\ ___ __ __ /\_\ /\ \
\ \ \ /'___\/\ \ /' _ `\ /'_ `\ /'__`\ \/_/// /__
\_\ \__/\ \__/\ \ \/\ \/\ \/\ \L\ \/\ \L\.\_ // /_\ \
/\_____\ \____\\ \_\ \_\ \_\ \____ \ \__/.\_\ /\______/
\/_____/\/____/ \/_/\/_/\/_/\/___L\ \/__/\/_/ \/_____/
/\____/
\_/__/
__ __ __
/\ \ __/\ \ /\ \
\ \ \/\ \ \ \ __\ \ \____
\ \ \ \ \ \ \ /'__`\ \ '__`\
\ \ \_/ \_\ \/\ __/\ \ \L\ \
\ `\___x___/\ \____\\ \_,__/
'\/__//__/ \/____/ \/___/

View File

@ -1,42 +0,0 @@
#!/bin/bash
#
# Redirect commands from pipe A to pipe B and C
#
set -e
set -u
ICINGA_CMD=${1:-"/usr/local/icinga/var/rw/icinga.cmd"}
ICINGA_MYSQL_CMD=${2:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"}
ICINGA_PGSQL_CMD=${3:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"}
trap 'rm -f "$ICINGA_CMD"; exit' EXIT SIGKILL
if [[ -p "$ICINGA_CMD" ]]; then
rm -f "$ICINGA_CMD"
fi
mkfifo -m 660 "$ICINGA_CMD"
chown icinga.icinga-cmd "$ICINGA_CMD"
while true
do
if read COMMAND
then
if [[ -p "$ICINGA_MYSQL_CMD" ]]; then
echo "$COMMAND" > "$ICINGA_MYSQL_CMD"
else
logger -p local0.err Can\'t distribute command to the Icinga MySQL instance since its command pipe doesn\'t exist
fi
if [[ -p "$ICINGA_PGSQL_CMD" ]]; then
echo "$COMMAND" > "$ICINGA_PGSQL_CMD"
else
logger -p local0.err Can\'t distribute command to the Icinga PostgreSQL instance since its command pipe doesn\'t exist
fi
fi
done < "$ICINGA_CMD" 3> "$ICINGA_CMD"
# Reset all traps
trap - EXIT SIGKILL
exit 0

View File

@ -1,5 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
include '/vagrant/library/Icinga/Application/webrouter.php';

View File

@ -1,763 +0,0 @@
include apache
include mysql
include pgsql
include openldap
Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' }
$icingaVersion = '1.11.5'
$icinga2Version = '2.0.1'
$pluginVersion = '2.0'
$livestatusVersion = '1.2.4p5'
$phantomjsVersion = '1.9.1'
$casperjsVersion = '1.0.2'
exec { 'create-mysql-icinga-db':
unless => 'mysql -uicinga -picinga icinga',
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
GRANT SELECT,INSERT,UPDATE,DELETE ON icinga.* TO icinga@localhost \
IDENTIFIED BY \'icinga\';"',
require => Service['mysqld']
}
exec { 'create-mysql-icinga2-db':
unless => 'mysql -uicinga2 -picinga2 icinga2',
command => 'mysql -uroot -e "CREATE DATABASE icinga2; \
GRANT SELECT,INSERT,UPDATE,DELETE ON icinga2.* to icinga2@localhost \
IDENTIFIED BY \'icinga2\';"',
require => Service['mysqld']
}
exec{ 'create-pgsql-icinga-db':
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1',
command => 'sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD \'icingaweb\';" && \
sudo -u postgres createdb -O icinga -E UTF8 -T template0 icinga && \
sudo -u postgres createlang plpgsql icinga',
require => Service['postgresql']
}
$icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel',
'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils',
'libdbi', 'libdbi-devel', 'libdbi-drivers',
'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]
package { $icinga_packages: ensure => installed }
php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']:
require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ]
}
php::extension { 'php-gd': }
group { 'icinga-cmd':
ensure => present
}
group { 'icingacmd':
ensure => present,
require => Package['icinga2']
}
user { 'icinga':
ensure => present,
groups => 'icinga-cmd',
managehome => false
}
user { 'apache':
groups => ['icinga-cmd', 'vagrant', 'icingacmd'],
require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ]
}
cmmi { 'icinga-mysql':
url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz",
output => "icinga-${icingaVersion}.tar.gz",
flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \
--enable-idoutils --with-init-dir=/usr/local/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 \
--with-plugin-dir=/usr/lib64/nagios/plugins',
creates => '/usr/local/icinga-mysql',
make => 'make all && make fullinstall install-config',
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
notify => Service['apache']
}
file { '/etc/init.d/icinga-mysql':
source => '/usr/local/icinga-mysql/etc/init.d/icinga',
require => Cmmi['icinga-mysql']
}
file { '/etc/init.d/ido2db-mysql':
source => '/usr/local/icinga-mysql/etc/init.d/ido2db',
require => Cmmi['icinga-mysql']
}
cmmi { 'icinga-pgsql':
url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz",
output => "icinga-${icingaVersion}.tar.gz",
flags => '--prefix=/usr/local/icinga-pgsql \
--with-command-group=icinga-cmd --enable-idoutils \
--with-init-dir=/usr/local/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 \
--with-plugin-dir=/usr/lib64/nagios/plugins',
creates => '/usr/local/icinga-pgsql',
make => 'make all && make fullinstall install-config',
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
notify => Service['apache']
}
file { '/etc/init.d/icinga-pgsql':
source => '/usr/local/icinga-pgsql/etc/init.d/icinga',
require => Cmmi['icinga-pgsql']
}
file { '/etc/init.d/ido2db-pgsql':
source => '/usr/local/icinga-pgsql/etc/init.d/ido2db',
require => Cmmi['icinga-pgsql']
}
exec { 'populate-icinga-mysql-db':
unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
command => "mysql -uroot icinga < /usr/local/src/icinga-mysql/icinga-${icingaVersion}/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',
command => "sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql",
require => [ Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db'] ]
}
service { 'icinga-mysql':
ensure => running,
require => File['/etc/init.d/icinga-mysql']
}
service { 'ido2db-mysql':
ensure => running,
require => File['/etc/init.d/ido2db-mysql']
}
file { '/usr/local/icinga-mysql/etc/ido2db.cfg':
content => template('icinga/ido2db-mysql.cfg.erb'),
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-mysql'],
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
}
file { '/usr/local/icinga-mysql/etc/idomod.cfg':
source => '/usr/local/icinga-mysql/etc/idomod.cfg-sample',
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-mysql'],
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
}
file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg':
source => '/usr/local/icinga-mysql/etc/modules/idoutils.cfg-sample',
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-mysql'],
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
}
service { 'icinga-pgsql':
ensure => running,
require => Cmmi['icinga-pgsql']
}
service { 'ido2db-pgsql':
ensure => running,
require => Cmmi['icinga-pgsql']
}
file { '/usr/local/icinga-pgsql/etc/ido2db.cfg':
content => template('icinga/ido2db-pgsql.cfg.erb'),
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-pgsql'],
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
}
file { '/usr/local/icinga-pgsql/etc/idomod.cfg':
source => '/usr/local/icinga-pgsql/etc/idomod.cfg-sample',
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-pgsql'],
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
}
file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg':
source => '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg-sample',
owner => 'icinga',
group => 'icinga',
require => Cmmi['icinga-pgsql'],
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
}
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 -p /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga',
require => Class['apache']
}
include monitoring-plugins
cmmi { 'mk-livestatus':
url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz",
output => "mk-livestatus-${livestatusVersion}.tar.gz",
flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql',
creates => '/usr/local/icinga-mysql/lib/mk-livestatus',
make => 'make && make install',
require => Cmmi['icinga-mysql']
}
file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg':
content => template('mk-livestatus/mk-livestatus.cfg.erb'),
owner => 'icinga',
group => 'icinga',
require => Cmmi['mk-livestatus'],
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
}
file { 'openldap/db.ldif':
path => '/usr/share/openldap-servers/db.ldif',
source => 'puppet:///modules/openldap/db.ldif',
require => Class['openldap']
}
file { 'openldap/dit.ldif':
path => '/usr/share/openldap-servers/dit.ldif',
source => 'puppet:///modules/openldap/dit.ldif',
require => Class['openldap']
}
file { 'openldap/users.ldif':
path => '/usr/share/openldap-servers/users.ldif',
source => 'puppet:///modules/openldap/users.ldif',
require => Class['openldap']
}
exec { 'populate-openldap':
# TODO: Split the command and use unless instead of trying to populate openldap everytime
command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true',
require => [ Service['slapd'], File['openldap/db.ldif'],
File['openldap/dit.ldif'], File['openldap/users.ldif'] ]
}
class { 'phantomjs':
url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
creates => '/usr/local/phantomjs'
}
class { 'casperjs':
url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}",
output => "casperjs-${casperjsVersion}.tar.gz",
creates => '/usr/local/casperjs'
}
file { '/etc/profile.d/env.sh':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh'
}
include epel
exec { 'install PHPUnit':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-phpunit-PHPUnit',
unless => 'rpm -qa | grep php-phpunit-PHPUnit',
require => Class['epel']
}
exec { 'install PHP CodeSniffer':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-pear-PHP-CodeSniffer',
unless => 'rpm -qa | grep php-pear-PHP-CodeSniffer',
require => Class['epel']
}
exec { 'install nodejs':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm',
unless => 'rpm -qa | grep ^npm',
require => Class['epel']
}
exec { 'install npm/mocha':
command => 'npm install -g mocha',
creates => '/usr/lib/node_modules/mocha',
require => Exec['install nodejs']
}
exec { 'install npm/mocha-cobertura-reporter':
command => 'npm install -g mocha-cobertura-reporter',
creates => '/usr/lib/node_modules/mocha-cobertura-reporter',
require => Exec['install npm/mocha']
}
exec { 'install npm/jshint':
command => 'npm install -g jshint',
creates => '/usr/lib/node_modules/jshint',
require => Exec['install nodejs']
}
exec { 'install npm/expect':
command => 'npm install -g expect',
creates => '/usr/lib/node_modules/expect',
require => Exec['install nodejs']
}
exec { 'install npm/should':
command => 'npm install -g should',
creates => '/usr/lib/node_modules/should',
require => Exec['install nodejs']
}
exec { 'install npm/URIjs':
command => 'npm install -g URIjs',
creates => '/usr/lib/node_modules/URIjs',
require => Exec['install nodejs']
}
exec { 'install php-ZendFramework':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework',
unless => 'rpm -qa | grep php-ZendFramework',
require => Class['epel']
}
package { ['cmake', 'boost-devel', 'bison', 'flex']:
ensure => installed
}
# icinga 2
define icinga2::feature ($feature = $title) {
exec { "icinga2-feature-${feature}":
path => '/bin:/usr/bin:/sbin:/usr/sbin',
unless => "readlink /etc/icinga2/features-enabled/${feature}.conf",
command => "icinga2-enable-feature ${feature}",
require => [ Package['icinga2'] ],
notify => Service['icinga2']
}
}
yumrepo { 'icinga2-repo':
baseurl => "http://packages.icinga.org/epel/6/snapshot/",
enabled => '1',
gpgcheck => '1',
gpgkey => 'http://packages.icinga.org/icinga.key',
descr => "Icinga Repository - ${::architecture}"
}
exec { 'install nagios-plugins-all':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install nagios-plugins-all',
unless => 'rpm -qa | grep nagios-plugins-all',
require => [ Class['epel'], Package['icinga2'] ],
}
package { 'icinga2':
ensure => latest,
require => Yumrepo['icinga2-repo'],
alias => 'icinga2'
}
package { 'icinga2-bin':
ensure => latest,
require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ],
alias => 'icinga2-bin'
}
package { 'icinga2-doc':
ensure => latest,
require => Yumrepo['icinga2-repo'],
alias => 'icinga2-doc'
}
# icinga 2 classic ui
package { 'icinga2-classicui-config':
ensure => latest,
before => Package["icinga-gui"],
require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ],
notify => Service['apache']
}
package { 'icinga-gui':
ensure => latest,
require => Yumrepo['icinga2-repo'],
alias => 'icinga-gui'
}
icinga2::feature { 'statusdata':
require => Package['icinga2-classicui-config']
}
icinga2::feature { 'command':
require => Package['icinga2-classicui-config']
}
icinga2::feature { 'compatlog':
require => Package['icinga2-classicui-config']
}
# icinga 2 ido mysql
package { 'icinga2-ido-mysql':
ensure => latest,
require => Yumrepo['icinga2-repo'],
alias => 'icinga2-ido-mysql'
}
exec { 'populate-icinga2-mysql-db':
unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
command => 'mysql -uroot icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql',
require => [ Exec['create-mysql-icinga2-db'], Package['icinga2-ido-mysql'] ]
}
file { '/etc/icinga2/features-available/ido-mysql.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf',
owner => 'icinga',
group => 'icinga',
require => Package['icinga2'],
notify => Service['icinga2']
}
file { '/etc/icinga2/features-enabled/ido-mysql.conf':
ensure => 'link',
target => '/etc/icinga2/features-available/ido-mysql.conf',
owner => 'root',
group => 'root',
require => Package['icinga2-ido-mysql']
}
icinga2::feature { 'ido-mysql':
require => Exec['populate-icinga2-mysql-db']
}
# icinga 2 test config
file { '/etc/icinga2/conf.d/test-config.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf',
owner => 'icinga',
group => 'icinga',
require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ]
}
file { '/etc/icinga2/conf.d/commands.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf',
owner => 'icinga',
group => 'icinga',
require => Package['icinga2']
}
file { '/etc/icinga2/constants.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf',
owner => 'icinga',
group => 'icinga',
require => Package['icinga2']
}
service { 'icinga2':
ensure => running,
require => [
Package['icinga2'],
File['/etc/icinga2/features-enabled/ido-mysql.conf'],
File['/etc/icinga2/conf.d/test-config.conf'],
File['/etc/icinga2/conf.d/commands.conf']
]
}
exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql',
unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql',
require => Exec['install php-ZendFramework']
}
file { '/etc/motd':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd',
owner => root,
group => root
}
user { 'vagrant':
groups => 'icinga-cmd',
require => Group['icinga-cmd']
}
exec { 'create-mysql-icinga_unittest-db':
unless => 'mysql -uicinga_unittest -picinga_unittest icinga_unittest',
command => 'mysql -uroot -e "CREATE DATABASE icinga_unittest; \
GRANT ALL ON icinga_unittest.* TO icinga_unittest@localhost \
IDENTIFIED BY \'icinga_unittest\';"',
require => Service['mysqld']
}
exec{ 'create-pgsql-icinga_unittest-db':
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga_unittest\'" | grep -q 1',
command => 'sudo -u postgres psql -c "CREATE ROLE icinga_unittest WITH LOGIN PASSWORD \'icinga_unittest\';" && \
sudo -u postgres createdb -O icinga_unittest -E UTF8 -T template0 icinga_unittest && \
sudo -u postgres createlang plpgsql icinga_unittest',
require => Service['postgresql']
}
exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Pgsql',
unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Pgsql',
require => Exec['install php-ZendFramework']
}
#
# Following section installs the Perl module Monitoring::Generator::TestConfig in order to create test config to
# */usr/local/share/misc/monitoring_test_config*. Then the config is copied to *<instance>/etc/conf.d/test_config/* of
# both the MySQL and PostgreSQL Icinga instance
#
cpan { 'Monitoring::Generator::TestConfig':
creates => '/usr/local/share/perl5/Monitoring/Generator/TestConfig.pm',
timeout => 600
}
exec { 'create_monitoring_test_config':
command => 'sudo install -o root -g root -d /usr/local/share/misc/ && \
sudo /usr/local/bin/create_monitoring_test_config.pl -l icinga \
/usr/local/share/misc/monitoring_test_config',
creates => '/usr/local/share/misc/monitoring_test_config',
require => Cpan['Monitoring::Generator::TestConfig']
}
define populate_monitoring_test_config {
file { "/usr/local/icinga-mysql/etc/conf.d/test_config/${name}.cfg":
owner => 'icinga',
group => 'icinga',
source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg",
notify => Service['icinga-mysql']
}
file { "/usr/local/icinga-pgsql/etc/conf.d/test_config/${name}.cfg":
owner => 'icinga',
group => 'icinga',
source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg",
notify => Service['icinga-pgsql']
}
}
file { '/usr/local/icinga-mysql/etc/conf.d/test_config/':
ensure => directory,
owner => icinga,
group => icinga,
require => Cmmi['icinga-mysql']
}
file { '/usr/local/icinga-pgsql/etc/conf.d/test_config/':
ensure => directory,
owner => icinga,
group => icinga,
require => Cmmi['icinga-pgsql']
}
populate_monitoring_test_config { ['commands', 'contacts', 'dependencies',
'hostgroups', 'hosts', 'servicegroups', 'services']:
require => [ Exec['create_monitoring_test_config'],
File['/usr/local/icinga-mysql/etc/conf.d/test_config/'],
File['/usr/local/icinga-pgsql/etc/conf.d/test_config/'] ]
}
define populate_monitoring_test_config_plugins {
file { "/usr/lib64/nagios/plugins/${name}":
owner => 'icinga',
group => 'icinga',
source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}",
notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ]
}
}
populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicecheck.pl']:
require => [ Exec['create_monitoring_test_config'],
Cmmi['icinga-mysql'],
Cmmi['icinga-pgsql'] ]
}
#
# Following section creates and populates MySQL and PostgreSQL Icinga Web 2 databases
#
exec { 'create-mysql-icingaweb-db':
unless => 'mysql -uicingaweb -picingaweb icingaweb',
command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \
GRANT ALL ON icingaweb.* TO icingaweb@localhost \
IDENTIFIED BY \'icingaweb\';"',
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 -T template0 icingaweb && \
sudo -u postgres createlang plpgsql icingaweb',
require => Service['postgresql']
}
exec { 'populate-icingaweb-mysql-db-tables':
unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM icingaweb_group;" &> /dev/null',
command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/mysql.schema.sql',
require => [ Exec['create-mysql-icingaweb-db'] ]
}
exec { 'populate-icingweba-pgsql-db-tables':
unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM icingaweb_group;" &> /dev/null',
command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/pgsql.schema.sql',
require => [ Exec['create-pgsql-icingaweb-db'] ]
}
#
# Following section creates the Icinga command proxy to /usr/local/icinga-mysql/var/rw/icinga.cmd (which is the
# config's default path for the Icinga command pipe) in order to send commands to both the MySQL and PostgreSQL instance
#
file { [ '/usr/local/icinga/', '/usr/local/icinga/var/', '/usr/local/icinga/var/rw/' ]:
ensure => directory,
owner => icinga,
group => icinga,
require => User['icinga']
}
file { '/usr/local/bin/icinga_command_proxy':
source => 'puppet:////vagrant/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy',
owner => root,
group => root,
mode => 755
}
file { '/etc/init.d/icinga_command_proxy':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/init.d/icinga_command_proxy',
owner => root,
group => root,
mode => 755,
require => File['/usr/local/bin/icinga_command_proxy']
}
service { 'icinga_command_proxy':
ensure => running,
require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ]
}
exec { 'create-mysql-icinga_web-db':
unless => 'mysql -uicinga_web -picinga_web icinga_web',
command => 'mysql -uroot -e "CREATE DATABASE icinga_web; \
GRANT ALL ON icinga_web.* TO icinga_web@localhost \
IDENTIFIED BY \'icinga_web\';"',
require => Service['mysqld']
}
cmmi { 'icinga-web':
url => 'http://sourceforge.net/projects/icinga/files/icinga-web/1.10.0-beta/icinga-web-1.10.0-beta.tar.gz/download',
output => 'icinga-web-1.10.0-beta.tar.gz',
flags => '--prefix=/usr/local/icinga-web',
creates => '/usr/local/icinga-web',
make => 'make install && make install-apache-config',
require => Service['icinga_command_proxy'],
notify => Service['apache']
}
exec { 'populate-icinga_web-mysql-db':
unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null',
command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/local/src/icinga-web/icinga-web-1.10.0-beta/etc/schema/mysql.sql',
require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ]
}
file { '/var/www/html/icingaweb':
ensure => absent,
}
file { '/etc/httpd/conf.d/icingaweb.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf',
require => Package['apache'],
notify => Service['apache']
}
file { '/etc/icingaweb':
ensure => 'directory',
owner => 'apache',
group => 'apache'
}
file { '/etc/icingaweb/preferences':
ensure => 'directory',
owner => 'apache',
group => 'apache',
require => File['/etc/icingaweb']
}
file { '/etc/icingaweb/authentication.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/authentication.ini',
owner => 'apache',
group => 'apache',
require => File['/etc/icingaweb']
}
file { '/etc/icingaweb/config.ini':
ensure => file,
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/resources.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini',
owner => 'apache',
group => 'apache',
replace => false
}
file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']:
ensure => 'directory',
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/modules/monitoring/backends.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/backends.ini',
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/modules/monitoring/config.ini':
source => 'puppet:////vagrant/config/modules/monitoring/config.ini',
owner => 'apache',
group => 'apache',
}
file { '/etc/icingaweb/modules/monitoring/instances.ini':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini',
owner => 'apache',
group => 'apache',
}
# pear::package { 'deepend/Mockery':
# channel => 'pear.survivethedeepend.com'
# }
# icingacli
file { '/usr/local/bin/icingacli':
ensure => 'link',
target => '/vagrant/bin/icingacli',
owner => 'apache',
group => 'apache',
require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ]
}
exec { 'install bash-completion':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install bash-completion',
unless => 'rpm -qa | grep bash-completion',
require => Class['epel']
}
file { '/etc/bash_completion.d/icingacli':
source => 'puppet:////vagrant/etc/bash_completion.d/icingacli',
owner => 'root',
group => 'root',
mode => 755,
require => Exec['install bash-completion']
}

View File

@ -1,33 +0,0 @@
#!/bin/bash
set -e
installJquery () {
# The npm module jquery won't install via puppet because of an mysterious error
# when node-gyp rebuilding the dependent contextify module
if [ ! -d /usr/lib/node_modules/jquery ]; then
npm install --silent -g jquery
fi
}
startServicesWithNonLSBCompliantExitStatusCodes () {
# Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet
service ido2db-mysql start || true
service ido2db-pgsql start || true
}
mountIcinga2webVarLog () {
if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then
# Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially
/bin/mount -t vboxsf -o \
uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 \
/vagrant/var/log/ \
/vagrant/var/log/
fi
}
installJquery
startServicesWithNonLSBCompliantExitStatusCodes
mountIcinga2webVarLog
exit 0

View File

@ -1,66 +0,0 @@
# Class: casperjs
#
# This module downloads, extracts, and installs casperjs tar.gz archives
# using wget and tar.
#
# Parameters:
# [*url*] - fetch archive via wget from this url.
# [*output*] - filename to fetch the archive into.
# [*creates*] - target directory the software will install to.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class {'casperjs':
# url => 'https://github.com/n1k0/casperjs/tarball/1.0.2',
# output => 'casperjs-1.0.2.tar.gz',
# creates => '/usr/local/casperjs'
# }
#
class casperjs(
$url,
$output,
$creates
) {
Exec { path => '/usr/bin:/bin' }
$cwd = '/usr/local/src'
include wget
exec { 'download-casperjs':
cwd => $cwd,
command => "wget -q ${url} -O ${output}",
creates => "${cwd}/${output}",
timeout => 120,
require => Class['wget']
}
$tld = inline_template('<%= File.basename(@output, ".tar.bz2") %>')
$src = "${cwd}/casperjs"
exec { 'extract-casperjs':
cwd => $cwd,
command => "mkdir -p casperjs && tar --no-same-owner \
--no-same-permissions -xzf ${output} -C ${src} \
--strip-components 1",
creates => $src,
require => Exec['download-casperjs']
}
file { 'install-casperjs':
path => $creates,
source => $src,
recurse => true,
require => Exec['extract-casperjs']
}
file { 'link-casperjs-bin':
ensure => "${creates}/bin/casperjs",
path => '/usr/local/bin/casperjs'
}
}

View File

@ -1,80 +0,0 @@
# Define: cmmi
#
# This module downloads, extracts, builds and installs tar.gz archives using
# wget, tar and the autotools stack. Build directory is always /usr/local/src.
#
# *Note* make sure to install build essentials before running cmmi.
#
# Parameters:
# [*url*] - fetch archive via wget from this url.
# [*output*] - filename to fetch the archive into.
# [*flags*] - configure options.
# [*creates*] - target directory the software will install to.
# [*make* ] - command to make and make install the software.
# [*make_timeout* ] - timeout for the make command.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# cmmi { 'example-software':
# url => 'http://example-software.com/download/',
# output => 'example-software.tar.gz',
# flags => '--prefix=/opt/example-software',
# creates => '/opt/example-software',
# make => 'make && make install'
# make_timeout => 600
# }
#
define cmmi(
$url,
$output,
$flags='',
$creates,
$make,
$make_timeout=300,
$configure_command='sh ./configure'
) {
Exec { path => '/bin:/usr/bin' }
$cwd = '/usr/local/src'
include wget
exec { "download-${name}":
cwd => $cwd,
command => "wget -q \"${url}\" -O ${output}",
creates => "${cwd}/${output}",
require => Class['wget']
}
$tld = inline_template('<%= File.basename(@output, ".tar.gz") %>')
$src = "${cwd}/${name}/${tld}"
exec { "extract-${name}":
cwd => $cwd,
command => "mkdir -p ${name}/${tld} && tar --no-same-owner \
--no-same-permissions -xzf ${output} -C ${name}/${tld} \
--strip-components 1",
creates => $src,
require => Exec["download-${name}"]
}
exec { "configure-${name}":
cwd => $src,
command => "${configure_command} ${flags}",
creates => "${src}/Makefile",
require => Exec["extract-${name}"]
}
exec { "make-${name}":
cwd => $src,
command => $make,
creates => $creates,
require => Exec["configure-${name}"],
timeout => $make_timeout
}
}

View File

@ -1,17 +0,0 @@
# Define: configure
#
# Run a gnu configure to prepare software for environment
#
# Parameters:
# [*flags*] - configure options.
# [*path*] - Target and working dir
#
define configure(
$path,
$flags
) {
exec { "configure-${name}":
cwd => $path,
command => "sh ./configure ${flags}"
}
}

View File

@ -1,49 +0,0 @@
# Define: cpan
#
# Download and install Perl modules from the Perl Archive Network, the canonical location for Perl code and modules.
#
# Parameters:
# [*creates*] - target directory the software will install to.
# [*timeout* ] - timeout for the CPAN command.
#
# Actions:
#
# Requires:
#
# Perl
#
# Sample Usage:
#
# cpan { 'perl-module':
# creates => '/usr/local/share/perl5/perl-module',
# timeout => 600
# }
#
define cpan(
$creates,
$timeout
) {
Exec { path => '/usr/bin' }
package { 'perl-CPAN':
ensure => installed
}
file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]:
ensure => directory
}
file { '/root/.cpan/CPAN/MyConfig.pm':
content => template('cpan/MyConfig.pm.erb'),
require => [ Package['perl-CPAN'],
File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]] ]
}
exec { "cpan-${name}":
command => "sudo perl -MCPAN -e 'install ${name}'",
creates => $creates,
require => File['/root/.cpan/CPAN/MyConfig.pm'],
timeout => $timeout
}
}

View File

@ -1,68 +0,0 @@
$CPAN::Config = {
'applypatch' => q[],
'auto_commit' => q[0],
'build_cache' => q[100],
'build_dir' => q[/root/.cpan/build],
'build_dir_reuse' => q[0],
'build_requires_install_policy' => q[ask/yes],
'bzip2' => q[/usr/bin/bzip2],
'cache_metadata' => q[1],
'check_sigs' => q[0],
'commandnumber_in_prompt' => q[1],
'connect_to_internet_ok' => q[1],
'cpan_home' => q[/root/.cpan],
'curl' => q[/usr/bin/curl],
'ftp' => q[],
'ftp_passive' => q[1],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'halt_on_failure' => q[0],
'histfile' => q[/root/.cpan/histfile],
'histsize' => q[100],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/root/.cpan/sources],
'load_module_verbosity' => q[v],
'lynx' => q[],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[INSTALLDIRS=site],
'mbuild_arg' => q[],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[--installdirs site],
'ncftp' => q[],
'ncftpget' => q[],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'patch' => q[],
'perl5lib_verbosity' => q[v],
'prefer_installer' => q[MB],
'prefs_dir' => q[/root/.cpan/prefs],
'prerequisites_policy' => q[follow],
'scan_cache' => q[atstart],
'shell' => q[/bin/bash],
'show_unparsable_versions' => q[0],
'show_upload_date' => q[0],
'show_zero_versions' => q[0],
'tar' => q[/bin/tar],
'tar_verbosity' => q[v],
'term_is_latin' => q[1],
'term_ornaments' => q[1],
'test_report' => q[0],
'trust_test_report_history' => q[0],
'unzip' => q[/usr/bin/unzip],
'urllist' => [],
'use_sqlite' => q[0],
'wget' => q[/usr/bin/wget],
'yaml_load_code' => q[0],
'yaml_module' => q[YAML],
};
1;
__END__

View File

@ -1,6 +0,0 @@
define module{
module_name mklivestatus
path /usr/local/icinga-mysql/lib/mk-livestatus/livestatus.o
module_type neb
args /usr/local/icinga-mysql/var/rw/live
}

View File

@ -1,36 +0,0 @@
# Class: mysql
#
# This class installs the mysql server and client software.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include mysql
#
class mysql {
Exec { path => '/usr/bin' }
package {
'mysql':
ensure => installed;
'mysql-server':
ensure => installed;
}
service { 'mysqld':
ensure => running,
require => Package['mysql-server']
}
file { '/etc/my.cnf':
content => template('mysql/my.cnf.erb'),
require => Package['mysql-server'],
notify => Service['mysqld']
}
}

View File

@ -1,25 +0,0 @@
# Class: openldap
#
# This class installs the openldap servers and clients software.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include openldap
#
class openldap {
package { ['openldap-servers', 'openldap-clients']:
ensure => installed
}
service { 'slapd':
ensure => running,
require => Package['openldap-servers']
}
}

View File

@ -1,43 +0,0 @@
# Class: pear
#
# This class installs pear.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# php
#
# Sample Usage:
#
# include pear
#
class pear {
Exec { path => '/usr/bin:/bin' }
include php
package { 'php-pear':
ensure => installed,
require => Class['php']
}
exec { 'pear upgrade':
command => 'pear upgrade',
require => Package['php-pear']
}
exec { 'pear update-channels':
command => 'pear update-channels',
require => Package['php-pear']
}
exec { 'pear auto discover channels':
command => 'pear config-set auto_discover 1',
unless => 'pear config-get auto_discover | grep 1',
require => Package['php-pear']
}
}

View File

@ -1,50 +0,0 @@
# Define: pear::package
#
# Install additional PEAR packages
#
# Parameters:
#
# Actions:
#
# Requires:
#
# pear
#
# Sample Usage:
#
# pear::package { 'phpunit': }
#
define pear::package(
$channel
) {
Exec { path => '/usr/bin' }
include pear
if $::require {
$require_ = [Class['pear'], $::require]
} else {
$require_ = Class['pear']
}
if $channel {
exec { "pear discover ${channel}":
command => "sudo pear channel-discover ${channel}",
unless => "pear channel-info ${channel}",
require => $require_,
before => Exec["pear install ${name}"]
}
}
exec { "pear install ${name}":
command => "pear install --alldeps ${name}",
unless => "pear list ${name}",
require => $require_
}
exec { "pear upgrade ${name}":
command => "pear upgrade ${name}",
require => Exec["pear install ${name}"]
}
}

View File

@ -1,65 +0,0 @@
# Class: phantomjs
#
# This module downloads, extracts, and installs phantomjs tar.bz2 archives
# using wget and tar.
#
# Parameters:
# [*url*] - fetch archive via wget from this url.
# [*output*] - filename to fetch the archive into.
# [*creates*] - target directory the software will install to.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class {'phantomjs':
# url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2',
# output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2',
# creates => '/usr/local/phantomjs'
# }
#
class phantomjs(
$url,
$output,
$creates
) {
Exec { path => '/usr/bin:/bin' }
$cwd = '/usr/local/src'
include wget
exec { 'download-phantomjs':
cwd => $cwd,
command => "wget -q ${url} -O ${output}",
creates => "${cwd}/${output}",
timeout => 120,
require => Class['wget']
}
$src = "${cwd}/phantomjs"
exec { 'extract-phantomjs':
cwd => $cwd,
command => "mkdir -p phantomjs && tar --no-same-owner \
--no-same-permissions -xjf ${output} -C ${src} \
--strip-components 1",
creates => $src,
require => Exec['download-phantomjs']
}
file { 'install-phantomjs':
path => $creates,
source => $src,
recurse => true,
require => Exec['extract-phantomjs']
}
file { 'link-phantomjs-bin':
ensure => "${creates}/bin/phantomjs",
path => '/usr/local/bin/phantomjs'
}
}

View File

@ -1,38 +0,0 @@
# Class: php
#
# This class installs php.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# apache
#
# Sample Usage:
#
# include php
#
class php {
include apache
package { 'php':
ensure => installed,
require => Package['apache'],
notify => Service['apache']
}
file { '/etc/php.d/error_reporting.ini':
content => template('php/error_reporting.ini.erb'),
require => Package['php'],
notify => Service['apache']
}
file { '/etc/php.d/xdebug_settings.ini':
content => template('php/xdebug_settings.ini.erb'),
require => Package['php'],
notify => Service['apache']
}
}

View File

@ -1,20 +0,0 @@
# Class: wget
#
# This class installs wget.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include wget
#
class wget {
package { 'wget':
ensure => installed,
}
}

32
AUTHORS Normal file
View File

@ -0,0 +1,32 @@
Alexander A. Klimov <alexander.klimov@netways.de>
Alexander Fuhr <alexander.fuhr@netways.de>
ayoubabid <ayoubabid@users.noreply.github.com>
baufrecht <baufrecht@users.noreply.github.com>
Bence Nagy <bence@underyx.me>
Bernd Erk <bernd.erk@icinga.org>
Boden Garman <boden.garman@spintel.net.au>
Carlos Cesario <carloscesario@gmail.com>
Chris Rüll <christopher.ruell@netways.de>
Daniel Shirley <aditaa@ig2ad.com>
Davide Demuru <davide.demuru@buongiorno.com>
Eric Lippmann <eric.lippmann@netways.de>
Goran Rakic <grakic@devbase.net>
Gunnar Beutner <gunnar.beutner@netways.de>
Jannis Moßhammer <jannis.mosshammer@netways.de>
Johannes Meyer <johannes.meyer@netways.de>
Louis Sautier <sautier.louis@gmail.com>
Marcus Cobden <marcus@marcuscobden.co.uk>
Marius Hein <marius.hein@netways.de>
Markus Frosch <markus@lazyfrosch.de>
Matthias Jentsch <matthias.jentsch@netways.de>
Michael Friedrich <michael.friedrich@netways.de>
Paul Richards <paul@minimoo.org>
rbelinsky <rbelinsky@dalet.com>
Rene Moser <rene.moser@swisstxt.ch>
rkcpi <thieme.sandra@gmail.com>
Susanne Vestner-Ludwig <susanne.vestner-ludwig@inserteffect.com>
Sylph Lin <sylph.lin@gmail.com>
Thomas Gelf <thomas.gelf@netways.de>
Tim Helfensdörfer <tim@visualappeal.de>
Tom Ford <exptom@users.noreply.github.com>
Ulf Lange <mopp@gmx.net>

130
ChangeLog Normal file
View File

@ -0,0 +1,130 @@
## What's New in Version 2.0.0-rc1
### Changes
* Improve layout and look and feel in many ways
* Apply host, service and custom variable restrictions to all monitoring objects
* Add fullscreen mode (?showFullscreen)
* User and group management
* Comment and Downtime Detail View
* Show icon_image in host/service views
* Show Icinga program version in monitoring health
#### Features
* Feature 4139: Notify monitoring backend availability problems
* Feature 4498: Allow to add columns to monitoring views via URL
* Feature 6392: Resolve Icinga 2 runtime macros in action and notes URLs
* Feature 6729: Fullscreen mode
* Feature 7343: Fetch user groups from LDAP
* Feature 7595: Remote connection resource configuration
* Feature 7614: Right-align icons
* Feature 7651: Add module information (module.info) to all core modules
* Feature 8054: Host Groups should list number of hosts (as well as services)
* Feature 8235: Show host and service notes in the host and service detail view
* Feature 8247: Move notifications to the bottom of the page
* Feature 8281: Improve layout of comments and downtimes in the host and service detail views
* Feature 8310: Improve layout of performance data and check statistics in the host and service detail views
* Feature 8565: Improve look and feel of the monitoring multi-select views
* Feature 8613: IDO queries related to concrete objects should not depend on collations
* Feature 8665: Show icon_image in the host and service detail views
* Feature 8781: Automatically deselect rows when closing the detail area
* Feature 8826: User and group management
* Feature 8849: Show only three (or four) significant digits (e.g. in check execution time)
* Feature 8877: Allow module developers to implement new/custom authentication methods
* Feature 8886: Require mandatory parameters in controller actions and CLI commands
* Feature 8902: Downtime detail view
* Feature 8903: Comment detail view
* Feature 9009: Apply host and service restrictions to related views as well
* Feature 9203: Wizard: Validate that a resource is actually an IDO instance
* Feature 9207: Show icinga program version in Monitoring Health
* Feature 9223: Show the active ido endpoint in the monitoring health view
* Feature 9284: Create a ServiceActionsHook
* Feature 9300: Support icon_image_alt
* Feature 9361: Refine UI for RC1
* Feature 9377: Permission and restriction documentation
* Feature 9379: Provide an about.md
#### Bugfixes
* Bug 6281: ShowController's hostAction() and serviceAction() do not respond with 400 for invalid/missing parameters and with 404 if the host or service wasn't found
* Bug 6778: Duration and history time formatting isn't correct
* Bug 6952: Unauthenticated users are provided helpful error messages
* Bug 7151: Play nice with form-button-double-clickers
* Bug 7165: Invalid host address leads to exception w/ PostgreSQL
* Bug 7447: Commands sent over SSH are missing the -i option when using a ssh user aside from the webserver's user
* Bug 7491: Switching from MySQL to PostgreSQL and vice versa doesn't change the port in the resource configuration
* Bug 7642: Monitoring menu renderers should be moved to the monitoring module
* Bug 7658: MenuItemRenderer is not so easy to extend
* Bug 7876: Not all views can be added to the dashboard w/o breaking the layout
* Bug 7931: Can't acknowledge multiple selected services which are in downtime
* Bug 7997: Service-Detail-View tabs are changing their context when clicking the Host-Tab
* Bug 7998: Navigating to the Services-Tab in the Service-Detail-View displays only the selected service
* Bug 8006: Beautify command transport error exceptions
* Bug 8205: List views should not show more than the five worst pies
* Bug 8241: Take display_name into account when searching for host and service names
* Bug 8334: Perfdata details partially hidden depending on the resolution
* Bug 8339: Lib: SimpleQuery::paginate() must not fetch page and limit from request but use them from parameters
* Bug 8343: Status summary does not respect restrictions
* Bug 8363: Updating dashlets corrupts their URLs
* Bug 8453: The filter column "_dev" is not allowed here
* Bug 8472: Missing support for command line arguments in the format --arg=<value>
* Bug 8474: Improve layout of dictionaries in the host and service detail views
* Bug 8624: Delete multiple downtimes and comments at once
* Bug 8696: Can't search for Icinga 2 custom variables
* Bug 8705: Show all shell commands required to get ready in the setup wizard
* Bug 8706: INI files should end with a newline character and should not contain superfluous newlines
* Bug 8707: Wizard: setup seems to fail with just one DB user
* Bug 8711: JS is logging "ugly" side exceptions
* Bug 8731: Apply host restrictions to service views
* Bug 8744: Performance data metrics with value 0 are not displayed
* Bug 8747: Icinga 2 boolean variables not shown in the host and service detail views
* Bug 8777: Server error: Service not found exception when service name begins or ends with whitespaces
* Bug 8815: Only the first external command is sent over SSH when submitting commands for multiple selected hosts or services
* Bug 8847: Missing indication that nothing was found in the docs when searching
* Bug 8860: Host group view calculates states from service states; but states should be calculated from host states instead
* Bug 8927: Tactical overview does not respect restrictions
* Bug 8928: Host and service groups views do not respect restrictions
* Bug 8929: Setup wizard does not validate whether the PostgreSQL user for creating the database owns the CREATE ROLE system privilege
* Bug 8930: Error message about refused connection to the PostgreSQL database server displayed twice in the setup wizard
* Bug 8934: Status text for ok/up becomes white when hovered
* Bug 8941: Long plugin output makes the whole container horizontally scrollable instead of just the row containing the long plugin output
* Bug 8950: Improve English for "The last one occured %s ago"
* Bug 8953: LDAP encryption settings have no effect
* Bug 8956: Can't login when creating the database connection for the preferences store fails
* Bug 8957: Fall back on syslog if the logger's type directive is misconfigured
* Bug 8958: Switching LDAP encryption to LDAPS doesn't change the port in the resource configuration
* Bug 8960: Remove exclamation mark from the notification "Authentication order updated!"
* Bug 8966: Show custom variables visually separated in the host and service detail views
* Bug 8967: Remove right petrol border from plugin output in the host and service detail views
* Bug 8972: Can't view Icinga Web 2's log file
* Bug 8994: Uncaught exception on empty session.save_path()
* Bug 9000: Only the first line of a stack trace is shown in the applications log view
* Bug 9007: Misspelled host and service names in commands are not accepted by icinga
* Bug 9008: Notification overview does not respect restrictions
* Bug 9022: Browser title does not change in case of an error
* Bug 9023: Toggling feature...
* Bug 9025: A tooltip of the service grid's x-axe makes it difficult to click the title of the currently hovered column
* Bug 9026: Add To Dashboard ... on the dashboard
* Bug 9046: Detail View: Downtimes description misses space between duration and comment text
* Bug 9056: Filter for host/servicegroup search doesn't work anymore
* Bug 9057: contact_notify_host_timeperiod
* Bug 9059: Can't initiate an ascending sort by host or service severity
* Bug 9198: monitoring/command/feature/object does not grant the correct permissions
* Bug 9202: The config\* permission does not permit to navigate to the configuration
* Bug 9211: Empty filters are being rendered to SQL which leads to syntax errors
* Bug 9214: Detect multitple icinga_instances entries and warn the user
* Bug 9220: Centralize submission and apply handling of sort rules
* Bug 9224: Allow anonymous LDAP binding
* Bug 9281: Problem with Icingaweb 2 after PHP Upgrade 5.6.8 -> 5.6.9
* Bug 9317: Web 2's ListController inherits from the monitoring module's base controller
* Bug 9319: Downtimes overview does not respect restrictions
* Bug 9350: Menu disappears in user group management view
* Bug 9351: Timeline links are broken
* Bug 9352: User list should be sorted
* Bug 9353: Searching for users fails, at least with LDAP backend
* Bug 9355: msldap seems not to be a first-class citizen
* Bug 9378: Rpm calls usermod w/ invalid option on openSUSE
* Bug 9384: Timeline+Role problem
* Bug 9392: Command links seem to be broken

263
README.md
View File

@ -2,267 +2,26 @@
## Table of Contents
0. [General Information](#general information)
0. [About](#about)
1. [Installation](#installation)
2. [Support](#support)
3. [Vagrant - Virtual development environment](#vagrant)
## General Information
## About
`Icinga Web 2` is the next generation monitoring web interface, framework
and CLI tool developed by the [Icinga Project](https://www.icinga.org/community/team/).
**Icinga Web 2** is the next generation open source monitoring web interface, framework
and command-line interface developed by the [Icinga Project](https://www.icinga.org/), supporting Icinga 2,
Icinga Core and any other monitoring backend compatible with the Livestatus Protocol.
Responsive and fast, rewritten from scratch supporting multiple backends and
providing a CLI tool. Compatible with Icinga Core 2.x and 1.x.
Check the Icinga website for some [insights](https://www.icinga.org/icinga/screenshots/icinga-web-2/).
> **Note**
>
> `Icinga Web 2` is still in development and not meant for production deployment.
> Watch the [development roadmap](https://dev.icinga.org/projects/icingaweb2/roadmap)
> and [Icinga website](https://www.icinga.org/) for release schedule updates!
![Icinga Web 2](https://www.icinga.org/wp-content/uploads/2014/06/service_detail.png "Icinga Web 2")
## Installation
Please navigate to [doc/installation.md](doc/installation.md) for updated details.
For installing Icinga Web 2 please read [doc/installation.md](doc/installation.md).
## Support
Please head over to the [community support channels](https://www.icinga.org/icinga/faq/get-help/)
in case of questions, bugs, etc.
Please make sure to provide the following details:
* OS, distribution, version
* PHP and/or MySQL/PostgreSQL version
* Which browser and its version
* Screenshot and problem description
## Vagrant
### Requirements
* Vagrant 1.2+
* Virtualbox 4.2.16+
* a fairly powerful hardware (quad core, 4gb ram, fast hdd)
> **Note**
>
> The deployment of the virtual machine is tested against Vagrant starting with version 1.2.
> Unfortunately older versions will not work.
### General
The Icinga Web 2 project ships with a Vagrant virtual machine that integrates
the source code with various services and example data in a controlled
environment. This enables developers and users to test Livestatus, status.dat,
MySQL and PostgreSQL backends as well as the LDAP authentication. All you
have to do is install Vagrant and run:
vagrant up
> **Note**
>
> The first boot of the vm takes a fairly long time because
> you'll download a plain CentOS base box and Vagrant will automatically
> provision the environment on the first go.
After you should be able to browse [localhost:8080/icingaweb](http://localhost:8080/icingaweb).
### Environment
**Forwarded ports**:
<table>
<tr>
<th>Proctocol</th>
<th>Local port (virtual machine host)</th>
<th>Remote port (the virtual machine)</th>
</tr>
<tr>
<td>SSH</td>
<td>2222</td>
<td>22</td>
</tr>
<tr>
<td>HTTP</td>
<td>8080</td>
<td>80</td>
</tr>
</table>
**Installed packages**:
* Apache2 with PHP enabled
* PHP with MySQL and PostgreSQL libraries
* MySQL server and client software
* PostgreSQL server and client software
* [Icinga prerequisites](http://docs.icinga.org/latest/en/quickstart-idoutils.html#installpackages)
* OpenLDAP servers and clients
**Installed users and groups**:
* User icinga with group icinga and icinga-cmd
* Webserver user added to group icinga-cmd
**Installed software**:
* Icinga with IDOUtils using a MySQL database
* Icinga with IDOUtils using a PostgreSQL database
* Icinga 2
**Installed files**:
* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both icinga instances
* `/usr/lib64/nagios/plugins` Monitoring Plugins for all Icinga instances
#### 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*.
#### Icinga with IDOUtils using a PostgreSQL database
**Installation path**: `/usr/local/icinga-pgsql`
**Services**:
* `icinga-pgsql`
* `ido2db-pgsql`
Connect to the **icinga mysql database** using the following command:
sudo -u postgres psql -U icinga -d icinga
Access the **Classic UI** (CGIs) via [localhost:8080/icinga-pgsql](http://localhost:8080/icinga-pgsql).
For **logging into** the Icinga classic web interface use user *icingaadmin* with password *icinga*.
#### Monitoring Test Config
Test config is added to both the MySQL and PostgreSQL Icinga instance utilizing the Perl module
**Monitoring::Generator::TestConfig** to generate test config to **/usr/local/share/misc/monitoring_test_config**
which is then copied to **<instance>/etc/conf.d/test_config/**.
Configuration can be adjusted and recreated with **/usr/local/share/misc/monitoring_test_config/recreate.pl**.
**Note** that you have to run
vagrant provision
in the host after any modification to the script just mentioned.
#### MK Livestatus
MK Livestatus is added to the Icinga installation using a MySQL database.
**Installation path**:
* `/usr/local/icinga-mysql/bin/unixcat`
* `/usr/local/icinga-mysql/lib/mk-livestatus/livecheck`
* `/usr/local/icinga-mysql/lib/mk-livestatus/livestatus.o`
* `/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg`
* `/usr/local/icinga-mysql/var/rw/live`
**Example usage**:
echo "GET hosts" | /usr/local/icinga-mysql/bin/unixcat /usr/local/icinga-mysql/var/rw/live
#### LDAP example data
The environment includes a openldap server with example data. *Domain* suffix is **dc=icinga,dc=org**.
Administrator (*rootDN*) of the slapd configuration database is **cn=admin,cn=config** and the
administrator (*rootDN*) of our database instance is **cn=admin,dc=icinga,dc=org**. Both share
the *password* `admin`.
Examples to query the slapd configuration database:
ldapsearch -x -W -LLL -D cn=admin,cn=config -b cn=config dn
ldapsearch -Y EXTERNAL -H ldapi:/// -LLL -b cn=config dn
Examples to query our database instance:
ldapsearch -x -W -LLL -D cn=admin,dc=icinga,dc=org -b dc=icinga,dc=org dn
ldapsearch -Y EXTERNAL -H ldapi:/// -LLL -b dc=icinga,dc=org dn
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
All users share the password `password`.
#### Testing the code
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
vagrant ssh -c /vagrant/test/js/checkswag
vagrant ssh -c /vagrant/test/frontend/runtests
`runtests` will execute unit and regression tests and `checkswag` will report
code style issues.
#### Icinga 2
Installed from the Icinga [snapshot package repository](http://packages.icinga.org/epel/).
The configuration is located in `/etc/icinga2`.
**Example usage**:
/etc/init.d/icinga2 (start|stop|restart|reload)
## Log into Icinga Web 2
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.
Using MySQL as backend:
> **Username**: icingaadmin
> **Password**: icinga
If you come across problems at some time, the [community support channels](https://support.icinga.org/)
are good places to ask for advice from other users and give some in return.
For status updates check the [Icinga website](https://www.icinga.org/) and the
[Icinga Web 2 development roadmap](https://dev.icinga.org/projects/icingaweb2/roadmap).

64
RELEASE.md Normal file
View File

@ -0,0 +1,64 @@
# Quality Assurance
Review and test the changes and issues for this version.
https://dev.icinga.org/projects/icingaweb2/roadmap
# Release Workflow
Update the [.mailmap](.mailmap) and [AUTHORS](AUTHORS) files:
$ git log --use-mailmap | grep ^Author: | cut -f2- -d' ' | sort | uniq > AUTHORS
Update the version number in the [icingaweb2.spec] and [VERSION] files.
Update the [ChangeLog](ChangeLog) file using
the changelog.py script.
Changelog:
$ ./changelog.py --version 2.0.0-rc1
Wordpress:
$ ./changelog.py --version 2.0.0-rc1 --html --links
Commit these changes to the "master" branch:
$ git commit -v -a -m "Release version <VERSION>"
For minor releases: Cherry-pick this commit into the "support" branch.
Create a signed tag (tags/v<VERSION>) on the "master" branch (for major
releases) or the "support" branch (for minor releases).
$ git tag -m "Version <VERSION>" v<VERSION>
Push the tag.
$ git push --tags
For major releases: Create a new "support" branch:
$ git checkout master
$ git checkout -b support/2.x
$ git push -u origin support/2.x
# External Dependencies
## Build Server
### Linux
* Build the newly created git tag for Debian/RHEL/SuSE.
* Provision the vagrant boxes and test the release packages.
## Github Release
Create a new release from the newly created git tag.
https://github.com/Icinga/icingaweb2/releases
## Announcement
* Create a new blog post on www.icinga.org/blog
* Send announcement mail to icinga-announce@lists.icinga.org
* Social media: [Twitter](https://twitter.com/icinga), [Facebook](https://www.facebook.com/icinga), [G+](http://plus.google.com/+icinga), [Xing](https://www.xing.com/communities/groups/icinga-da4b-1060043), [LinkedIn](https://www.linkedin.com/groups/Icinga-1921830/about)

View File

@ -1 +1 @@
v2.0.0-beta1
v2.0.0-rc1

115
Vagrantfile vendored
View File

@ -1,10 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.2.0"
# Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+
VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.5.0"
# Require 1.2.x at least
if ! defined? Vagrant.require_version
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
@ -15,93 +16,39 @@ else
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "centos-6.4-x64-vbox"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://vagrant-boxes.icinga.org/centos-64-x64-vbox4212.box"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network :forwarded_port, guest: 80, host: 8080,
# Port collision auto-correction must be manually enabled for each forwarded port,
# since it is often surprising when it occurs and can lead the Vagrant user to
# think that the port wasn't properly forwarded. During a vagrant up or vagrant reload,
# Vagrant will output information about any collisions detections and auto corrections made,
# so you can take notice and act accordingly.
config.vm.network "forwarded_port", guest: 80, host: 8080,
auto_correct: true
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.33.10"
config.vm.provision :shell, :path => ".puppet/manifests/puppet.sh"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
config.vm.provider :virtualbox do |v, override|
override.vm.box = "centos-71-x64-vbox"
override.vm.box_url = "http://boxes.icinga.org/centos-71-x64-vbox.box"
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./var/log", "/vagrant/var/log"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.
config.vm.provider "virtualbox" do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant/config", "1"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
v.customize ["modifyvm", :id, "--memory", "1024"]
v.customize ["modifyvm", :id, "--cpus", "2"]
end
config.vm.provider :parallels do |p, override|
override.vm.box = "parallels/centos-7.1"
p.name = "Icinga Web 2 Development"
# Update Parallels Tools automatically
p.update_guest_tools = true
# Set power consumption mode to "Better Performance"
p.optimize_power_consumption = false
p.memory = 1024
p.cpus = 2
end
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file base.pp in the manifests_path directory.
#
# An example Puppet manifest to provision the message of the day:
#
# # group { "puppet":
# # ensure => "present",
# # }
# #
# # File { owner => 0, group => 0, mode => 0644 }
# #
# # file { '/etc/motd':
# # content => "Welcome to your Vagrant-built virtual machine!
# # Managed by Puppet.\n"
# # }
#
# config.vm.provision :puppet do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "init.pp"
# end
config.vm.provision :puppet do |puppet|
puppet.module_path = ".vagrant-puppet/modules"
puppet.manifests_path = ".vagrant-puppet/manifests"
# puppet.options = "-v -d"
puppet.hiera_config_path = ".puppet/hiera/hiera.yaml"
puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ]
puppet.manifests_path = ".puppet/manifests"
puppet.manifest_file = "site.pp"
puppet.options = "--parser=future"
end
config.vm.provision :shell, :path => ".vagrant-puppet/manifests/finalize.sh"
end

1
application/VERSION Normal file
View File

@ -0,0 +1 @@
$Format:%H%d %ci$

View File

@ -1,6 +1,5 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Clicommands;

Some files were not shown because too many files have changed in this diff Show More