mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Merge branch 'master' into feature/untranslated-strings-7988
This commit is contained in:
commit
358efe06de
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2,4 +2,4 @@
|
|||||||
.git* export-ignore
|
.git* export-ignore
|
||||||
|
|
||||||
# Normalize puppet manifests' line endings to LF on checkin and prevent conversion to CRLF when the files are checked out
|
# 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
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Except those related to git and vagrant
|
# Except those related to git and vagrant
|
||||||
!.git*
|
!.git*
|
||||||
!.vagrant-puppet/*
|
!.puppet*
|
||||||
|
|
||||||
# Exclude application log files
|
# Exclude application log files
|
||||||
var/log/*
|
var/log/*
|
||||||
|
22
.puppet/TODO.md
Normal file
22
.puppet/TODO.md
Normal 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
|
7
.puppet/hiera/common.yaml
Normal file
7
.puppet/hiera/common.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
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
|
9
.puppet/hiera/hiera.yaml
Normal file
9
.puppet/hiera/hiera.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
:backends:
|
||||||
|
- yaml
|
||||||
|
|
||||||
|
:hierarchy:
|
||||||
|
- common
|
||||||
|
|
||||||
|
:yaml:
|
||||||
|
:datadir: /vagrant/.puppet/hiera
|
26
.puppet/manifests/puppet.sh
Normal file
26
.puppet/manifests/puppet.sh
Normal 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 -ivh $PUPPET >/dev/null
|
||||||
|
|
||||||
|
echo "Installing puppet.."
|
||||||
|
yum install -y puppet >/dev/null
|
17
.puppet/manifests/site.pp
Normal file
17
.puppet/manifests/site.pp
Normal 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 +> icingaweb }
|
||||||
|
}
|
@ -13,20 +13,31 @@
|
|||||||
# include apache
|
# include apache
|
||||||
#
|
#
|
||||||
class apache {
|
class apache {
|
||||||
|
|
||||||
$apache = $::operatingsystem ? {
|
$apache = $::operatingsystem ? {
|
||||||
/(Debian|Ubuntu)/ => 'apache2',
|
/(Debian|Ubuntu)/ => 'apache2',
|
||||||
/(RedHat|CentOS|Fedora)/ => 'httpd'
|
/(RedHat|CentOS|Fedora)/ => 'httpd'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = $::operatingsystem ? {
|
||||||
|
/(Debian|Ubuntu)/ => 'www-data',
|
||||||
|
/(RedHat|CentOS|Fedora)/ => 'apache'
|
||||||
|
}
|
||||||
|
|
||||||
package { $apache:
|
package { $apache:
|
||||||
ensure => installed,
|
ensure => latest,
|
||||||
alias => 'apache'
|
alias => 'apache',
|
||||||
}
|
}
|
||||||
|
|
||||||
service { $apache:
|
service { $apache:
|
||||||
ensure => running,
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
alias => 'apache',
|
alias => 'apache',
|
||||||
require => Package['apache']
|
require => Package['apache'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@user { $user:
|
||||||
|
alias => 'apache',
|
||||||
|
}
|
||||||
|
|
||||||
|
User <| alias == apache |>
|
||||||
}
|
}
|
15
.puppet/modules/cmmi_dir/manifests/init.pp
Normal file
15
.puppet/modules/cmmi_dir/manifests/init.pp
Normal 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,
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@ class epel {
|
|||||||
|
|
||||||
yumrepo { 'epel':
|
yumrepo { 'epel':
|
||||||
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}",
|
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}",
|
||||||
enabled => '0',
|
enabled => '1',
|
||||||
gpgcheck => '0',
|
gpgcheck => '0',
|
||||||
descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}"
|
descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}"
|
||||||
}
|
}
|
13
.puppet/modules/git/manifests/init.pp
Normal file
13
.puppet/modules/git/manifests/init.pp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Class: git
|
||||||
|
#
|
||||||
|
# This class installs git.
|
||||||
|
#
|
||||||
|
# Sample Usage:
|
||||||
|
#
|
||||||
|
# include git
|
||||||
|
#
|
||||||
|
class git {
|
||||||
|
package { 'git':
|
||||||
|
ensure => latest,
|
||||||
|
}
|
||||||
|
}
|
20
.puppet/modules/git_cmmi/manifests/init.pp
Normal file
20
.puppet/modules/git_cmmi/manifests/init.pp
Normal 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,
|
||||||
|
}
|
||||||
|
}
|
42
.puppet/modules/icinga2/manifests/config.pp
Normal file
42
.puppet/modules/icinga2/manifests/config.pp
Normal 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'],
|
||||||
|
}
|
||||||
|
}
|
38
.puppet/modules/icinga2/manifests/feature.pp
Normal file
38
.puppet/modules/icinga2/manifests/feature.pp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Define: icinga2::feature
|
||||||
|
#
|
||||||
|
# Enable Icinga 2 feature
|
||||||
|
#
|
||||||
|
# Requires:
|
||||||
|
#
|
||||||
|
# icinga2
|
||||||
|
#
|
||||||
|
# Sample Usage:
|
||||||
|
#
|
||||||
|
# icinga2::feature { 'example-feature'; }
|
||||||
|
#
|
||||||
|
define icinga2::feature ($source = undef) {
|
||||||
|
include icinga2
|
||||||
|
|
||||||
|
$target = "features-available/${name}"
|
||||||
|
$cfgpath = '/etc/icinga2'
|
||||||
|
$path = "${cfgpath}/features-enabled/${name}.conf"
|
||||||
|
|
||||||
|
if $source != undef {
|
||||||
|
icinga2::config { $target:
|
||||||
|
source => $source,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent_dirs { $path:
|
||||||
|
user => 'icinga',
|
||||||
|
require => [
|
||||||
|
User['icinga'],
|
||||||
|
File['icinga2cfgDir']
|
||||||
|
],
|
||||||
|
}
|
||||||
|
-> file { $path:
|
||||||
|
ensure => link,
|
||||||
|
target => "${cfgpath}/${target}.conf",
|
||||||
|
notify => Service['icinga2'],
|
||||||
|
}
|
||||||
|
}
|
42
.puppet/modules/icinga2/manifests/init.pp
Normal file
42
.puppet/modules/icinga2/manifests/init.pp
Normal 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', 'icinga2-debuginfo'
|
||||||
|
]:
|
||||||
|
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' ]: }
|
||||||
|
}
|
34
.puppet/modules/icinga2_mysql/manifests/init.pp
Normal file
34
.puppet/modules/icinga2_mysql/manifests/init.pp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# 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::feature { 'ido-mysql':
|
||||||
|
source => 'puppet:///modules/icinga2_mysql',
|
||||||
|
}
|
||||||
|
}
|
17
.puppet/modules/icinga2_pgsql/manifests/init.pp
Normal file
17
.puppet/modules/icinga2_pgsql/manifests/init.pp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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',
|
||||||
|
}
|
||||||
|
-> icinga2::feature { 'ido-pgsql':
|
||||||
|
source => 'puppet:///modules/icinga2_pgsql',
|
||||||
|
}
|
||||||
|
}
|
17
.puppet/modules/icinga_packages/manifests/init.pp
Normal file
17
.puppet/modules/icinga_packages/manifests/init.pp
Normal 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/6/snapshot/',
|
||||||
|
enabled => '1',
|
||||||
|
gpgcheck => '1',
|
||||||
|
gpgkey => 'http://packages.icinga.org/icinga.key',
|
||||||
|
descr => "Icinga Repository - ${::architecture}"
|
||||||
|
}
|
||||||
|
}
|
12
.puppet/modules/icingacli/manifests/init.pp
Normal file
12
.puppet/modules/icingacli/manifests/init.pp
Normal 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',
|
||||||
|
}
|
||||||
|
}
|
14
.puppet/modules/icingaweb2/manifests/config.pp
Normal file
14
.puppet/modules/icingaweb2/manifests/config.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
class icingaweb2::config (
|
||||||
|
$config = hiera('icingaweb2::config')
|
||||||
|
) {
|
||||||
|
group { 'icingaweb':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'icingaweb',
|
||||||
|
mode => '2770',
|
||||||
|
}
|
||||||
|
}
|
15
.puppet/modules/icingaweb2/manifests/config/general.pp
Normal file
15
.puppet/modules/icingaweb2/manifests/config/general.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
define icingaweb2::config::general (
|
||||||
|
$source,
|
||||||
|
$config = hiera('icingaweb2::config'),
|
||||||
|
$replace = true
|
||||||
|
) {
|
||||||
|
include icingaweb2::config
|
||||||
|
|
||||||
|
file { "${config}/${name}.ini":
|
||||||
|
content => template("${source}/${name}.ini.erb"),
|
||||||
|
owner => 'root',
|
||||||
|
group => 'icingaweb',
|
||||||
|
mode => 0660,
|
||||||
|
replace => $replace,
|
||||||
|
}
|
||||||
|
}
|
25
.puppet/modules/icingaweb2/manifests/config/module.pp
Normal file
25
.puppet/modules/icingaweb2/manifests/config/module.pp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
define icingaweb2::config::module (
|
||||||
|
$module,
|
||||||
|
$source,
|
||||||
|
$config = hiera('icingaweb2::config'),
|
||||||
|
$replace = true
|
||||||
|
) {
|
||||||
|
include icingaweb2::config
|
||||||
|
|
||||||
|
if ! defined(File["${config}/modules/${module}"]) {
|
||||||
|
file { "${config}/modules/${module}":
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'icingaweb',
|
||||||
|
mode => '2770',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file { "${config}/modules/${module}/${name}.ini":
|
||||||
|
source => "${source}/modules/${module}/${name}.ini",
|
||||||
|
owner => 'root',
|
||||||
|
group => 'icingaweb',
|
||||||
|
mode => 0660,
|
||||||
|
replace => $replace,
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
class monitoring-plugins {
|
class monitoring_plugins {
|
||||||
include epel
|
include epel
|
||||||
|
|
||||||
# nagios plugins from epel
|
# nagios plugins from epel
|
||||||
package { 'nagios-plugins-all':
|
package { 'nagios-plugins-all':
|
||||||
ensure => installed,
|
ensure => latest,
|
||||||
require => Class['epel']
|
require => Class['epel']
|
||||||
}
|
}
|
||||||
}
|
}
|
25
.puppet/modules/monitoring_test_config/manifests/init.pp
Normal file
25
.puppet/modules/monitoring_test_config/manifests/init.pp
Normal 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'
|
||||||
|
]: }
|
||||||
|
}
|
@ -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'],
|
||||||
|
}
|
||||||
|
}
|
19
.puppet/modules/motd/files/motd
Normal file
19
.puppet/modules/motd/files/motd
Normal 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
|
7
.puppet/modules/motd/manifests/init.pp
Normal file
7
.puppet/modules/motd/manifests/init.pp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class motd {
|
||||||
|
file { '/etc/motd':
|
||||||
|
source => 'puppet:///modules/motd/motd',
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
}
|
||||||
|
}
|
33
.puppet/modules/mysql/manifests/database/create.pp
Normal file
33
.puppet/modules/mysql/manifests/database/create.pp
Normal 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']
|
||||||
|
}
|
||||||
|
}
|
39
.puppet/modules/mysql/manifests/database/populate.pp
Normal file
39
.puppet/modules/mysql/manifests/database/populate.pp
Normal 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],
|
||||||
|
}
|
||||||
|
}
|
@ -16,15 +16,15 @@ class mysql {
|
|||||||
|
|
||||||
Exec { path => '/usr/bin' }
|
Exec { path => '/usr/bin' }
|
||||||
|
|
||||||
package {
|
package { [
|
||||||
'mysql':
|
'mysql', 'mysql-server'
|
||||||
ensure => installed;
|
]:
|
||||||
'mysql-server':
|
ensure => latest,
|
||||||
ensure => installed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
service { 'mysqld':
|
service { 'mysqld':
|
||||||
ensure => running,
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
require => Package['mysql-server']
|
require => Package['mysql-server']
|
||||||
}
|
}
|
||||||
|
|
@ -14,8 +14,8 @@
|
|||||||
#
|
#
|
||||||
class openldap {
|
class openldap {
|
||||||
|
|
||||||
package { ['openldap-servers', 'openldap-clients']:
|
package { ['openldap-servers', 'openldap-clients']:
|
||||||
ensure => installed
|
ensure => latest,
|
||||||
}
|
}
|
||||||
|
|
||||||
service { 'slapd':
|
service { 'slapd':
|
8
.puppet/modules/parent_dirs/manifests/init.pp
Normal file
8
.puppet/modules/parent_dirs/manifests/init.pp
Normal 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,
|
||||||
|
}
|
||||||
|
}
|
32
.puppet/modules/pgsql/manifests/database/create.pp
Normal file
32
.puppet/modules/pgsql/manifests/database/create.pp
Normal 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}",
|
||||||
|
user => 'postgres',
|
||||||
|
require => Class['pgsql']
|
||||||
|
}
|
||||||
|
}
|
37
.puppet/modules/pgsql/manifests/database/populate.pp
Normal file
37
.puppet/modules/pgsql/manifests/database/populate.pp
Normal 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],
|
||||||
|
}
|
||||||
|
}
|
@ -17,11 +17,10 @@ class pgsql {
|
|||||||
|
|
||||||
Exec { path => '/sbin:/bin:/usr/bin' }
|
Exec { path => '/sbin:/bin:/usr/bin' }
|
||||||
|
|
||||||
package {
|
package { [
|
||||||
'postgresql':
|
'postgresql', 'postgresql-server'
|
||||||
ensure => installed;
|
]:
|
||||||
'postgresql-server':
|
ensure => latest,
|
||||||
ensure => installed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'initdb':
|
exec { 'initdb':
|
@ -19,10 +19,15 @@ class php {
|
|||||||
include apache
|
include apache
|
||||||
|
|
||||||
package { 'php':
|
package { 'php':
|
||||||
ensure => installed,
|
ensure => latest,
|
||||||
require => Package['apache'],
|
require => Package['apache'],
|
||||||
notify => Service['apache']
|
notify => Service['apache']
|
||||||
}
|
}
|
||||||
|
# TODO(el): Always executed. Should be a resource
|
||||||
|
-> exec { 'php-timezone':
|
||||||
|
command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini',
|
||||||
|
notify => Service['apache'],
|
||||||
|
}
|
||||||
|
|
||||||
file { '/etc/php.d/error_reporting.ini':
|
file { '/etc/php.d/error_reporting.ini':
|
||||||
content => template('php/error_reporting.ini.erb'),
|
content => template('php/error_reporting.ini.erb'),
|
24
.puppet/modules/zend_framework/manifests/init.pp
Normal file
24
.puppet/modules/zend_framework/manifests/init.pp
Normal 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'],
|
||||||
|
}
|
||||||
|
}
|
@ -45,19 +45,19 @@ object HostGroup "all-hosts" {
|
|||||||
assign where true
|
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) {
|
object HostGroup "all-" + host_type use (host_type) {
|
||||||
display_name = "All " + host_type + " hosts"
|
display_name = "All " + host_type + " hosts"
|
||||||
assign where host.vars.check_type == host_type
|
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
|
// Servicegroups
|
||||||
__for (service_type in service_types) {
|
for (service_type in service_types) {
|
||||||
object ServiceGroup "service-" + service_type use (service_type) {
|
object ServiceGroup "service-" + service_type use (service_type) {
|
||||||
display_name = "All " + service_type + " services"
|
display_name = "All " + service_type + " services"
|
||||||
assign where service.vars.check_type == service_type
|
assign where service.vars.check_type == service_type
|
||||||
@ -68,7 +68,7 @@ __for (service_type in service_types) {
|
|||||||
// Services
|
// Services
|
||||||
// ---------------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
__function createService(service_type, num) {
|
function createService(service_type, num) {
|
||||||
apply Service "service-" + service_type + "-" + string(num + 1) use (service_type) {
|
apply Service "service-" + service_type + "-" + string(num + 1) use (service_type) {
|
||||||
import "generic-service"
|
import "generic-service"
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ __function createService(service_type, num) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__for (num in range(4)) {
|
for (num in range(4)) {
|
||||||
__for (service_type in service_types) {
|
for (service_type in service_types) {
|
||||||
createService(service_type, num)
|
createService(service_type, num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ __for (num in range(4)) {
|
|||||||
// Hosts
|
// Hosts
|
||||||
// ---------------------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
__function createHost(checkType, checkConfig, num, checkEnabled) {
|
function createHost(checkType, checkConfig, num, checkEnabled) {
|
||||||
object Host "test-" + checkType + "-" + string(num + 1) use (checkEnabled, checkType, checkConfig) {
|
object Host "test-" + checkType + "-" + string(num + 1) use (checkEnabled, checkType, checkConfig) {
|
||||||
import "generic-host"
|
import "generic-host"
|
||||||
address = "127.0.0.1"
|
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("ok", [ "ok" ], num, true)
|
||||||
createHost("random", [ "random", "flapping" ], num, true)
|
createHost("random", [ "random", "flapping" ], num, true)
|
||||||
createHost("down", [ "warning", "critical" ], num, true)
|
createHost("down", [ "warning", "critical" ], num, true)
|
24
.puppet/profiles/icinga2_dev/manifests/init.pp
Normal file
24
.puppet/profiles/icinga2_dev/manifests/init.pp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Class: icinga2_dev
|
||||||
|
#
|
||||||
|
# This class installs Icinga 2 w/ MySQL and provides Icinga 2 test configuration.
|
||||||
|
#
|
||||||
|
# Requires:
|
||||||
|
#
|
||||||
|
# icinga2_mysql
|
||||||
|
# icinga2::config
|
||||||
|
#
|
||||||
|
# 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',
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
@ -0,0 +1,2 @@
|
|||||||
|
[security]
|
||||||
|
protected_customvars = "*pw*,*pass*,community"
|
@ -0,0 +1,2 @@
|
|||||||
|
[icinga]
|
||||||
|
path = "/var/run/icinga2/cmd/icinga2.cmd"
|
140
.puppet/profiles/icingaweb2_dev/manifests/init.pp
Normal file
140
.puppet/profiles/icingaweb2_dev/manifests/init.pp
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
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'),
|
||||||
|
) {
|
||||||
|
include apache
|
||||||
|
include php
|
||||||
|
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-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 +> 'icingaweb' }
|
||||||
|
-> 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 => 'icingaweb',
|
||||||
|
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' ]:
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
[autologin]
|
||||||
|
backend = autologin
|
||||||
|
|
||||||
|
[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
|
7
.puppet/profiles/icingaweb2_dev/templates/config.ini.erb
Normal file
7
.puppet/profiles/icingaweb2_dev/templates/config.ini.erb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[logging]
|
||||||
|
log = "file"
|
||||||
|
file = "<%= @log %>"
|
||||||
|
level = DEBUG
|
||||||
|
|
||||||
|
[preferences]
|
||||||
|
type = "ini"
|
@ -1,4 +1,4 @@
|
|||||||
Alias /icingaweb /vagrant/public
|
Alias /<%= @web_path %> /vagrant/public
|
||||||
|
|
||||||
<Directory "/vagrant/public/">
|
<Directory "/vagrant/public/">
|
||||||
Options FollowSymLinks
|
Options FollowSymLinks
|
||||||
@ -6,12 +6,12 @@ Alias /icingaweb /vagrant/public
|
|||||||
Order allow,deny
|
Order allow,deny
|
||||||
Allow from all
|
Allow from all
|
||||||
|
|
||||||
# SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb
|
# SetEnv ICINGAWEB_CONFIGDIR <%= @config %>
|
||||||
|
|
||||||
EnableSendfile Off
|
EnableSendfile Off
|
||||||
|
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteBase /icingaweb/
|
RewriteBase /<%= @web_path %>/
|
||||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
RewriteCond %{REQUEST_FILENAME} -d
|
43
.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb
Normal file
43
.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb
Normal 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
|
@ -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
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||||||
[icinga]
|
|
||||||
path = "/var/run/icinga2/cmd/icinga2.cmd"
|
|
@ -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
|
|
@ -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
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
______ ___
|
|
||||||
/\__ _\ __ /'___`\
|
|
||||||
\/_/\ \/ ___ /\_\ ___ __ __ /\_\ /\ \
|
|
||||||
\ \ \ /'___\/\ \ /' _ `\ /'_ `\ /'__`\ \/_/// /__
|
|
||||||
\_\ \__/\ \__/\ \ \/\ \/\ \/\ \L\ \/\ \L\.\_ // /_\ \
|
|
||||||
/\_____\ \____\\ \_\ \_\ \_\ \____ \ \__/.\_\ /\______/
|
|
||||||
\/_____/\/____/ \/_/\/_/\/_/\/___L\ \/__/\/_/ \/_____/
|
|
||||||
/\____/
|
|
||||||
\_/__/
|
|
||||||
__ __ __
|
|
||||||
/\ \ __/\ \ /\ \
|
|
||||||
\ \ \/\ \ \ \ __\ \ \____
|
|
||||||
\ \ \ \ \ \ \ /'__`\ \ '__`\
|
|
||||||
\ \ \_/ \_\ \/\ __/\ \ \L\ \
|
|
||||||
\ `\___x___/\ \____\\ \_,__/
|
|
||||||
'\/__//__/ \/____/ \/___/
|
|
@ -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
|
|
@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
|
|
||||||
include '/vagrant/library/Icinga/Application/webrouter.php';
|
|
@ -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']
|
|
||||||
}
|
|
@ -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
|
|
@ -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'
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
@ -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}"
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
@ -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__
|
|
@ -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
|
|
||||||
}
|
|
@ -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']
|
|
||||||
}
|
|
||||||
}
|
|
@ -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}"]
|
|
||||||
}
|
|
||||||
}
|
|
@ -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'
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
# Class: wget
|
|
||||||
#
|
|
||||||
# This class installs wget.
|
|
||||||
#
|
|
||||||
# Parameters:
|
|
||||||
#
|
|
||||||
# Actions:
|
|
||||||
#
|
|
||||||
# Requires:
|
|
||||||
#
|
|
||||||
# Sample Usage:
|
|
||||||
#
|
|
||||||
# include wget
|
|
||||||
#
|
|
||||||
class wget {
|
|
||||||
|
|
||||||
package { 'wget':
|
|
||||||
ensure => installed,
|
|
||||||
}
|
|
||||||
}
|
|
107
Vagrantfile
vendored
107
Vagrantfile
vendored
@ -2,7 +2,7 @@
|
|||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
VAGRANTFILE_API_VERSION = "2"
|
VAGRANTFILE_API_VERSION = "2"
|
||||||
VAGRANT_REQUIRED_VERSION = "1.2.0"
|
VAGRANT_REQUIRED_VERSION = "1.5.0"
|
||||||
|
|
||||||
# Require 1.2.x at least
|
# Require 1.2.x at least
|
||||||
if ! defined? Vagrant.require_version
|
if ! defined? Vagrant.require_version
|
||||||
@ -15,93 +15,36 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
# All Vagrant configuration is done here. The most common configuration
|
config.vm.network "forwarded_port", guest: 80, host: 8080,
|
||||||
# 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.
|
|
||||||
auto_correct: true
|
auto_correct: true
|
||||||
|
|
||||||
# Create a private network, which allows host-only access to the machine
|
config.vm.provision :shell, :path => ".puppet/manifests/puppet.sh"
|
||||||
# using a specific IP.
|
|
||||||
# config.vm.network :private_network, ip: "192.168.33.10"
|
|
||||||
|
|
||||||
# Create a public network, which generally matched to bridged network.
|
config.vm.provider :virtualbox do |v, override|
|
||||||
# Bridged networks make the machine appear as another physical device on
|
override.vm.box = "puppetlabs/centos-6.5-64-puppet"
|
||||||
# your network.
|
|
||||||
# config.vm.network :public_network
|
|
||||||
|
|
||||||
# If true, then any SSH connections made will enable agent forwarding.
|
v.customize ["modifyvm", :id, "--memory", "1024"]
|
||||||
# Default value: false
|
end
|
||||||
# config.ssh.forward_agent = true
|
|
||||||
|
config.vm.provider :parallels do |p, override|
|
||||||
# Share an additional folder to the guest VM. The first argument is
|
override.vm.box = "parallels/centos-6.5"
|
||||||
# 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
|
p.name = "Icinga Web 2 Development"
|
||||||
# argument is a set of non-required options.
|
|
||||||
config.vm.synced_folder "./var/log", "/vagrant/var/log"
|
# Update Parallels Tools automatically
|
||||||
|
p.update_guest_tools = true
|
||||||
# Provider-specific configuration so you can fine-tune various
|
|
||||||
# backing providers for Vagrant. These expose provider-specific options.
|
# Set power consumption mode to "Better Performance"
|
||||||
# Example for VirtualBox:
|
p.optimize_power_consumption = false
|
||||||
#
|
|
||||||
# config.vm.provider :virtualbox do |vb|
|
p.memory = 1024
|
||||||
# # Don't boot with headless mode
|
p.cpus = 2
|
||||||
# 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"]
|
|
||||||
end
|
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|
|
config.vm.provision :puppet do |puppet|
|
||||||
puppet.module_path = ".vagrant-puppet/modules"
|
puppet.hiera_config_path = ".puppet/hiera/hiera.yaml"
|
||||||
puppet.manifests_path = ".vagrant-puppet/manifests"
|
puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ]
|
||||||
# puppet.options = "-v -d"
|
puppet.manifests_path = ".puppet/manifests"
|
||||||
|
puppet.manifest_file = "site.pp"
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provision :shell, :path => ".vagrant-puppet/manifests/finalize.sh"
|
|
||||||
end
|
end
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
|
||||||
config.vm.box = "parallels/centos-6.5"
|
|
||||||
|
|
||||||
config.vm.network "forwarded_port", guest: 80, host: 8080,
|
|
||||||
auto_correct: true
|
|
||||||
|
|
||||||
config.vm.provider "parallels" do |v|
|
|
||||||
v.name = "Icinga Web 2 Development"
|
|
||||||
# Update Parallels Tools automatically
|
|
||||||
v.update_guest_tools = true
|
|
||||||
# Set power consumption mode to "Better Performance"
|
|
||||||
v.optimize_power_consumption = false
|
|
||||||
v.memory = 1024
|
|
||||||
v.cpus = 2
|
|
||||||
end
|
|
||||||
|
|
||||||
config.puppet_install.puppet_version = :latest
|
|
||||||
|
|
||||||
config.vm.provision :puppet do |puppet|
|
|
||||||
puppet.module_path = ".vagrant-puppet/modules"
|
|
||||||
puppet.manifests_path = ".vagrant-puppet/manifests"
|
|
||||||
# puppet.options = "-v -d"
|
|
||||||
end
|
|
||||||
end
|
|
@ -4,16 +4,17 @@
|
|||||||
|
|
||||||
# namespace Icinga\Application\Controllers;
|
# namespace Icinga\Application\Controllers;
|
||||||
|
|
||||||
use Icinga\Authentication\Backend\AutoLoginBackend;
|
|
||||||
use Icinga\Web\Controller\ActionController;
|
|
||||||
use Icinga\Forms\Authentication\LoginForm;
|
|
||||||
use Icinga\Authentication\AuthChain;
|
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
|
use Icinga\Authentication\AuthChain;
|
||||||
|
use Icinga\Authentication\Backend\AutoLoginBackend;
|
||||||
use Icinga\Exception\AuthenticationException;
|
use Icinga\Exception\AuthenticationException;
|
||||||
use Icinga\Exception\NotReadableError;
|
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
|
use Icinga\Exception\NotReadableError;
|
||||||
|
use Icinga\Forms\Authentication\LoginForm;
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
|
use Icinga\Web\Controller\ActionController;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +34,8 @@ class AuthenticationController extends ActionController
|
|||||||
*/
|
*/
|
||||||
public function loginAction()
|
public function loginAction()
|
||||||
{
|
{
|
||||||
if (@file_exists(Config::resolvePath('setup.token')) && !@file_exists(Config::resolvePath('config.ini'))) {
|
$icinga = Icinga::app();
|
||||||
|
if ($icinga->setupTokenExists() && $icinga->requiresSetup()) {
|
||||||
$this->redirectNow(Url::fromPath('setup'));
|
$this->redirectNow(Url::fromPath('setup'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ class AuthenticationController extends ActionController
|
|||||||
$this->view->errorInfo = $e->getMessage();
|
$this->view->errorInfo = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->configMissing = is_dir(Config::$configDir) === false;
|
$this->view->requiresSetup = Icinga::app()->requiresSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,8 +53,10 @@ class AutologinBackendForm extends Form
|
|||||||
'strip_username_regexp',
|
'strip_username_regexp',
|
||||||
array(
|
array(
|
||||||
'label' => t('Filter Pattern'),
|
'label' => t('Filter Pattern'),
|
||||||
'description' => t('The regular expression to use to strip specific parts off from usernames. Leave empty if you do not want to strip off anything'),
|
'description' => t(
|
||||||
'value' => '/\@[^$]+$/',
|
'The regular expression to use to strip specific parts off from usernames.'
|
||||||
|
. ' Leave empty if you do not want to strip off anything'
|
||||||
|
),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new Zend_Validate_Callback(function ($value) {
|
new Zend_Validate_Callback(function ($value) {
|
||||||
return @preg_match($value, '') !== false;
|
return @preg_match($value, '') !== false;
|
||||||
|
@ -67,7 +67,7 @@ class LoggingConfigForm extends Form
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => t('Application Prefix'),
|
'label' => t('Application Prefix'),
|
||||||
'description' => t('The name of the application by which to prefix syslog messages.'),
|
'description' => t('The name of the application by which to prefix syslog messages.'),
|
||||||
'value' => 'icingaweb',
|
'value' => 'icingaweb2',
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
array(
|
array(
|
||||||
'Regex',
|
'Regex',
|
||||||
@ -106,7 +106,7 @@ class LoggingConfigForm extends Form
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => t('File path'),
|
'label' => t('File path'),
|
||||||
'description' => t('The full path to the log file to write messages to.'),
|
'description' => t('The full path to the log file to write messages to.'),
|
||||||
'value' => $this->getDefaultLogDir(),
|
'value' => '/var/log/icingaweb2/icingaweb2.log',
|
||||||
'validators' => array(new WritablePathValidator())
|
'validators' => array(new WritablePathValidator())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -114,14 +114,4 @@ class LoggingConfigForm extends Form
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the default logging directory for type 'file'
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function getDefaultLogDir()
|
|
||||||
{
|
|
||||||
return realpath(Icinga::app()->getApplicationDir('../var/log/icingaweb.log'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class LivestatusResourceForm extends Form
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => t('Socket'),
|
'label' => t('Socket'),
|
||||||
'description' => t('The path to your livestatus socket used for querying monitoring data'),
|
'description' => t('The path to your livestatus socket used for querying monitoring data'),
|
||||||
'value' => realpath(Icinga::app()->getApplicationDir() . '/../var/rw/livestatus')
|
'value' => '/var/run/icinga2/cmd/livestatus'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ namespace Icinga\Forms\Security;
|
|||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
|
use Zend_Form_Element;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Forms\ConfigForm;
|
use Icinga\Forms\ConfigForm;
|
||||||
use Icinga\Util\String;
|
use Icinga\Util\String;
|
||||||
@ -18,14 +19,14 @@ class RoleForm extends ConfigForm
|
|||||||
/**
|
/**
|
||||||
* Provided permissions by currently loaded modules
|
* Provided permissions by currently loaded modules
|
||||||
*
|
*
|
||||||
* @var array
|
* @type array
|
||||||
*/
|
*/
|
||||||
protected $providedPermissions = array();
|
protected $providedPermissions = array('*' => '*');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provided restrictions by currently loaded modules
|
* Provided restrictions by currently loaded modules
|
||||||
*
|
*
|
||||||
* @var array
|
* @type array
|
||||||
*/
|
*/
|
||||||
protected $providedRestrictions = array();
|
protected $providedRestrictions = array();
|
||||||
|
|
||||||
@ -35,14 +36,26 @@ class RoleForm extends ConfigForm
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
$helper = new Zend_Form_Element('bogus');
|
||||||
foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
|
foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
|
||||||
foreach ($module->getProvidedPermissions() as $permission) {
|
foreach ($module->getProvidedPermissions() as $permission) {
|
||||||
/** @var object $permission */
|
/** @type object $permission */
|
||||||
$this->providedPermissions[$permission->name] = $permission->name . ': ' . $permission->description;
|
$this->providedPermissions[$permission->name] = $permission->name . ': ' . $permission->description;
|
||||||
}
|
}
|
||||||
foreach ($module->getProvidedRestrictions() as $restriction) {
|
foreach ($module->getProvidedRestrictions() as $restriction) {
|
||||||
/** @var object $restriction */
|
/** @type object $restriction */
|
||||||
$this->providedRestrictions[$restriction->name] = $restriction->description;
|
$name = $helper->filterName($restriction->name); // Zend only permits alphanumerics, the underscore,
|
||||||
|
// the circumflex and any ASCII character in range
|
||||||
|
// \x7f to \xff (127 to 255)
|
||||||
|
while (isset($this->providedRestrictions[$name])) {
|
||||||
|
// Because Zend_Form_Element::filterName() replaces any not permitted character with the empty
|
||||||
|
// string we may have duplicate names, e.g. 're/striction' and 'restriction'
|
||||||
|
$name .= '_';
|
||||||
|
}
|
||||||
|
$this->providedRestrictions[$name] = array(
|
||||||
|
'description' => $restriction->description,
|
||||||
|
'name' => $restriction->name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,13 +103,13 @@ class RoleForm extends ConfigForm
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
foreach ($this->providedRestrictions as $name => $description) {
|
foreach ($this->providedRestrictions as $name => $spec) {
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
$name,
|
$name,
|
||||||
array(
|
array(
|
||||||
'label' => $name,
|
'label' => $spec['name'],
|
||||||
'description' => $description
|
'description' => $spec['description']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -129,6 +142,15 @@ class RoleForm extends ConfigForm
|
|||||||
? String::trimSplit($role['permissions'])
|
? String::trimSplit($role['permissions'])
|
||||||
: null;
|
: null;
|
||||||
$role['name'] = $name;
|
$role['name'] = $name;
|
||||||
|
$restrictions = array();
|
||||||
|
foreach ($this->providedRestrictions as $name => $spec) {
|
||||||
|
if (isset($role[$spec['name']])) {
|
||||||
|
// Translate restriction names to filtered element names
|
||||||
|
$restrictions[$name] = $role[$spec['name']];
|
||||||
|
unset($role[$spec['name']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$role = array_merge($role, $restrictions);
|
||||||
$this->populate($role);
|
$this->populate($role);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -230,6 +252,15 @@ class RoleForm extends ConfigForm
|
|||||||
if (isset($values['permissions'])) {
|
if (isset($values['permissions'])) {
|
||||||
$values['permissions'] = implode(', ', $values['permissions']);
|
$values['permissions'] = implode(', ', $values['permissions']);
|
||||||
}
|
}
|
||||||
|
$restrictions = array();
|
||||||
|
foreach ($this->providedRestrictions as $name => $spec) {
|
||||||
|
if (isset($values[$name])) {
|
||||||
|
// Translate filtered element names to restriction names
|
||||||
|
$restrictions[$spec['name']] = $values[$name];
|
||||||
|
unset($values[$name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$values = array_merge($values, $restrictions);
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ if ( isset($pdf) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?= $this->img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '150')) ?>
|
<?= $this->img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '75')) ?>
|
||||||
<!--<div id="page-header">
|
<!--<div id="page-header">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -63,64 +63,4 @@ class Zend_View_Helper_Util extends Zend_View_Helper_Abstract
|
|||||||
}
|
}
|
||||||
return date('H:i d.m.Y', $timestamp);
|
return date('H:i d.m.Y', $timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Not used. This is monitoring module stuff.
|
|
||||||
*/
|
|
||||||
public static function getHostStateClassName($state)
|
|
||||||
{
|
|
||||||
$class = 'unknown';
|
|
||||||
switch ($state) {
|
|
||||||
case null:
|
|
||||||
$class = 'error';
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
$class = 'ok';
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
$class = 'error';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Crap. This is monitoring module stuff.
|
|
||||||
*/
|
|
||||||
public static function getHostStateName($state)
|
|
||||||
{
|
|
||||||
$states = array(
|
|
||||||
0 => 'UP',
|
|
||||||
1 => 'DOWN',
|
|
||||||
2 => 'UNREACHABLE',
|
|
||||||
3 => 'UNKNOWN',
|
|
||||||
4 => 'PENDING', // fake
|
|
||||||
99 => 'PENDING' // fake
|
|
||||||
);
|
|
||||||
if (isset($states[$state])) {
|
|
||||||
return $states[$state];
|
|
||||||
}
|
|
||||||
return sprintf('OUT OF BOUNDS (%s)', var_export($state, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Crap. This is monitoring module stuff.
|
|
||||||
*/
|
|
||||||
public static function getServiceStateName($state)
|
|
||||||
{
|
|
||||||
if ($state === null) { $state = 3; } // really?
|
|
||||||
$states = array(
|
|
||||||
0 => 'OK',
|
|
||||||
1 => 'WARNING',
|
|
||||||
2 => 'CRITICAL',
|
|
||||||
3 => 'UNKNOWN',
|
|
||||||
4 => 'PENDING', // fake
|
|
||||||
99 => 'PENDING' // fake
|
|
||||||
);
|
|
||||||
if (isset($states[$state])) {
|
|
||||||
return $states[$state];
|
|
||||||
}
|
|
||||||
return sprintf('OUT OF BOUND (%d)' . $state, (int) $state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?= $this->form ?>
|
<?= $this->form ?>
|
||||||
<div class="footer">Icinga Web 2 © 2013-2014<br><a href="https://www.icinga.org">The Icinga Project</a></div>
|
<div class="footer">Icinga Web 2 © 2013-2014<br><a href="https://www.icinga.org">The Icinga Project</a></div>
|
||||||
<?php if ($configMissing): ?>
|
<?php if ($requiresSetup): ?>
|
||||||
<div class="config-note"><?= sprintf(
|
<div class="config-note"><?= sprintf(
|
||||||
t(
|
t(
|
||||||
'You seem not to have Icinga Web 2 configured yet so it\'s not possible to log in without any defined '
|
'It appears that you did not configure Icinga Web 2 yet so it\'s not possible to log in without any defined '
|
||||||
. 'authentication method. Please define a authentication method by following the instructions in the'
|
. 'authentication method. Please define a authentication method by following the instructions in the'
|
||||||
. ' %1$sdocumentation%3$s or by using our %2$sweb-based setup-wizard%3$s.'
|
. ' %1$sdocumentation%3$s or by using our %2$sweb-based setup-wizard%3$s.'
|
||||||
),
|
),
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
// TODO(el): $role->without(...) or $role->shift(...) would be nice!
|
// TODO(el): $role->without(...) or $role->shift(...) would be nice!
|
||||||
$restrictions = $role;
|
$restrictions = clone $role;
|
||||||
unset($restrictions['users']);
|
unset($restrictions['users']);
|
||||||
unset($restrictions['groups']);
|
unset($restrictions['groups']);
|
||||||
unset($restrictions['permissions']);
|
unset($restrictions['permissions']);
|
||||||
|
@ -2,21 +2,23 @@
|
|||||||
|
|
||||||
**Choosing the Authentication Method**
|
**Choosing the Authentication Method**
|
||||||
|
|
||||||
With Icinga Web 2 you can authenticate against Active Directory, LDAP, a MySQL or PostgreSQL database or delegate
|
With Icinga Web 2 you can authenticate against Active Directory, LDAP, a MySQL or a PostgreSQL database or delegate
|
||||||
authentication to the web server. Authentication methods can be chained to set up fallback authentication methods
|
authentication to the web server.
|
||||||
|
|
||||||
|
Authentication methods can be chained to set up fallback authentication methods
|
||||||
or if users are spread over multiple places.
|
or if users are spread over multiple places.
|
||||||
|
|
||||||
## Configuration
|
## <a id="authentication-configuration"></a> Configuration
|
||||||
|
|
||||||
Authentication methods are configured in the INI file **config/authentication.ini**.
|
Authentication methods are configured in the INI file **config/authentication.ini**.
|
||||||
|
|
||||||
Each section in the authentication configuration represents a single authentication method.
|
Each section in the authentication configuration represents a single authentication method.
|
||||||
|
|
||||||
The order of entries in the authentication configuration determines the order of the authentication methods.
|
The order of entries in the authentication configuration determines the order of the authentication methods.
|
||||||
If the current authentication method errors or the current authentication method does not know the account being
|
If the current authentication method errors or if the current authentication method does not know the account being
|
||||||
authenticated, the next authentication method will be used.
|
authenticated, the next authentication method will be used.
|
||||||
|
|
||||||
## External Authentication
|
### <a id="authentication-configuration-external-authentication"></a> External Authentication
|
||||||
|
|
||||||
For delegating authentication to the web server simply add `autologin` to your authentication configuration:
|
For delegating authentication to the web server simply add `autologin` to your authentication configuration:
|
||||||
|
|
||||||
@ -27,13 +29,13 @@ backend = autologin
|
|||||||
|
|
||||||
If your web server is not configured for authentication though the `autologin` section has no effect.
|
If your web server is not configured for authentication though the `autologin` section has no effect.
|
||||||
|
|
||||||
## Active Directory or LDAP Authentication
|
### <a id="authentication-configuration-ad-or-ldap-authentication"></a> Active Directory or LDAP Authentication
|
||||||
|
|
||||||
If you want to authenticate against Active Directory or LDAP, you have to define a
|
If you want to authenticate against Active Directory or LDAP, you have to define a
|
||||||
[LDAP resource](#resources-configuration-ldap) first which will be referenced as data source for the Active Directory
|
[LDAP resource](#resources-configuration-ldap) which will be referenced as data source for the Active Directory
|
||||||
or LDAP configuration method.
|
or LDAP configuration method.
|
||||||
|
|
||||||
### LDAP
|
#### <a id="authentication-configuration-ldap-authentication"></a> LDAP
|
||||||
|
|
||||||
Directive | Description
|
Directive | Description
|
||||||
------------------------|------------
|
------------------------|------------
|
||||||
@ -52,7 +54,7 @@ user_class = inetOrgPerson
|
|||||||
user_name_attribute = uid
|
user_name_attribute = uid
|
||||||
```
|
```
|
||||||
|
|
||||||
### Active Directory
|
#### <a id="authentication-configuration-ad-authentication"></a> Active Directory
|
||||||
|
|
||||||
Directive | Description
|
Directive | Description
|
||||||
------------------------|------------
|
------------------------|------------
|
||||||
@ -67,10 +69,10 @@ backend = ad
|
|||||||
resource = my_ad
|
resource = my_ad
|
||||||
```
|
```
|
||||||
|
|
||||||
## Database Authentication
|
### <a id="authentication-configuration-db-authentication"></a> Database Authentication
|
||||||
|
|
||||||
If you want to authenticate against a MySQL or PostgreSQL database, you have to define a
|
If you want to authenticate against a MySQL or a PostgreSQL database, you have to define a
|
||||||
[database resource](#resources-configuration-database) first which will be referenced as data source for the database
|
[database resource](#resources-configuration-database) which will be referenced as data source for the database
|
||||||
authentication method.
|
authentication method.
|
||||||
|
|
||||||
Directive | Description
|
Directive | Description
|
||||||
@ -83,13 +85,31 @@ Directive | Description
|
|||||||
```
|
```
|
||||||
[auth_ad]
|
[auth_ad]
|
||||||
backend = ad
|
backend = ad
|
||||||
resource = my_db
|
resource = icingaweb-mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### <a id="authentication-configuration-db-setup"></a> Database Setup
|
||||||
|
|
||||||
|
For authenticating against a database, you have to import one of the following database schemas:
|
||||||
|
|
||||||
|
* **etc/schema/preferences.mysql.sql** (for **MySQL** database)
|
||||||
|
* **etc/schema/preferences.pgsql.sql** (for **PostgreSQL** databases)
|
||||||
|
|
||||||
|
After that you have to define the [database resource](#resources-configuration-database).
|
||||||
|
|
||||||
**Manually Creating Users**
|
**Manually Creating Users**
|
||||||
|
|
||||||
|
Icinga Web 2 uses the MD5 based BSD password algorithm. For generating a password hash, please use the following
|
||||||
|
command:
|
||||||
|
|
||||||
````
|
````
|
||||||
openssl passwd -1 "password"
|
openssl passwd -1 "password"
|
||||||
|
````
|
||||||
|
|
||||||
|
> Note: The switch to `openssl passwd` is the **number one** (`-1`) for using the MD5 based BSD password algorithm.
|
||||||
|
|
||||||
|
Insert the user into the database using the generated password hash:
|
||||||
|
|
||||||
|
````
|
||||||
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, 'hash from openssl');
|
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, 'hash from openssl');
|
||||||
````
|
````
|
||||||
|
@ -26,7 +26,7 @@ repository either via git or http protocol using the following URLs:
|
|||||||
* http://git.icinga.org/icingaweb2.git
|
* http://git.icinga.org/icingaweb2.git
|
||||||
|
|
||||||
There is also a browsable version available at
|
There is also a browsable version available at
|
||||||
[gi.icinga.org](https://git.icinga.org/?p=icingaweb2.git;a=summary "Icinga Web 2 Git Repository").
|
[git.icinga.org](https://git.icinga.org/?p=icingaweb2.git;a=summary "Icinga Web 2 Git Repository").
|
||||||
This version also offers snapshots for easy download which you can use if you do not have git present on your system.
|
This version also offers snapshots for easy download which you can use if you do not have git present on your system.
|
||||||
|
|
||||||
````
|
````
|
||||||
|
@ -1,101 +1,53 @@
|
|||||||
# Preferences
|
# <a id="preferences"></a> Preferences
|
||||||
|
|
||||||
Preferences are user based configuration for Icinga Web 2. For example max page
|
Preferences are settings a user can set for his account only, for example his language and time zone.
|
||||||
items, languages or date time settings can controlled by users.
|
|
||||||
|
|
||||||
# Architecture
|
**Choosing Where to Store Preferences**
|
||||||
|
|
||||||
Preferences are initially loaded from a provider (ini files or database) and
|
Preferences can be stored either in INI files or in a MySQL or in a PostgreSQL database. By default, Icinga Web 2 stores
|
||||||
stored into session at login time. After this step preferences are only
|
preferences in INI files beneath Icinga Web 2's configuration directory.
|
||||||
persisted to the configured backend, but never reloaded from them.
|
|
||||||
|
|
||||||
# Configuration
|
## <a id="preferences-configuration"></a> Configuration
|
||||||
|
|
||||||
Preferences can be configured in config.ini in **preferences** section, default
|
Where to store preferences is defined in the INI file **config/config.ini** in the *preferences* section.
|
||||||
settings are this:
|
|
||||||
|
|
||||||
[preferences]
|
### <a id="preferences-configuration-ini"></a> Store Preferences in INI Files
|
||||||
type=ini
|
|
||||||
|
|
||||||
The ini provider uses the directory **config/preferences** to create one ini
|
If preferences are stored in INI Files, Icinga Web 2 automatically creates one file per user using the username as
|
||||||
file per user and persists the data into a single file. If you want to drop your
|
file name for storing preferences. A INI file is created once a user saves changed preferences the first time.
|
||||||
preferences just drop the file from disk and you'll start with a new profile.
|
The files are located beneath the `preferences` directory beneath Icinga Web 2's configuration directory.
|
||||||
|
|
||||||
## Database Provider
|
For storing preferences in INI files you have to add the following section to the INI file **config/config.ini**:
|
||||||
|
|
||||||
To be more flexible in distributed setups you can store preferences in a
|
```
|
||||||
database (pgsql or mysql), a typical configuration looks like the following
|
[preferences]
|
||||||
example:
|
type = ini
|
||||||
|
````
|
||||||
|
|
||||||
[preferences]
|
### <a id="preferences-configuration-db"></a> Store Preferences in a Database
|
||||||
type=db
|
|
||||||
resource=icingaweb-pgsql
|
|
||||||
|
|
||||||
## Null Provider
|
In order to be more flexible in distributed setups you can store preferences in a MySQL or in a PostgreSQL database.
|
||||||
|
For storing preferences in a database, you have to define a [database resource](#resources-configuration-database)
|
||||||
|
which will be referenced as resource for the preferences storage.
|
||||||
|
|
||||||
The Null Provider discards all preferences and is mainly used as a fallback when no provider could be
|
Directive | Description
|
||||||
created (due to permission errors, database outtakes, etc.).
|
------------------------|------------
|
||||||
|
**type** | `db`
|
||||||
|
**resource** | The name of the database resource defined in [resources.ini](resources).
|
||||||
|
|
||||||
[preferences]
|
**Example:**
|
||||||
type=null
|
|
||||||
|
|
||||||
If your preferences aren't stored it's best to take a look into the logfiles - errors during the preference setup
|
```
|
||||||
are displayed as warnings here.
|
[preferences]
|
||||||
|
type = db
|
||||||
|
resource = icingaweb-mysql
|
||||||
|
```
|
||||||
|
|
||||||
### Settings
|
#### <a id="preferences-configuration-db-setup"></a> Database Setup
|
||||||
|
|
||||||
* **resource**: A reference to a database declared in *resources.ini*. Please read the chapter about
|
For storing preferences in a database, you have to import one of the following database schemas:
|
||||||
resources for a detailed description about how to set up resources.
|
|
||||||
|
|
||||||
### Preparation
|
* **etc/schema/preferences.mysql.sql** (for **MySQL** database)
|
||||||
|
* **etc/schema/preferences.pgsql.sql** (for **PostgreSQL** databases)
|
||||||
|
|
||||||
To use this feature you need a running database environment. After creating a
|
After that you have to define the [database resource](#resources-configuration-database).
|
||||||
database and a writable user you need to import the initial table file:
|
|
||||||
|
|
||||||
* etc/schema/preferences.mysql.sql (for mysql database)
|
|
||||||
* etc/schema/preferemces.pgsql.sql (for postgres databases)
|
|
||||||
|
|
||||||
#### Example for mysql
|
|
||||||
|
|
||||||
# mysql -u root -p
|
|
||||||
mysql> create database icingaweb;
|
|
||||||
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON icingaweb.* TO \
|
|
||||||
'icingaweb'@'localhost' IDENTIFIED BY 'icingaweb';
|
|
||||||
mysql> exit
|
|
||||||
# mysql -u root -p icingaweb < /path/to/icingaweb/etc/schema/preferences.mysql.sql
|
|
||||||
|
|
||||||
After following these steps above you can configure your preferences provider.
|
|
||||||
|
|
||||||
## Coding API
|
|
||||||
|
|
||||||
You can set, update or remove preferences using the Preference data object
|
|
||||||
which is bound to the user. Here are some simple examples how to work with
|
|
||||||
that:
|
|
||||||
|
|
||||||
$preferences = $user->getPreferences();
|
|
||||||
// Get language with en_US as fallback
|
|
||||||
$preferences->get('app.language', 'en_US');
|
|
||||||
$preferences->set('app.language', 'de_DE');
|
|
||||||
$preferences->remove('app.language');
|
|
||||||
|
|
||||||
// Using transactional mode
|
|
||||||
$preferences->startTransaction();
|
|
||||||
$preferences->set('test.pref1', 'pref1');
|
|
||||||
$preferences->set('test.pref2', 'pref2');
|
|
||||||
$preferences->remove('test.pref3');
|
|
||||||
$preferemces->commit(); // Stores 3 changes in one operation
|
|
||||||
|
|
||||||
More information can be found in the api docs.
|
|
||||||
|
|
||||||
## Namespaces and behaviour
|
|
||||||
|
|
||||||
If you are using this API please obey the following rules:
|
|
||||||
|
|
||||||
* Use dotted notation for preferences
|
|
||||||
* Namespaces starting with one context identifier
|
|
||||||
* **app** as global identified (e.g. app.language)
|
|
||||||
* **mymodule** for your module
|
|
||||||
* **monitoring** for the monitoring module
|
|
||||||
* Use preferences wisely (set only when needed and write small settings)
|
|
||||||
* Use only simple data types, e.g. strings or numbers
|
|
||||||
* If you need complex types you have to do it your self (e.g. serialization)
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
Icinga Web 2
|
|
||||||
|
|
||||||
@link https://www.icinga.org/icingaweb2/
|
|
||||||
@copyright Copyright (c) 2013-%(YEAR)s Icinga Development Team (https://www.icinga.org)
|
|
||||||
@license http://www.gnu.org/licenses/gpl-2.0.txt, or any later version
|
|
398
icingaweb2.spec
398
icingaweb2.spec
@ -1,237 +1,235 @@
|
|||||||
#/**
|
|
||||||
# * This file is part of Icinga Web 2.
|
|
||||||
# *
|
|
||||||
# * Icinga Web 2 - Head for multiple monitoring backends.
|
|
||||||
# * Copyright (C) 2014 Icinga Development Team
|
|
||||||
# *
|
|
||||||
# * This program is free software; you can redistribute it and/or
|
|
||||||
# * modify it under the terms of the GNU General Public License
|
|
||||||
# * as published by the Free Software Foundation; either version 2
|
|
||||||
# * of the License, or (at your option) any later version.
|
|
||||||
# *
|
|
||||||
# * This program is distributed in the hope that it will be useful,
|
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# * GNU General Public License for more details.
|
|
||||||
# *
|
|
||||||
# * You should have received a copy of the GNU General Public License
|
|
||||||
# * along with this program; if not, write to the Free Software
|
|
||||||
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
# *
|
|
||||||
# * @copyright 2014 Icinga Development Team <info@icinga.org>
|
|
||||||
# * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
||||||
# * @author Icinga Development Team <info@icinga.org>
|
|
||||||
# *
|
|
||||||
# */
|
|
||||||
|
|
||||||
%define revision 1
|
|
||||||
|
|
||||||
%define configdir %{_sysconfdir}/%{name}
|
|
||||||
%define sharedir %{_datadir}/%{name}
|
|
||||||
%define prefixdir %{_datadir}/%{name}
|
|
||||||
%define usermodparam -a -G
|
|
||||||
%define logdir %{_localstatedir}/log/%{name}
|
|
||||||
%define docdir %{sharedir}/doc
|
|
||||||
|
|
||||||
%if "%{_vendor}" == "suse"
|
|
||||||
%define phpname php5
|
|
||||||
%define phpzendname php5-ZendFramework
|
|
||||||
%define apache2modphpname apache2-mod_php5
|
|
||||||
%endif
|
|
||||||
# SLE 11 = 1110
|
|
||||||
%if 0%{?suse_version} == 1110
|
|
||||||
%define phpname php53
|
|
||||||
%define apache2modphpname apache2-mod_php53
|
|
||||||
%define usermodparam -A
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if "%{_vendor}" == "redhat"
|
|
||||||
%define phpname php
|
|
||||||
%define phpzendname php-ZendFramework
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# el5 requires newer php53 rather than php (5.1)
|
|
||||||
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
|
|
||||||
%define phpname php53
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if "%{_vendor}" == "suse"
|
|
||||||
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
|
|
||||||
%define apacheuser wwwrun
|
|
||||||
%define apachegroup www
|
|
||||||
%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
|
|
||||||
%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
|
|
||||||
%endif
|
|
||||||
%if "%{_vendor}" == "redhat"
|
|
||||||
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
|
|
||||||
%define apacheuser apache
|
|
||||||
%define apachegroup apache
|
|
||||||
%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
|
|
||||||
%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Summary: Open Source host, service and network monitoring Web UI
|
|
||||||
Name: icingaweb2
|
Name: icingaweb2
|
||||||
Version: 0.0.1
|
Version: 2.0.0
|
||||||
Release: %{revision}%{?dist}
|
Release: 1.beta2%{?dist}
|
||||||
License: GPLv2
|
Summary: Icinga Web 2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://www.icinga.org
|
License: GPL
|
||||||
|
URL: https://icinga.org
|
||||||
|
Source0: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
|
||||||
|
Packager: Icinga Team <info@icinga.org>
|
||||||
|
|
||||||
%if "%{_vendor}" == "suse"
|
%if 0%{?fedora} || 0%{?rhel}
|
||||||
AutoReqProv: Off
|
%define wwwconfigdir %{_sysconfdir}/httpd/conf.d
|
||||||
|
%define wwwuser apache
|
||||||
|
%if 0%{?rhel} == 5
|
||||||
|
%define php php53
|
||||||
|
%define php_cli php53-cli
|
||||||
|
%else
|
||||||
|
%define php php
|
||||||
|
%define php_cli php-cli
|
||||||
|
%endif
|
||||||
|
%if 0%{rhel} == 6
|
||||||
|
%define zend php-ZendFramework
|
||||||
|
%else
|
||||||
|
%define zend %{name}-vendor-Zend
|
||||||
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Source: icingaweb2-%{version}.tar.gz
|
Requires(pre): shadow-utils
|
||||||
|
Requires: %{name}-common = %{version}-%{release}
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
Requires: php-Icinga = %{version}-%{release}
|
||||||
|
Requires: %{name}-vendor-dompdf
|
||||||
BuildRequires: %{phpname} >= 5.3.0
|
Requires: %{name}-vendor-HTMLPurifier
|
||||||
BuildRequires: %{phpname}-devel >= 5.3.0
|
Requires: %{name}-vendor-JShrink
|
||||||
BuildRequires: %{phpname}-ldap
|
Requires: %{name}-vendor-lessphp
|
||||||
BuildRequires: %{phpname}-pdo
|
Requires: %{name}-vendor-Parsedown
|
||||||
BuildRequires: %{phpzendname}
|
Requires: %{zend}
|
||||||
%if "%{_vendor}" != "suse"
|
|
||||||
BuildRequires: %{phpzendname}-Db-Adapter-Pdo
|
|
||||||
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Mysql
|
|
||||||
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if "%{_vendor}" == "redhat"
|
|
||||||
%endif
|
|
||||||
%if "%{_vendor}" == "suse"
|
|
||||||
Requires: %{phpname}-devel >= 5.3.0
|
|
||||||
BuildRequires: %{phpname}-json
|
|
||||||
BuildRequires: %{phpname}-sockets
|
|
||||||
BuildRequires: %{phpname}-dom
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Requires: %{phpname} >= 5.3.0
|
|
||||||
Requires: %{phpzendname}
|
|
||||||
Requires: %{phpname}-ldap
|
|
||||||
Requires: %{phpname}-pdo
|
|
||||||
%if "%{_vendor}" == "redhat"
|
|
||||||
Requires: %{phpname}-common
|
|
||||||
Requires: %{phpzendname}-Db-Adapter-Pdo
|
|
||||||
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
|
|
||||||
Requires: php-pear
|
|
||||||
%endif
|
|
||||||
%if "%{_vendor}" == "suse"
|
|
||||||
Requires: %{phpname}-pear
|
|
||||||
Requires: %{phpname}-dom
|
|
||||||
Requires: %{phpname}-tokenizer
|
|
||||||
Requires: %{phpname}-gettext
|
|
||||||
Requires: %{phpname}-ctype
|
|
||||||
Requires: %{phpname}-json
|
|
||||||
Requires: %{apache2modphpname}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Requires: php-Icinga
|
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Icinga Web 2 for Icinga 2 or Icinga 1.x using multiple backends
|
Icinga Web 2
|
||||||
for example DB IDO.
|
|
||||||
|
|
||||||
|
%define basedir %{_datadir}/%{name}
|
||||||
|
%define bindir %{_bindir}
|
||||||
|
%define configdir %{_sysconfdir}/%{name}
|
||||||
|
%define logdir %{_localstatedir}/log/%{name}
|
||||||
|
%define phpdir %{_datadir}/php
|
||||||
|
%define icingawebgroup icingaweb2
|
||||||
|
|
||||||
|
|
||||||
|
%package common
|
||||||
|
Summary: Common files for Icinga Web 2 and the Icinga CLI
|
||||||
|
Group: Applications/System
|
||||||
|
|
||||||
|
%description common
|
||||||
|
Common files for Icinga Web 2 and the Icinga CLI
|
||||||
|
|
||||||
|
|
||||||
|
%package -n php-Icinga
|
||||||
|
Summary: Icinga Web 2 PHP library
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description -n php-Icinga
|
||||||
|
Icinga Web 2 PHP library
|
||||||
|
|
||||||
|
|
||||||
%package -n icingacli
|
%package -n icingacli
|
||||||
Summary: Icinga CLI
|
Summary: Icinga CLI
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name}-common = %{version}-%{release}
|
||||||
Requires: php-Icinga
|
Requires: php-Icinga = %{version}-%{release}
|
||||||
|
Requires: %{php_cli} >= 5.3.0
|
||||||
|
|
||||||
%description -n icingacli
|
%description -n icingacli
|
||||||
Icinga CLI using php-Icinga Icinga Web 2 backend.
|
Icinga CLI
|
||||||
|
|
||||||
%package -n php-Icinga
|
|
||||||
Summary: Icinga Web 2 PHP Libraries
|
|
||||||
Group: Applications/System
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
Requires: %{phpname} >= 5.3.0
|
|
||||||
Requires: %{phpzendname}
|
|
||||||
|
|
||||||
|
|
||||||
%description -n php-Icinga
|
%package vendor-dompdf
|
||||||
Icinga Web 2 PHP Libraries required by the web frontend and cli tool.
|
Version: 0.6.1
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library dompdf
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-dompdf
|
||||||
|
Icinga Web 2 vendor library dompdf
|
||||||
|
|
||||||
|
|
||||||
|
%package vendor-HTMLPurifier
|
||||||
|
Version: 4.6.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library HTMLPurifier
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-HTMLPurifier
|
||||||
|
Icinga Web 2 vendor library HTMLPurifier
|
||||||
|
|
||||||
|
|
||||||
|
%package vendor-JShrink
|
||||||
|
Version: 1.0.1
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library JShrink
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-JShrink
|
||||||
|
Icinga Web 2 vendor library JShrink
|
||||||
|
|
||||||
|
|
||||||
|
%package vendor-lessphp
|
||||||
|
Version: 0.4.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library lessphp
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-lessphp
|
||||||
|
Icinga Web 2 vendor library lessphp
|
||||||
|
|
||||||
|
|
||||||
|
%package vendor-Parsedown
|
||||||
|
Version: 1.0.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library Parsedown
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-Parsedown
|
||||||
|
Icinga Web 2 vendor library Parsedown
|
||||||
|
|
||||||
|
|
||||||
|
%package vendor-Zend
|
||||||
|
Version: 1.12.9
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Icinga Web 2 vendor library Zend Framework
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{php} >= 5.3.0
|
||||||
|
|
||||||
|
%description vendor-Zend
|
||||||
|
Icinga Web 2 vendor library Zend
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
#VERSION=0.0.1; git archive --format=tar --prefix=icingaweb2-$VERSION/ HEAD | gzip >icingaweb2-$VERSION.tar.gz
|
%setup -q
|
||||||
%setup -q -n %{name}-%{version}
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir},%{logdir},%{phpdir},%{wwwconfigdir}}
|
||||||
# prepare configuration for sub packages
|
cp -prv application doc var %{buildroot}/%{basedir}
|
||||||
|
cp -prv modules/{monitoring,setup} %{buildroot}/%{basedir}/modules
|
||||||
# install rhel apache config
|
cp -prv library/Icinga %{buildroot}/%{phpdir}
|
||||||
install -D -m0644 packages/files/apache/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf
|
cp -prv library/vendor %{buildroot}/%{basedir}/library
|
||||||
|
cp -prv public/{css,img,js,error_norewrite.html} %{buildroot}/%{basedir}/public
|
||||||
# install public, library, modules
|
cp -pv packages/files/apache/icingaweb2.conf %{buildroot}/%{wwwconfigdir}/icingaweb2.conf
|
||||||
%{__mkdir} -p %{buildroot}/%{sharedir}
|
cp -pv packages/files/bin/icingacli %{buildroot}/%{bindir}
|
||||||
%{__mkdir} -p %{buildroot}/%{logdir}
|
cp -pv packages/files/public/index.php %{buildroot}/%{basedir}/public
|
||||||
%{__mkdir} -p %{buildroot}/%{docdir}
|
|
||||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
|
|
||||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/dashboard
|
|
||||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/modules
|
|
||||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/modules/monitoring
|
|
||||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/enabledModules
|
|
||||||
|
|
||||||
# make sure to install local icingacli for setup wizard token generation & webserver config
|
|
||||||
%{__cp} -r application doc library modules public bin %{buildroot}/%{sharedir}/
|
|
||||||
|
|
||||||
# enable the monitoring module by default
|
|
||||||
ln -s %{sharedir}/modules/monitoring %{buildroot}/%{_sysconfdir}/%{name}/enabledModules/monitoring
|
|
||||||
## config
|
|
||||||
|
|
||||||
# symlink icingacli
|
|
||||||
mkdir -p %{buildroot}/usr/bin
|
|
||||||
ln -sf %{sharedir}/bin/icingacli %{buildroot}/usr/bin/icingacli
|
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
# Add apacheuser in the icingacmd group
|
getent group icingacmd >/dev/null || groupadd -r icingacmd
|
||||||
# If the group exists, add the apacheuser in the icingacmd group.
|
usermod -a -G icingacmd,%{icingawebgroup} %{wwwuser}
|
||||||
# It is not neccessary that icinga2-web is installed on the same system as
|
exit 0
|
||||||
# icinga and only on systems with icinga installed the icingacmd
|
|
||||||
# group exists. In all other cases the user used for ssh access has
|
|
||||||
# to be added to the icingacmd group on the remote icinga server.
|
|
||||||
getent group icingacmd > /dev/null
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
%{_sbindir}/usermod %{usermodparam} icingacmd %{apacheuser}
|
|
||||||
fi
|
|
||||||
|
|
||||||
%preun
|
|
||||||
|
|
||||||
%post
|
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%files
|
%files
|
||||||
# main dirs
|
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc etc/schema doc packages/RPM.md
|
%{basedir}/application/controllers
|
||||||
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/public
|
%{basedir}/application/fonts
|
||||||
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/modules
|
%{basedir}/application/forms
|
||||||
# configs
|
%{basedir}/application/layouts
|
||||||
|
%{basedir}/application/views
|
||||||
|
%{basedir}/doc
|
||||||
|
%{basedir}/modules
|
||||||
|
%{basedir}/public
|
||||||
|
%{wwwconfigdir}/icingaweb2.conf
|
||||||
|
%attr(2775,root,%{icingawebgroup}) %dir %{logdir}
|
||||||
|
|
||||||
|
|
||||||
|
%pre common
|
||||||
|
getent group %{icingawebgroup} >/dev/null || groupadd -r %{icingawebgroup}
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
%files common
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
|
%{basedir}/application/locale
|
||||||
%config(noreplace) %attr(-,%{apacheuser},%{apachegroup}) %{configdir}
|
%dir %{basedir}/modules
|
||||||
# logs
|
%attr(2770,root,%{icingawebgroup}) %config(noreplace) %{configdir}
|
||||||
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
|
|
||||||
# shipped docs
|
|
||||||
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/doc
|
|
||||||
|
|
||||||
%files -n php-Icinga
|
%files -n php-Icinga
|
||||||
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/application
|
%defattr(-,root,root)
|
||||||
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/library
|
%{phpdir}/Icinga
|
||||||
|
|
||||||
|
|
||||||
%files -n icingacli
|
%files -n icingacli
|
||||||
%attr(0755,root,root) /usr/bin/icingacli
|
%defattr(-,root,root)
|
||||||
%attr(0755,root,root) %{sharedir}/bin/icingacli
|
%{basedir}/application/clicommands
|
||||||
%attr(0755,root,root) %{sharedir}/bin/license_writer.py
|
%attr(0755,root,root) %{bindir}/icingacli
|
||||||
|
|
||||||
%changelog
|
|
||||||
|
%files vendor-dompdf
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/dompdf
|
||||||
|
|
||||||
|
|
||||||
|
%files vendor-HTMLPurifier
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/HTMLPurifier
|
||||||
|
|
||||||
|
|
||||||
|
%files vendor-JShrink
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/JShrink
|
||||||
|
|
||||||
|
|
||||||
|
%files vendor-lessphp
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/lessphp
|
||||||
|
|
||||||
|
|
||||||
|
%files vendor-Parsedown
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/Parsedown
|
||||||
|
|
||||||
|
|
||||||
|
%files vendor-Zend
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{basedir}/library/vendor/Zend
|
||||||
|
@ -113,6 +113,13 @@ abstract class ApplicationBootstrap
|
|||||||
*/
|
*/
|
||||||
protected $isWeb = false;
|
protected $isWeb = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether Icinga Web 2 requires setup
|
||||||
|
*
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $requiresSetup = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -133,7 +140,7 @@ abstract class ApplicationBootstrap
|
|||||||
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
|
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
|
||||||
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
|
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
|
||||||
} else {
|
} else {
|
||||||
$configDir = '/etc/icingaweb';
|
$configDir = '/etc/icingaweb2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$canonical = realpath($configDir);
|
$canonical = realpath($configDir);
|
||||||
@ -333,7 +340,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Setup Icinga auto loader
|
* Setup Icinga auto loader
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setupAutoloader()
|
public function setupAutoloader()
|
||||||
{
|
{
|
||||||
@ -366,7 +373,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Setup module manager
|
* Setup module manager
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setupModuleManager()
|
protected function setupModuleManager()
|
||||||
{
|
{
|
||||||
@ -378,25 +385,10 @@ abstract class ApplicationBootstrap
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load all core modules
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
protected function loadCoreModules()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$this->moduleManager->loadCoreModules();
|
|
||||||
} catch (NotReadableError $e) {
|
|
||||||
Logger::error(new IcingaException('Cannot load core modules. An exception was thrown:', $e));
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all enabled modules
|
* Load all enabled modules
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function loadEnabledModules()
|
protected function loadEnabledModules()
|
||||||
{
|
{
|
||||||
@ -408,10 +400,44 @@ abstract class ApplicationBootstrap
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the setup module if Icinga Web 2 requires setup
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function loadSetupModuleIfNecessary()
|
||||||
|
{
|
||||||
|
if (! @file_exists($this->config->resolvePath('config.ini'))) {
|
||||||
|
$this->requiresSetup = true;
|
||||||
|
$this->moduleManager->loadModule('setup');
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether Icinga Web 2 requires setup
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function requiresSetup()
|
||||||
|
{
|
||||||
|
return $this->requiresSetup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the setup token exists
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setupTokenExists()
|
||||||
|
{
|
||||||
|
return @file_exists($this->config->resolvePath('setup.token'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup default logging
|
* Setup default logging
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setupLogging()
|
protected function setupLogging()
|
||||||
{
|
{
|
||||||
@ -428,7 +454,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Load Configuration
|
* Load Configuration
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function loadConfig()
|
protected function loadConfig()
|
||||||
{
|
{
|
||||||
@ -447,7 +473,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Error handling configuration
|
* Error handling configuration
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setupErrorHandling()
|
protected function setupErrorHandling()
|
||||||
{
|
{
|
||||||
@ -473,7 +499,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Set up logger
|
* Set up logger
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setupLogger()
|
protected function setupLogger()
|
||||||
{
|
{
|
||||||
@ -490,7 +516,7 @@ abstract class ApplicationBootstrap
|
|||||||
/**
|
/**
|
||||||
* Set up the resource factory
|
* Set up the resource factory
|
||||||
*
|
*
|
||||||
* @return self
|
* @return $this
|
||||||
*/
|
*/
|
||||||
protected function setupResourceFactory()
|
protected function setupResourceFactory()
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ class Cli extends ApplicationBootstrap
|
|||||||
->setupLogger()
|
->setupLogger()
|
||||||
->setupResourceFactory()
|
->setupResourceFactory()
|
||||||
->setupModuleManager()
|
->setupModuleManager()
|
||||||
->loadCoreModules();
|
->loadSetupModuleIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setupLogging()
|
protected function setupLogging()
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user