mirror of https://github.com/Icinga/icinga2.git
Refactor Puppet modules.
This commit is contained in:
parent
6922c4f58e
commit
64a0e9d3fc
|
@ -1,10 +1,8 @@
|
|||
______ ___
|
||||
/\__ _\ __ /'___`\
|
||||
\/_/\ \/ ___ /\_\ ___ __ __ /\_\ /\ \
|
||||
\ \ \ /'___\/\ \ /' _ `\ /'_ `\ /'__`\ \/_/// /__
|
||||
\_\ \__/\ \__/\ \ \/\ \/\ \/\ \L\ \/\ \L\.\_ // /_\ \
|
||||
/\_____\ \____\\ \_\ \_\ \_\ \____ \ \__/.\_\ /\______/
|
||||
\/_____/\/____/ \/_/\/_/\/_/\/___L\ \/__/\/_/ \/_____/
|
||||
/\____/
|
||||
\_/__/
|
||||
|
||||
_____ _ ___
|
||||
|_ _| (_) |__ \
|
||||
| | ___ _ _ __ __ _ __ _ ) |
|
||||
| | / __| | '_ \ / _` |/ _` | / /
|
||||
_| || (__| | | | | (_| | (_| | / /_
|
||||
|_____\___|_|_| |_|\__, |\__,_| |____|
|
||||
__/ |
|
||||
|___/
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.4.5 (GNU/Linux)
|
||||
|
||||
mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1
|
||||
JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B
|
||||
M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn
|
||||
XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6
|
||||
pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngUXGXW7Qzoefe+fV
|
||||
QqJSm7Tq2q9oqVZ46J964waCRItRySpuW5dxZO34WM6wsw2BP2MlACbH4l3luqtp
|
||||
Xo3Bvfnk+HAFH3HcMuwdaulxv7zYKXCfNoSfgrpEfo2Ex4Im/I3WdtwME/Gbnwdq
|
||||
3VJzgAxLVFhczDHwNkjmIdPAlNJ9/ixRjip4dgZtW8VcBCrNoL+LhDrIfjvnLdRu
|
||||
vBHy9P3sCF7FZycaHlMWP6RiLtHnEMGcbZ8QpQHi2dReU1wyr9QgguGU+jqSXYar
|
||||
1yEcsdRGasppNIZ8+Qawbm/a4doT10TEtPArhSoHlwbvqTDYjtfV92lC/2iwgO6g
|
||||
YgG9XrO4V8dV39Ffm7oLFfvTbg5mv4Q/E6AWo/gkjmtxkculbyAvjFtYAQARAQAB
|
||||
tCFFUEVMICg2KSA8ZXBlbEBmZWRvcmFwcm9qZWN0Lm9yZz6JAjYEEwECACAFAkvS
|
||||
KUICGw8GCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRA7Sd8qBgi4lR/GD/wLGPv9
|
||||
qO39eyb9NlrwfKdUEo1tHxKdrhNz+XYrO4yVDTBZRPSuvL2yaoeSIhQOKhNPfEgT
|
||||
9mdsbsgcfmoHxmGVcn+lbheWsSvcgrXuz0gLt8TGGKGGROAoLXpuUsb1HNtKEOwP
|
||||
Q4z1uQ2nOz5hLRyDOV0I2LwYV8BjGIjBKUMFEUxFTsL7XOZkrAg/WbTH2PW3hrfS
|
||||
WtcRA7EYonI3B80d39ffws7SmyKbS5PmZjqOPuTvV2F0tMhKIhncBwoojWZPExft
|
||||
HpKhzKVh8fdDO/3P1y1Fk3Cin8UbCO9MWMFNR27fVzCANlEPljsHA+3Ez4F7uboF
|
||||
p0OOEov4Yyi4BEbgqZnthTG4ub9nyiupIZ3ckPHr3nVcDUGcL6lQD/nkmNVIeLYP
|
||||
x1uHPOSlWfuojAYgzRH6LL7Idg4FHHBA0to7FW8dQXFIOyNiJFAOT2j8P5+tVdq8
|
||||
wB0PDSH8yRpn4HdJ9RYquau4OkjluxOWf0uRaS//SUcCZh+1/KBEOmcvBHYRZA5J
|
||||
l/nakCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG
|
||||
iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR
|
||||
XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ==
|
||||
=V/6I
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
|
@ -1 +0,0 @@
|
|||
export PATH="$PATH:/usr/local/bin"
|
|
@ -3,99 +3,10 @@ include mysql
|
|||
# enable when icinga2-ido-pgsql is ready
|
||||
#include pgsql
|
||||
include epel
|
||||
include icinga-rpm-snapshot
|
||||
|
||||
Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' }
|
||||
|
||||
exec { 'create-mysql-icinga2-ido-db':
|
||||
unless => 'mysql -uicinga -picinga icinga',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
||||
GRANT ALL ON icinga.* TO icinga@localhost \
|
||||
IDENTIFIED BY \'icinga\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
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']
|
||||
}
|
||||
|
||||
# enable when icinga2-ido-pgsql is ready
|
||||
#exec { 'create-pgsql-icinga2-ido-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 \'icinga\';" && \
|
||||
# sudo -u postgres createdb -O icinga -E UTF8 icinga && \
|
||||
# sudo -u postgres createlang plpgsql icinga',
|
||||
# require => Service['postgresql']
|
||||
#}
|
||||
|
||||
php::extension { ['php-mysql']:
|
||||
require => [ Class['mysql'] ]
|
||||
}
|
||||
|
||||
# enable when icinga2-ido-pgsql is ready
|
||||
#php::extension { ['php-pgsql']:
|
||||
# require => [ Class['pgsql'] ]
|
||||
#}
|
||||
|
||||
# runtime users
|
||||
group { 'icinga-cmd':
|
||||
ensure => present
|
||||
}
|
||||
|
||||
user { 'icinga':
|
||||
ensure => present,
|
||||
groups => 'icinga-cmd',
|
||||
managehome => false
|
||||
}
|
||||
|
||||
user { 'apache':
|
||||
groups => ['icinga-cmd', 'vagrant'],
|
||||
require => [ Class['apache'], Group['icinga-cmd'] ]
|
||||
}
|
||||
|
||||
file { '/etc/profile.d/env.sh':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh'
|
||||
}
|
||||
|
||||
# nagios plugins from epel
|
||||
package { 'nagios-plugins-all':
|
||||
ensure => installed,
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
# these package require the icinga-rpm-snapshot repository installed
|
||||
$icinga2_main_packages = [ 'icinga2', 'icinga2-doc', 'icinga2-ido-mysql', 'icinga-gui' ]
|
||||
|
||||
# workaround for package conflicts
|
||||
# icinga-gui pulls icinga-gui-config automatically
|
||||
package { 'icinga2-classicui-config':
|
||||
ensure => installed,
|
||||
before => Package["icinga-gui"],
|
||||
require => Class['icinga-rpm-snapshot']
|
||||
}
|
||||
|
||||
package { $icinga2_main_packages:
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
|
||||
package { 'icinga-web':
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
# enable http 80
|
||||
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 => 'lokkit --enabled --service=http'
|
||||
}
|
||||
include icinga-classicui
|
||||
include icinga2
|
||||
include icinga-web
|
||||
include nagios-plugins
|
||||
|
||||
# icinga 2 docs at /icinga2-doc
|
||||
file { '/etc/httpd/conf.d/icinga2-doc.conf':
|
||||
|
@ -104,61 +15,8 @@ file { '/etc/httpd/conf.d/icinga2-doc.conf':
|
|||
notify => Service['apache']
|
||||
}
|
||||
|
||||
# users
|
||||
file { '/etc/motd':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd',
|
||||
owner => root,
|
||||
group => root
|
||||
}
|
||||
|
||||
user { 'vagrant':
|
||||
groups => 'icinga-cmd',
|
||||
require => Group['icinga-cmd']
|
||||
}
|
||||
|
||||
# icinga2 service & features
|
||||
service { 'icinga2':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
hasrestart => true,
|
||||
require => Package['icinga2']
|
||||
}
|
||||
|
||||
# icinga 2 IDO config
|
||||
file { '/etc/icinga2/features-available/ido-mysql.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf',
|
||||
require => Package['icinga2'],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
exec { 'Enable Icinga 2 features':
|
||||
command => 'i2enfeature statusdat; \
|
||||
i2enfeature compat-log; \
|
||||
i2enfeature command; \
|
||||
i2enfeature ido-mysql;',
|
||||
require => [ Package['icinga2'], Exec['populate-icinga2-ido-mysql-db'] ]
|
||||
}
|
||||
|
||||
file { "/etc/icinga2/features-enabled/*":
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
# populate icinga2-ido-mysql db
|
||||
exec { 'populate-icinga2-ido-mysql-db':
|
||||
unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
|
||||
command => 'mysql -uicinga -picinga icinga < /usr/share/doc/icinga2-ido-mysql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/mysql.sql',
|
||||
require => [ Package['icinga2-ido-mysql'], Exec['create-mysql-icinga2-ido-db'] ]
|
||||
}
|
||||
|
||||
#exec { 'populate-icinga2-ido-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/share/doc/icinga2-ido-pgsql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/pgsql.sql',
|
||||
# require => [ Package['icinga2-ido-pgsql'], Exec['create-pgsql-icinga2-ido-db'] ]
|
||||
#}
|
||||
|
||||
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/share/icinga-web/etc/schema/mysql.sql',
|
||||
require => [ Package['icinga-web'], Exec['create-mysql-icinga-web-db'] ]
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# include apache
|
||||
#
|
||||
class apache {
|
||||
|
||||
$apache = $::operatingsystem ? {
|
||||
/(Debian|Ubuntu)/ => 'apache2',
|
||||
/(RedHat|CentOS|Fedora)/ => 'httpd'
|
||||
|
@ -24,10 +23,16 @@ class apache {
|
|||
alias => 'apache'
|
||||
}
|
||||
|
||||
exec { 'iptables-allow-http':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
command => 'lokkit --enabled --service=http'
|
||||
}
|
||||
|
||||
service { $apache:
|
||||
enable => true,
|
||||
ensure => running,
|
||||
alias => 'apache',
|
||||
require => Package['apache']
|
||||
require => [ Package['apache'], Exec['iptables-allow-http'] ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,79 +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
|
||||
) {
|
||||
|
||||
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 => "sh ./configure ${flags}",
|
||||
creates => "${src}/Makefile",
|
||||
require => Exec["extract-${name}"]
|
||||
}
|
||||
|
||||
exec { "make-${name}":
|
||||
cwd => $src,
|
||||
command => $make,
|
||||
creates => $creates,
|
||||
require => Exec["configure-${name}"],
|
||||
timeout => $make_timeout
|
||||
}
|
||||
}
|
|
@ -13,12 +13,25 @@
|
|||
# include epel
|
||||
#
|
||||
class epel {
|
||||
|
||||
yumrepo { 'epel':
|
||||
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}",
|
||||
enabled => '1',
|
||||
gpgcheck => '0',
|
||||
gpgcheck => '1',
|
||||
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6',
|
||||
descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}"
|
||||
}
|
||||
|
||||
file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6":
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
source => "puppet:////vagrant/.vagrant-puppet/files/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6"
|
||||
}
|
||||
|
||||
epel::key { "RPM-GPG-KEY-EPEL-6":
|
||||
path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
|
||||
before => Yumrepo['icinga-rpm-snapshot']
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
# inspired by https://github.com/stahnma/puppet-module-epel/blob/master/manifests/rpm_gpg_key.pp
|
||||
|
||||
define epel::key($path) {
|
||||
exec { "import-key-${name}":
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
command => "rpm --import ${path}",
|
||||
unless => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < ${path}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')",
|
||||
require => File[$path],
|
||||
logoutput => 'on_failure'
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
class icinga-classicui {
|
||||
include icinga-rpm-snapshot
|
||||
|
||||
# workaround for package conflicts
|
||||
# icinga-gui pulls icinga-gui-config automatically
|
||||
package { 'icinga2-classicui-config':
|
||||
ensure => installed,
|
||||
before => Package["icinga-gui"],
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
package { 'icinga-gui':
|
||||
ensure => installed,
|
||||
alias => 'icinga-gui'
|
||||
}
|
||||
|
||||
# runtime users
|
||||
group { 'icingacmd':
|
||||
ensure => present
|
||||
}
|
||||
|
||||
user { 'icinga':
|
||||
ensure => present,
|
||||
groups => 'icingacmd',
|
||||
managehome => false
|
||||
}
|
||||
|
||||
user { 'apache':
|
||||
groups => ['icingacmd', 'vagrant'],
|
||||
require => [ Class['apache'], Group['icingacmd'] ]
|
||||
}
|
||||
|
||||
exec { 'enable-icinga2-features':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
command => 'i2enfeature statusdat; \
|
||||
i2enfeature compat-log; \
|
||||
i2enfeature command;',
|
||||
require => [ Package['icinga2'] ]
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@
|
|||
# include icinga-rpm-snapshot
|
||||
#
|
||||
class icinga-rpm-snapshot {
|
||||
|
||||
yumrepo { 'icinga-rpm-snapshot':
|
||||
mirrorlist => "http://packages.icinga.org/epel/6/snapshot/ICINGA-snapshot.repo",
|
||||
# baseurl is required, otherwise mirrorlist errors by yum
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
class icinga-web {
|
||||
include icinga-rpm-snapshot
|
||||
|
||||
php::extension { ['php-mysql']:
|
||||
require => [ Class['mysql'] ]
|
||||
}
|
||||
|
||||
package { 'icinga-web':
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga-web-db':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
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']
|
||||
}
|
||||
|
||||
exec { 'populate-icinga-web-mysql-db':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null',
|
||||
command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/share/icinga-web/etc/schema/mysql.sql',
|
||||
require => [ Package['icinga-web'], Exec['create-mysql-icinga-web-db'] ]
|
||||
}
|
||||
}
|
|
@ -1,353 +0,0 @@
|
|||
#####################################################################
|
||||
# IDO2DB DAEMON CONFIG FILE
|
||||
#####################################################################
|
||||
|
||||
|
||||
|
||||
# LOCK FILE
|
||||
# This is the lockfile that IDO2DB will use to store its PID number
|
||||
# in when it is running in daemon mode.
|
||||
|
||||
lock_file=/usr/local/icinga-mysql/var/ido2db.lock
|
||||
|
||||
|
||||
|
||||
# USER/GROUP PRIVILIGES
|
||||
# These options determine the user/group that the daemon should run as.
|
||||
# You can specify a number (uid/gid) or a name for either option.
|
||||
|
||||
ido2db_user=icinga
|
||||
ido2db_group=icinga
|
||||
|
||||
|
||||
|
||||
# SOCKET TYPE
|
||||
# This option determines what type of socket the daemon will create
|
||||
# an accept connections from.
|
||||
# Value:
|
||||
# unix = Unix domain socket (default)
|
||||
# tcp = TCP socket
|
||||
|
||||
socket_type=unix
|
||||
#socket_type=tcp
|
||||
|
||||
|
||||
|
||||
# SOCKET NAME
|
||||
# This option determines the name and path of the UNIX domain
|
||||
# socket that the daemon will create and accept connections from.
|
||||
# This option is only valid if the socket type specified above
|
||||
# is "unix".
|
||||
|
||||
socket_name=/usr/local/icinga-mysql/var/ido.sock
|
||||
|
||||
|
||||
|
||||
# SOCKET PERMISSIONS
|
||||
# This option determines the permissions of the Unix domain
|
||||
# socket. This option is only valid if the socket type specified
|
||||
# above is "unix". Default permissions are set to 0755.
|
||||
|
||||
socket_perm=0755
|
||||
|
||||
|
||||
|
||||
|
||||
# TCP PORT
|
||||
# This option determines what port the daemon will listen for
|
||||
# connections on. This option is only vlaid if the socket type
|
||||
# specified above is "tcp".
|
||||
|
||||
tcp_port=5668
|
||||
|
||||
|
||||
|
||||
# ENCRYPTION
|
||||
# This option determines if the ido2db daemon will accept SSL to encrypt the
|
||||
# network traffic between module and ido2db daemon.
|
||||
# Both sides have to enable this feature which depends on SSL Libraries
|
||||
# like openssl or kerberos
|
||||
# This option is only valid if the output type
|
||||
# option specified above is "tcpsocket".
|
||||
#
|
||||
# A value of '1' will enable this feature
|
||||
|
||||
use_ssl=0
|
||||
|
||||
|
||||
|
||||
# LIBDBI DRIVER DIRECTORY !!!EXPERIMENTAL!!!
|
||||
# This option is only valid when using libdbi as database abstraction layer
|
||||
# (so not oracle) on compile time. By default, libdbi will figure out the
|
||||
# correct path itsself. If you want to change it, enable and change the value.
|
||||
#
|
||||
# Default: not in use, enable and change to e.g. /usr/local/lib/dbd
|
||||
|
||||
#libdbi_driver_dir=/usr/local/lib/dbd
|
||||
|
||||
|
||||
|
||||
# DATABASE SERVER TYPE
|
||||
# This option determines what type of DB server the daemon should
|
||||
# connect to.
|
||||
# Values:
|
||||
# mysql = MySQL
|
||||
# pgsql = PostgreSQL
|
||||
# db2 = DB2
|
||||
# firebird = Firebird
|
||||
# freetds = FreeTDS
|
||||
# ingres = Ingres
|
||||
# msql = MSSQL
|
||||
# oracle = Oracle
|
||||
# sqlite = SQLite
|
||||
# sqlite3 = SQLite3
|
||||
# Currently supported:
|
||||
# libdbi: mysql, pgsql
|
||||
# ocilib: oracle
|
||||
|
||||
|
||||
db_servertype=mysql
|
||||
|
||||
|
||||
|
||||
# DATABASE HOST
|
||||
# This option specifies what host the DB server is running on.
|
||||
# Note: Oracle will ignore this setting
|
||||
|
||||
db_host=localhost
|
||||
|
||||
|
||||
|
||||
# DATABASE PORT
|
||||
# This option specifies the port that the DB server is running on.
|
||||
# Values:
|
||||
# 3306 = Default MySQL port
|
||||
# 5432 = Default PostgreSQL port
|
||||
# 1521 = Default Oracle port
|
||||
#
|
||||
# Note: ocilib will ignore this, you have to modify your tnsnames.ora
|
||||
|
||||
db_port=3306
|
||||
|
||||
|
||||
# DATABASE SOCKET
|
||||
# Optional db_socket allows to specify a different socket location.
|
||||
# This will be passed to libdbi MySQL as mysql_unix_socket, while
|
||||
# PostgeSQL overrides the port, ocilib Oracle ignores this setting.
|
||||
#
|
||||
# Note: This setting overrules db_port, making it useless!
|
||||
|
||||
#db_socket=/var/lib/mysql/mysql.sock
|
||||
|
||||
|
||||
|
||||
# DATABASE NAME
|
||||
# This option specifies the name of the database that should be used.
|
||||
#
|
||||
# Note: Oracle with ocilib requires tnsnames.ora filled with host, port
|
||||
# and database information. you can use the SID then with ocilib and
|
||||
# one of the following:
|
||||
# //DBSERVER/SID
|
||||
# SID
|
||||
|
||||
db_name=icinga
|
||||
|
||||
|
||||
|
||||
# DATABASE TABLE PREFIX
|
||||
# Determines the prefix (if any) that should be prepended to table names.
|
||||
# If you modify the table prefix, you'll need to modify the SQL script for
|
||||
# creating the database!
|
||||
#
|
||||
# Note: Oracle will ignore this prefix since the tablename length will exceed
|
||||
# 30 characters.
|
||||
|
||||
db_prefix=icinga_
|
||||
|
||||
|
||||
|
||||
# DATABASE USERNAME/PASSWORD
|
||||
# This is the username/password that will be used to authenticate to the DB.
|
||||
# The user needs at least SELECT, INSERT, UPDATE, and DELETE privileges on
|
||||
# the database.
|
||||
|
||||
db_user=icinga
|
||||
db_pass=icinga
|
||||
|
||||
|
||||
|
||||
## TABLE TRIMMING OPTIONS
|
||||
# Several database tables containing Icinga event data can become quite large
|
||||
# over time. Most admins will want to trim these tables and keep only a
|
||||
# certain amount of data in them. The options below are used to specify the
|
||||
# age (in MINUTES) that data should be allowd to remain in various tables
|
||||
# before it is deleted. Using a value of zero (0) for any value means that
|
||||
# that particular table should NOT be automatically trimmed.
|
||||
#
|
||||
# Remember: There are no optimized settings, it depends on your rdbm install,
|
||||
# number/checkinterval of host/service-checks and your desired time of data
|
||||
# savings - historical vs live-data. Please keep in mind that low delete
|
||||
# intervals may interfere with insert/update data from Icinga.
|
||||
|
||||
# ***DEFAULT***
|
||||
|
||||
# Keep timed events for 1 hour
|
||||
max_timedevents_age=60
|
||||
|
||||
# Keep system commands for 1 day
|
||||
max_systemcommands_age=1440
|
||||
|
||||
# Keep service checks for 1 day
|
||||
max_servicechecks_age=1440
|
||||
|
||||
# Keep host checks for 1 day
|
||||
max_hostchecks_age=1440
|
||||
|
||||
# Keep event handlers for 1 week
|
||||
max_eventhandlers_age=10080
|
||||
|
||||
# Keep external commands for 1 week
|
||||
max_externalcommands_age=10080
|
||||
|
||||
# Keep logentries for 31 days
|
||||
max_logentries_age=44640
|
||||
|
||||
# Keep acknowledgements for 31 days
|
||||
max_acknowledgements_age=44640
|
||||
|
||||
# Keep notifications for 31 days
|
||||
max_notifications_age=44640
|
||||
|
||||
# Keep contactnotifications for 31 days
|
||||
max_contactnotifications_age=44640
|
||||
|
||||
# Keep contactnotificationmethods for 31 days
|
||||
max_contactnotificationmethods_age=44640
|
||||
|
||||
|
||||
## CLEAN REALTIME TABLES AT CORE STARTUP !!!EXPERIMENTAL!!!
|
||||
# If you don't want to clean all those tables, set this option to 0.
|
||||
# This can be useful if the deletes slow down the normal data
|
||||
# processing.
|
||||
# Values: 0 - don't clean
|
||||
# 1 - clean (default)
|
||||
|
||||
clean_realtime_tables_on_core_startup=1
|
||||
|
||||
|
||||
## CLEAN CONFIG TABLES AT CORE STARTUP !!!EXPERIMENTAL!!!
|
||||
# If you don't want to clean all those tables, set this option to 0.
|
||||
# This can be useful if the deletes slow down the normal data
|
||||
# processing.
|
||||
# Furthermore if you need to keep e.g. the state of customvariables
|
||||
# or any other tables not directly linked to the objects table.
|
||||
# Values: 0 - don't clean
|
||||
# 1 - clean (default)
|
||||
|
||||
clean_config_tables_on_core_startup=1
|
||||
|
||||
|
||||
# ***EXPERIMENTAL*** DB TRIMMING INTERVAL
|
||||
# ido2db default db trimming interval is set to 3600 SECONDS.
|
||||
# Some environments will require higher or lower values. This setting is
|
||||
# highly experimental!!!
|
||||
# Modify at your own risk to set the interval DB trimming interval
|
||||
# to an appropriate value. If left blank, it defaults to 3600 seconds.
|
||||
|
||||
trim_db_interval=3600
|
||||
|
||||
|
||||
# DB TRIMMING THREAD DELAY ON STARTUP
|
||||
# ido2db spawns a thread for parallel db trimming. This option can be
|
||||
# modified to extend/minimize the initial wait delay at startup.
|
||||
# Default is set to 300 seconds in order to allow startup routines.
|
||||
# 300 seconds is also the minimum value, lower ones will be overwritten.
|
||||
|
||||
housekeeping_thread_startup_delay=300
|
||||
|
||||
|
||||
|
||||
# DEBUG LEVEL
|
||||
# This option determines how much (if any) debugging information will
|
||||
# be written to the debug file. OR values together to log multiple
|
||||
# types of information.
|
||||
# Values: -1 = Everything
|
||||
# 0 = Nothing
|
||||
# 1 = Process info
|
||||
# 2 = SQL queries
|
||||
|
||||
debug_level=0
|
||||
|
||||
|
||||
|
||||
# DEBUG VERBOSITY
|
||||
# This option determines how verbose the debug log out will be.
|
||||
# Values: 0 = Brief output
|
||||
# 1 = More detailed
|
||||
# 2 = Very detailed
|
||||
|
||||
debug_verbosity=2
|
||||
|
||||
|
||||
|
||||
# DEBUG FILE
|
||||
# This option determines where the daemon should write debugging information.
|
||||
|
||||
debug_file=/usr/local/icinga-mysql/var/ido2db.debug
|
||||
|
||||
|
||||
|
||||
# MAX DEBUG FILE SIZE
|
||||
# This option determines the maximum size (in bytes) of the debug file. If
|
||||
# the file grows larger than this size, it will be renamed with a .old
|
||||
# extension. If a file already exists with a .old extension it will
|
||||
# automatically be deleted. This helps ensure your disk space usage doesn't
|
||||
# get out of control when debugging.
|
||||
|
||||
# 100M
|
||||
max_debug_file_size=100000000
|
||||
|
||||
|
||||
|
||||
# DEBUG READABLE TIMESTAMP
|
||||
# This option will allow you to set a readable timestamp instead of the
|
||||
# default unix timestamp.
|
||||
# Values: 0 = disabled, 1 = enabled
|
||||
|
||||
debug_readable_timestamp=0
|
||||
|
||||
|
||||
|
||||
# OCI ERRORS TO SYSLOG
|
||||
# ido2db registers an error handler in ocilib which spits all msg
|
||||
# into debug and syslog by default. Setting this option to 0,
|
||||
# syslog output will be disabled, only debug log will be used (if
|
||||
# appropriate debug_level is set).
|
||||
|
||||
oci_errors_to_syslog=1
|
||||
|
||||
|
||||
|
||||
# ORACLE TRACE LEVEL
|
||||
# This setting activates oracle session trace for each ido2db connection using trace event
|
||||
# Level value must be one of the currently supported values (1,4,8,12) or 0 for off
|
||||
# this requires explicit "alter session" privilege
|
||||
# select rights to v$session and v$process are recommanded
|
||||
# 0 - pseudo level TRACE OFF
|
||||
# 1 – standard SQL trace, no wait events, or bind variables.
|
||||
# 4 – Bind variables only
|
||||
# 8 – Wait events only
|
||||
# 12 – Bind Variables and Wait Events
|
||||
|
||||
oracle_trace_level=0
|
||||
|
||||
|
||||
|
||||
# ENABLE SLA - DEPRECATED!
|
||||
# This setting enables collection of SLA data in the slahistory table
|
||||
# Values: 0 = disabled, 1 = enabled
|
||||
#
|
||||
# WARNING: This setting will be deprecated in 1.9 and not developed
|
||||
# anymore, as it has never been used by any Icinga application.
|
||||
|
||||
enable_sla=0
|
|
@ -1,353 +0,0 @@
|
|||
#####################################################################
|
||||
# IDO2DB DAEMON CONFIG FILE
|
||||
#####################################################################
|
||||
|
||||
|
||||
|
||||
# LOCK FILE
|
||||
# This is the lockfile that IDO2DB will use to store its PID number
|
||||
# in when it is running in daemon mode.
|
||||
|
||||
lock_file=/usr/local/icinga-pgsql/var/ido2db.lock
|
||||
|
||||
|
||||
|
||||
# USER/GROUP PRIVILIGES
|
||||
# These options determine the user/group that the daemon should run as.
|
||||
# You can specify a number (uid/gid) or a name for either option.
|
||||
|
||||
ido2db_user=icinga
|
||||
ido2db_group=icinga
|
||||
|
||||
|
||||
|
||||
# SOCKET TYPE
|
||||
# This option determines what type of socket the daemon will create
|
||||
# an accept connections from.
|
||||
# Value:
|
||||
# unix = Unix domain socket (default)
|
||||
# tcp = TCP socket
|
||||
|
||||
socket_type=unix
|
||||
#socket_type=tcp
|
||||
|
||||
|
||||
|
||||
# SOCKET NAME
|
||||
# This option determines the name and path of the UNIX domain
|
||||
# socket that the daemon will create and accept connections from.
|
||||
# This option is only valid if the socket type specified above
|
||||
# is "unix".
|
||||
|
||||
socket_name=/usr/local/icinga-pgsql/var/ido.sock
|
||||
|
||||
|
||||
|
||||
# SOCKET PERMISSIONS
|
||||
# This option determines the permissions of the Unix domain
|
||||
# socket. This option is only valid if the socket type specified
|
||||
# above is "unix". Default permissions are set to 0755.
|
||||
|
||||
socket_perm=0755
|
||||
|
||||
|
||||
|
||||
|
||||
# TCP PORT
|
||||
# This option determines what port the daemon will listen for
|
||||
# connections on. This option is only vlaid if the socket type
|
||||
# specified above is "tcp".
|
||||
|
||||
tcp_port=5668
|
||||
|
||||
|
||||
|
||||
# ENCRYPTION
|
||||
# This option determines if the ido2db daemon will accept SSL to encrypt the
|
||||
# network traffic between module and ido2db daemon.
|
||||
# Both sides have to enable this feature which depends on SSL Libraries
|
||||
# like openssl or kerberos
|
||||
# This option is only valid if the output type
|
||||
# option specified above is "tcpsocket".
|
||||
#
|
||||
# A value of '1' will enable this feature
|
||||
|
||||
use_ssl=0
|
||||
|
||||
|
||||
|
||||
# LIBDBI DRIVER DIRECTORY !!!EXPERIMENTAL!!!
|
||||
# This option is only valid when using libdbi as database abstraction layer
|
||||
# (so not oracle) on compile time. By default, libdbi will figure out the
|
||||
# correct path itsself. If you want to change it, enable and change the value.
|
||||
#
|
||||
# Default: not in use, enable and change to e.g. /usr/local/lib/dbd
|
||||
|
||||
#libdbi_driver_dir=/usr/local/lib/dbd
|
||||
|
||||
|
||||
|
||||
# DATABASE SERVER TYPE
|
||||
# This option determines what type of DB server the daemon should
|
||||
# connect to.
|
||||
# Values:
|
||||
# mysql = MySQL
|
||||
# pgsql = PostgreSQL
|
||||
# db2 = DB2
|
||||
# firebird = Firebird
|
||||
# freetds = FreeTDS
|
||||
# ingres = Ingres
|
||||
# msql = MSSQL
|
||||
# oracle = Oracle
|
||||
# sqlite = SQLite
|
||||
# sqlite3 = SQLite3
|
||||
# Currently supported:
|
||||
# libdbi: mysql, pgsql
|
||||
# ocilib: oracle
|
||||
|
||||
|
||||
db_servertype=pgsql
|
||||
|
||||
|
||||
|
||||
# DATABASE HOST
|
||||
# This option specifies what host the DB server is running on.
|
||||
# Note: Oracle will ignore this setting
|
||||
|
||||
db_host=127.0.0.1
|
||||
|
||||
|
||||
|
||||
# DATABASE PORT
|
||||
# This option specifies the port that the DB server is running on.
|
||||
# Values:
|
||||
# 3306 = Default MySQL port
|
||||
# 5432 = Default PostgreSQL port
|
||||
# 1521 = Default Oracle port
|
||||
#
|
||||
# Note: ocilib will ignore this, you have to modify your tnsnames.ora
|
||||
|
||||
db_port=5432
|
||||
|
||||
|
||||
# DATABASE SOCKET
|
||||
# Optional db_socket allows to specify a different socket location.
|
||||
# This will be passed to libdbi MySQL as mysql_unix_socket, while
|
||||
# PostgeSQL overrides the port, ocilib Oracle ignores this setting.
|
||||
#
|
||||
# Note: This setting overrules db_port, making it useless!
|
||||
|
||||
#db_socket=/var/lib/mysql/mysql.sock
|
||||
|
||||
|
||||
|
||||
# DATABASE NAME
|
||||
# This option specifies the name of the database that should be used.
|
||||
#
|
||||
# Note: Oracle with ocilib requires tnsnames.ora filled with host, port
|
||||
# and database information. you can use the SID then with ocilib and
|
||||
# one of the following:
|
||||
# //DBSERVER/SID
|
||||
# SID
|
||||
|
||||
db_name=icinga
|
||||
|
||||
|
||||
|
||||
# DATABASE TABLE PREFIX
|
||||
# Determines the prefix (if any) that should be prepended to table names.
|
||||
# If you modify the table prefix, you'll need to modify the SQL script for
|
||||
# creating the database!
|
||||
#
|
||||
# Note: Oracle will ignore this prefix since the tablename length will exceed
|
||||
# 30 characters.
|
||||
|
||||
db_prefix=icinga_
|
||||
|
||||
|
||||
|
||||
# DATABASE USERNAME/PASSWORD
|
||||
# This is the username/password that will be used to authenticate to the DB.
|
||||
# The user needs at least SELECT, INSERT, UPDATE, and DELETE privileges on
|
||||
# the database.
|
||||
|
||||
db_user=icinga
|
||||
db_pass=icinga
|
||||
|
||||
|
||||
|
||||
## TABLE TRIMMING OPTIONS
|
||||
# Several database tables containing Icinga event data can become quite large
|
||||
# over time. Most admins will want to trim these tables and keep only a
|
||||
# certain amount of data in them. The options below are used to specify the
|
||||
# age (in MINUTES) that data should be allowd to remain in various tables
|
||||
# before it is deleted. Using a value of zero (0) for any value means that
|
||||
# that particular table should NOT be automatically trimmed.
|
||||
#
|
||||
# Remember: There are no optimized settings, it depends on your rdbm install,
|
||||
# number/checkinterval of host/service-checks and your desired time of data
|
||||
# savings - historical vs live-data. Please keep in mind that low delete
|
||||
# intervals may interfere with insert/update data from Icinga.
|
||||
|
||||
# ***DEFAULT***
|
||||
|
||||
# Keep timed events for 1 hour
|
||||
max_timedevents_age=60
|
||||
|
||||
# Keep system commands for 1 day
|
||||
max_systemcommands_age=1440
|
||||
|
||||
# Keep service checks for 1 day
|
||||
max_servicechecks_age=1440
|
||||
|
||||
# Keep host checks for 1 day
|
||||
max_hostchecks_age=1440
|
||||
|
||||
# Keep event handlers for 1 week
|
||||
max_eventhandlers_age=10080
|
||||
|
||||
# Keep external commands for 1 week
|
||||
max_externalcommands_age=10080
|
||||
|
||||
# Keep logentries for 31 days
|
||||
max_logentries_age=44640
|
||||
|
||||
# Keep acknowledgements for 31 days
|
||||
max_acknowledgements_age=44640
|
||||
|
||||
# Keep notifications for 31 days
|
||||
max_notifications_age=44640
|
||||
|
||||
# Keep contactnotifications for 31 days
|
||||
max_contactnotifications_age=44640
|
||||
|
||||
# Keep contactnotificationmethods for 31 days
|
||||
max_contactnotificationmethods_age=44640
|
||||
|
||||
|
||||
## CLEAN REALTIME TABLES AT CORE STARTUP !!!EXPERIMENTAL!!!
|
||||
# If you don't want to clean all those tables, set this option to 0.
|
||||
# This can be useful if the deletes slow down the normal data
|
||||
# processing.
|
||||
# Values: 0 - don't clean
|
||||
# 1 - clean (default)
|
||||
|
||||
clean_realtime_tables_on_core_startup=1
|
||||
|
||||
|
||||
## CLEAN CONFIG TABLES AT CORE STARTUP !!!EXPERIMENTAL!!!
|
||||
# If you don't want to clean all those tables, set this option to 0.
|
||||
# This can be useful if the deletes slow down the normal data
|
||||
# processing.
|
||||
# Furthermore if you need to keep e.g. the state of customvariables
|
||||
# or any other tables not directly linked to the objects table.
|
||||
# Values: 0 - don't clean
|
||||
# 1 - clean (default)
|
||||
|
||||
clean_config_tables_on_core_startup=1
|
||||
|
||||
|
||||
# ***EXPERIMENTAL*** DB TRIMMING INTERVAL
|
||||
# ido2db default db trimming interval is set to 3600 SECONDS.
|
||||
# Some environments will require higher or lower values. This setting is
|
||||
# highly experimental!!!
|
||||
# Modify at your own risk to set the interval DB trimming interval
|
||||
# to an appropriate value. If left blank, it defaults to 3600 seconds.
|
||||
|
||||
trim_db_interval=3600
|
||||
|
||||
|
||||
# DB TRIMMING THREAD DELAY ON STARTUP
|
||||
# ido2db spawns a thread for parallel db trimming. This option can be
|
||||
# modified to extend/minimize the initial wait delay at startup.
|
||||
# Default is set to 300 seconds in order to allow startup routines.
|
||||
# 300 seconds is also the minimum value, lower ones will be overwritten.
|
||||
|
||||
housekeeping_thread_startup_delay=300
|
||||
|
||||
|
||||
|
||||
# DEBUG LEVEL
|
||||
# This option determines how much (if any) debugging information will
|
||||
# be written to the debug file. OR values together to log multiple
|
||||
# types of information.
|
||||
# Values: -1 = Everything
|
||||
# 0 = Nothing
|
||||
# 1 = Process info
|
||||
# 2 = SQL queries
|
||||
|
||||
debug_level=0
|
||||
|
||||
|
||||
|
||||
# DEBUG VERBOSITY
|
||||
# This option determines how verbose the debug log out will be.
|
||||
# Values: 0 = Brief output
|
||||
# 1 = More detailed
|
||||
# 2 = Very detailed
|
||||
|
||||
debug_verbosity=2
|
||||
|
||||
|
||||
|
||||
# DEBUG FILE
|
||||
# This option determines where the daemon should write debugging information.
|
||||
|
||||
debug_file=/usr/local/icinga-pgsql/var/ido2db.debug
|
||||
|
||||
|
||||
|
||||
# MAX DEBUG FILE SIZE
|
||||
# This option determines the maximum size (in bytes) of the debug file. If
|
||||
# the file grows larger than this size, it will be renamed with a .old
|
||||
# extension. If a file already exists with a .old extension it will
|
||||
# automatically be deleted. This helps ensure your disk space usage doesn't
|
||||
# get out of control when debugging.
|
||||
|
||||
# 100M
|
||||
max_debug_file_size=100000000
|
||||
|
||||
|
||||
|
||||
# DEBUG READABLE TIMESTAMP
|
||||
# This option will allow you to set a readable timestamp instead of the
|
||||
# default unix timestamp.
|
||||
# Values: 0 = disabled, 1 = enabled
|
||||
|
||||
debug_readable_timestamp=0
|
||||
|
||||
|
||||
|
||||
# OCI ERRORS TO SYSLOG
|
||||
# ido2db registers an error handler in ocilib which spits all msg
|
||||
# into debug and syslog by default. Setting this option to 0,
|
||||
# syslog output will be disabled, only debug log will be used (if
|
||||
# appropriate debug_level is set).
|
||||
|
||||
oci_errors_to_syslog=1
|
||||
|
||||
|
||||
|
||||
# ORACLE TRACE LEVEL
|
||||
# This setting activates oracle session trace for each ido2db connection using trace event
|
||||
# Level value must be one of the currently supported values (1,4,8,12) or 0 for off
|
||||
# this requires explicit "alter session" privilege
|
||||
# select rights to v$session and v$process are recommanded
|
||||
# 0 - pseudo level TRACE OFF
|
||||
# 1 – standard SQL trace, no wait events, or bind variables.
|
||||
# 4 – Bind variables only
|
||||
# 8 – Wait events only
|
||||
# 12 – Bind Variables and Wait Events
|
||||
|
||||
oracle_trace_level=0
|
||||
|
||||
|
||||
|
||||
# ENABLE SLA - DEPRECATED!
|
||||
# This setting enables collection of SLA data in the slahistory table
|
||||
# Values: 0 = disabled, 1 = enabled
|
||||
#
|
||||
# WARNING: This setting will be deprecated in 1.9 and not developed
|
||||
# anymore, as it has never been used by any Icinga application.
|
||||
|
||||
enable_sla=0
|
|
@ -0,0 +1,94 @@
|
|||
class icinga2 {
|
||||
include icinga-rpm-snapshot
|
||||
|
||||
package { 'icinga2':
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
alias => 'icinga2'
|
||||
}
|
||||
|
||||
package { 'icinga2-doc':
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
alias => 'icinga2-doc'
|
||||
}
|
||||
|
||||
service { 'icinga2':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
alias => 'icinga2',
|
||||
require => Package['icinga2']
|
||||
}
|
||||
|
||||
file { "/etc/icinga2/features-enabled/*":
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
}
|
||||
|
||||
class icinga2-ido-mysql {
|
||||
include icinga-rpm-snapshot
|
||||
|
||||
package { 'icinga2-ido-mysql':
|
||||
ensure => installed,
|
||||
require => Class['icinga-rpm-snapshot'],
|
||||
alias => 'icinga2-ido-mysql'
|
||||
}
|
||||
|
||||
# icinga 2 IDO config
|
||||
file { '/etc/icinga2/features-available/ido-mysql.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf',
|
||||
require => Package['icinga2'],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
exec { 'enable-icinga2-ido-mysql':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
command => 'i2enfeature ido-mysql;',
|
||||
require => [ Package['icinga2'], Exec['populate-icinga2-ido-mysql-db'] ]
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga2-ido-db':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'mysql -uicinga -picinga icinga',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
||||
GRANT ALL ON icinga.* TO icinga@localhost \
|
||||
IDENTIFIED BY \'icinga\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
# populate icinga2-ido-mysql db
|
||||
exec { 'populate-icinga2-ido-mysql-db':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
|
||||
command => 'mysql -uicinga -picinga icinga < /usr/share/doc/icinga2-ido-mysql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/mysql.sql',
|
||||
require => [ Package['icinga2-ido-mysql'], Exec['create-mysql-icinga2-ido-db'] ]
|
||||
}
|
||||
}
|
||||
|
||||
#class icinga2-ido-pgsql {
|
||||
# include icinga-rpm-snapshot
|
||||
#
|
||||
# package { 'icinga2-ido-pgsql':
|
||||
# ensure => installed,
|
||||
# require => Class['icinga-rpm-snapshot'],
|
||||
# alias = 'icinga2-ido-pgsql'
|
||||
# }
|
||||
#
|
||||
# exec { 'create-pgsql-icinga2-ido-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 \'icinga\';" && \
|
||||
# sudo -u postgres createdb -O icinga -E UTF8 icinga && \
|
||||
# sudo -u postgres createlang plpgsql icinga',
|
||||
# require => Service['postgresql']
|
||||
# }
|
||||
#
|
||||
# exec { 'populate-icinga2-ido-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/share/doc/icinga2-ido-pgsql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/pgsql.sql',
|
||||
# require => [ Package['icinga2-ido-pgsql'], Exec['create-pgsql-icinga2-ido-db'] ]
|
||||
# }
|
||||
#
|
||||
# php::extension { ['php-pgsql']:
|
||||
# require => [ Class['pgsql'] ]
|
||||
# }
|
||||
#}
|
|
@ -0,0 +1,9 @@
|
|||
class nagios-plugins {
|
||||
include epel
|
||||
|
||||
# nagios plugins from epel
|
||||
package { 'nagios-plugins-all':
|
||||
ensure => installed,
|
||||
require => Class['epel']
|
||||
}
|
||||
}
|
|
@ -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,41 +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']
|
||||
}
|
||||
|
||||
exec { "pear install ${name}":
|
||||
command => "pear install --alldeps ${channel}",
|
||||
creates => "/usr/bin/${name}",
|
||||
require => $require_
|
||||
}
|
||||
|
||||
exec { "pear upgrade ${name}":
|
||||
command => "pear upgrade ${channel}",
|
||||
require => Exec["pear install ${name}"]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue