Merge branch 'feature/Vagrant-4202'

Conflicts:
	.gitignore
This commit is contained in:
Marius Hein 2013-06-05 10:53:35 +02:00
commit beb6fde90a
16 changed files with 1433 additions and 0 deletions

8
.gitignore vendored
View File

@ -1,3 +1,11 @@
# Exclude all hidden files
.*
# But not .gitignore and .vagrant-puppet
!.gitignore
!.vagrant-puppet
# Build artefacts
build/
# Dev environmental
.idea/
# Configure output
config.log

View File

@ -0,0 +1,214 @@
include apache
include mysql
include pgsql
Exec { path => '/bin:/usr/bin:/sbin' }
exec { 'create-mysql-icinga-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-pgsql-icinga-db':
unless => 'sudo -u postgres psql -l 2> /dev/null | grep -s icinga',
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']
}
$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']:
require => [Class['mysql'], Class['pgsql']]
}
group { 'icinga-cmd':
ensure => present
}
user { 'icinga':
ensure => present,
groups => 'icinga-cmd',
managehome => false
}
user { 'apache':
groups => 'icinga-cmd',
require => [Package["${apache::apache}"], Group['icinga-cmd']]
}
cmmi { 'icinga-mysql':
url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download',
output => 'icinga-1.9.1.tar.gz',
flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \
--enable-idoutils --with-init-dir=/tmp/icinga-mysql/etc/init.d \
--with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \
--with-cgiurl=/icinga-mysql/cgi-bin \
--with-http-auth-file=/usr/share/icinga/htpasswd.users \
--with-plugin-dir=/usr/lib64/nagios/plugins/libexec',
creates => '/usr/local/icinga-mysql',
make => 'make all && make fullinstall install-config',
require => [User['icinga'], Cmmi['icinga-plugins']],
notify => Service["${apache::apache}"]
}
file { '/etc/init.d/icinga-mysql':
source => '/tmp/icinga-mysql/etc/init.d/icinga',
require => Cmmi['icinga-mysql']
}
file { '/etc/init.d/ido2db-mysql':
source => '/tmp/icinga-mysql/etc/init.d/ido2db',
require => Cmmi['icinga-mysql']
}
cmmi { 'icinga-pgsql':
url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download',
output => 'icinga-1.9.1.tar.gz',
flags => '--prefix=/usr/local/icinga-pgsql \
--with-command-group=icinga-cmd --enable-idoutils \
--with-init-dir=/tmp/icinga-pgsql/etc/init.d \
--with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \
--with-cgiurl=/icinga-pgsql/cgi-bin \
--with-http-auth-file=/usr/share/icinga/htpasswd.users \
--with-plugin-dir=/usr/lib64/nagios/plugins/libexec',
creates => '/usr/local/icinga-pgsql',
make => 'make all && make fullinstall install-config',
require => [User['icinga'], Cmmi['icinga-plugins']],
notify => Service["${apache::apache}"]
}
file { '/etc/init.d/icinga-pgsql':
source => '/tmp/icinga-pgsql/etc/init.d/icinga',
require => Cmmi['icinga-pgsql']
}
file { '/etc/init.d/ido2db-pgsql':
source => '/tmp/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 -uicinga -picinga icinga < /usr/local/src/icinga-mysql/icinga-1.9.1/module/idoutils/db/mysql/mysql.sql',
require => [Cmmi['icinga-mysql'], Exec['create-mysql-icinga-db']]
}
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-1.9.1/module/idoutils/db/pgsql/pgsql.sql',
require => [Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db']]
}
service { 'icinga-mysql':
ensure => running,
require => Cmmi['icinga-mysql']
}
service { 'ido2db-mysql':
ensure => running,
require => Cmmi['icinga-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 /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga',
require => Package["${apache::apache}"]
}
cmmi { 'icinga-plugins':
url => 'http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz/download',
output => 'nagios-plugins-1.4.16.tar.gz',
flags => '--prefix=/usr/lib64/nagios/plugins \
--with-nagios-user=icinga --with-nagios-group=icinga \
--with-cgiurl=/icinga-mysql/cgi-bin',
creates => '/usr/lib64/nagios/plugins/libexec',
make => 'make && make install',
require => User['icinga']
}
cmmi { 'mk-livestatus':
url => 'http://mathias-kettner.de/download/mk-livestatus-1.2.2p1.tar.gz',
output => 'mk-livestatus-1.2.2p1.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']]
}

View File

@ -0,0 +1,32 @@
# Class: apache
#
# This class installs the apache server.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include apache
#
class apache {
$apache = $::operatingsystem ? {
/(Debian|Ubuntu)/ => 'apache2',
/(RedHat|CentOS|Fedora)/ => 'httpd'
}
package { $apache:
ensure => installed,
alias => 'apache'
}
service { $apache:
ensure => running,
alias => 'apache',
require => Package['apache']
}
}

View File

@ -0,0 +1,75 @@
# 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.
#
# 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'
# }
#
define cmmi(
$url,
$output,
$flags,
$creates,
$make,
) {
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}",
timeout => 120,
require => Class['wget']
}
$tld = inline_template('<%= File.basename(output, ".tar.gz") %>')
$src = "${cwd}/${name}/${tld}"
exec { "extract-${name}":
cwd => $cwd,
command => "mkdir -p ${name} && tar --no-same-owner \
--no-same-permissions -xzf ${output} -C ${name}",
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}"]
}
}

View File

@ -0,0 +1,353 @@
#####################################################################
# 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

View File

@ -0,0 +1,353 @@
#####################################################################
# 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

View File

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

View File

@ -0,0 +1,30 @@
# Class: mysql
#
# This class installs the mysql server and client software.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include mysql
#
class mysql {
Exec { path => '/usr/bin' }
package {
'mysql':
ensure => installed;
'mysql-server':
ensure => installed;
}
service { 'mysqld':
ensure => running,
require => Package['mysql-server']
}
}

View File

@ -0,0 +1,43 @@
# Class: pgsql
#
# This class installs the postgresql server and client software.
# Further it configures pg_hba.conf to trus the local icinga user.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# include pgsql
#
class pgsql {
Exec { path => '/sbin:/bin:/usr/bin' }
package {
'postgresql':
ensure => installed;
'postgresql-server':
ensure => installed;
}
exec { 'initdb':
creates => '/var/lib/pgsql/data/pg_xlog',
command => 'service postgresql initdb',
require => Package['postgresql-server']
}
service { 'postgresql':
ensure => running,
require => [Package['postgresql-server'], Exec['initdb']]
}
file { '/var/lib/pgsql/data/pg_hba.conf':
content => template('pgsql/pg_hba.conf.erb'),
require => [Package['postgresql-server'], Exec['initdb']],
notify => Service['postgresql']
}
}

View File

@ -0,0 +1,78 @@
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file. A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask. Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi", "krb5",
# "ident", "pam", "ldap" or "cert". Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different authentication
# methods - refer to the "Client Authentication" section in the documentation
# for a list of which options are available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can use
# "pg_ctl reload" to do that.
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# icinga
local icinga icinga trust
host icinga icinga 127.0.0.1/32 trust
host icinga icinga ::1/128 trust
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident

View File

@ -0,0 +1,32 @@
# define: php::extension
#
# Install additional PHP modules.
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# php::extension { 'php-ldap': }
# php::extension { ['php-mysql'], ['php-pgsql']: }
#
define php::extension(
$ensure=installed
) {
include php
if $::require {
$require_ = [Class['php'], $::require]
} else {
$require_ = Class['php']
}
package { $name:
ensure => $ensure,
require => $require_
}
}

View File

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

View File

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

107
README.md Normal file
View File

@ -0,0 +1,107 @@
# Icinga 2 Web
## Table of Contents
1. [Vagrant - Virtual development environment](#vagrant)
## Vagrant
The Icinga 2 Web project ships with a Vagrant virtual machine that integrates
the source code with various services and example data in a controlled
environment. This enables developers and users to test Livestatus, status.dat,
MySQL and PostgreSQL backends as well as the LDAP authentication. All you
have to do is install Vagrant and run:
vagrant up
After you should be able to browse [localhost:8080/icinga2-web](http://localhost:8080/icinga2-web).
### Environment
**Forwarded ports**:
<table>
<tr>
<th>Proctocol</th>
<th>Local port (virtual machine host)</th>
<th>Remote port (the virtual machine)</th>
</tr>
<tr>
<td>SSH</td>
<td>2222</td>
<td>22</td>
</tr>
<tr>
<td>HTTP</td>
<td>8080</td>
<td>80</td>
</tr>
</table>
**Installed packages**:
* Apache2 with PHP enabled
* PHP with MySQL and PostgreSQL libraries
* MySQL server and client software
* PostgreSQL server and client software
* [Icinga prerequisites](http://docs.icinga.org/latest/en/quickstart-idoutils.html#installpackages)
**Installed users and groups**:
* User icinga with group icinga and icinga-cmd
* Webserver user added to group icinga-cmd
**Installed software**:
* Icinga 1.9.1 with IDOUtils using a MySQL database
* Icinga 1.9.1 with IDOUtils using a PostgreSQL database
**Installed files**:
* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both icinga instances
* `/usr/lib64/nagios/plugins` Nagios Plugins 1.4.16 for both icinga instances
#### Icinga with IDOUtils using a MySQL database
**Installation path**: `/usr/local/icinga-mysql`
**Services**:
* `icinga-mysql`
* `ido2db-mysql`
Connect to the **icinga mysql database** using the following command:
mysql -u icinga -p icinga icinga
Access the **Classic UI** (CGIs) via [localhost:8080/icinga-mysql](http://localhost:8080/icinga-mysql).
For **logging into** the Icinga classic web interface use user *icingaadmin* with password *icinga*.
#### Icinga with IDOUtils using a PostgreSQL database
**Installation path**: `/usr/local/icinga-pgsql`
**Services**:
* `icinga-pgsql`
* `ido2db-pgsql`
Connect to the **icinga mysql database** using the following command:
sudo -u postgres psql -U icinga -d icinga
Access the **Classic UI** (CGIs) via [localhost:8080/icinga-pgsql](http://localhost:8080/icinga-pgsql).
For **logging into** the Icinga classic web interface use user *icingaadmin* with password *icinga*.
#### MK Livestatus
MK Livestatus is added to the Icinga installation using a MySQL database.
**Installation path**:
* `/usr/local/icinga-mysql/bin/unixcat`
* `/usr/local/icinga-mysql/lib/mk-livestatus/livecheck`
* `/usr/local/icinga-mysql/lib/mk-livestatus/livestatus.o`
* `/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg`
* `/usr/local/icinga-mysql/var/rw/live`

61
Vagrantfile vendored Normal file
View File

@ -0,0 +1,61 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "centos-6.4-x64-vbox"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://vagrant-boxes.icinga.org/centos-64-x64-vbox4212.box"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
# config.vm.network :hostonly, "192.168.33.10"
# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.
# config.vm.network :bridged
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
config.vm.forward_port 80, 8080
# 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"
# # }
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
config.vm.share_folder "v-icinga2-web-pub", "/var/www/html/icinga2-web", "./pub"
# 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 default.pp in the manifests_path directory.
config.vm.provision :puppet do |puppet|
puppet.module_path = ".vagrant-puppet/modules"
puppet.manifests_path = ".vagrant-puppet/manifests"
puppet.options = "-v -d"
end
end

1
pub/index.php Normal file
View File

@ -0,0 +1 @@
Icinga 2 Web