From 78b9e80fa49aea47bdd09e0ebd34897e14844550 Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Wed, 30 May 2018 21:04:32 +0300 Subject: [PATCH] * fix ido2db * fix path for ubuntu 16.04 --- manifests/config/server/common.pp | 4 +++ manifests/init.pp | 7 +++++ manifests/params.pp | 6 ++++ manifests/plugins/checkmem.pp | 7 +++-- manifests/plugins/idoutils/config.pp | 36 +++++++++++------------ templates/common/nrpe.cfg.erb | 4 +-- templates/debian/cgi.cfg | 14 ++++----- templates/debian/icinga.cfg | 4 +-- templates/plugins/idoutils/ido2db.cfg.erb | 9 +++--- templates/plugins/idoutils/idomod.cfg | 6 ++-- 10 files changed, 58 insertions(+), 39 deletions(-) diff --git a/manifests/config/server/common.pp b/manifests/config/server/common.pp index d3696e1..7cd17c7 100644 --- a/manifests/config/server/common.pp +++ b/manifests/config/server/common.pp @@ -21,6 +21,10 @@ purge => true, } + file{"${::icinga::confdir_server}/stylesheets": + recurse => true, + } + file{"${::icinga::confdir_server}/resource.cfg": ensure => file, content => template('icinga/common/resource.cfg.erb'), diff --git a/manifests/init.pp b/manifests/init.pp index 777962b..8293744 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -129,6 +129,13 @@ $process_service_perfdata_file = $::icinga::params::process_service_perfdata_file, $service_perfdata_file_template = $::icinga::params::service_perfdata_file_template, $service_perfdata_file_processing_interval = $::icinga::params::service_perfdata_file_processing_interval, + $idoutils_pkg = $::icinga::params::idoutils_pkg, + $idoutils_confdir = $::icinga::params::idoutils_confdir, + $idoutils_service = $::icinga::params::idoutils_service, + $idoutils_dbname = $::icinga::params::idoutils_dbname, + $idoutils_dbuser = $::icinga::params::idoutils_dbuser, + $idoutils_dbpass = $::icinga::params::idoutils_dbpass, + $idoutils_clear_tables_at_startup = $::icinga::params::idoutils_clear_tables_at_startup, ) inherits icinga::params { # Some safety nets diff --git a/manifests/params.pp b/manifests/params.pp index 4b2bfde..7efe422 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -94,6 +94,9 @@ $idoutils_dbname = 'icinga' $idoutils_dbuser = 'icinga' $idoutils_dbpass = 'icinga' + $idoutils_lock_file = '/var/run/icinga/ido2db.pid' + $idoutils_socket_name = '/var/lib/icinga/ido.sock' + $idoutils_clear_tables_at_startup = 1 # Plugin: Report $jasper_vhost = '/etc/apache2/conf.d/jasperserver.conf' @@ -168,6 +171,9 @@ $idoutils_dbname = 'icinga' $idoutils_dbuser = 'icinga' $idoutils_dbpass = 'icinga' + $idoutils_lock_file = '/var/run/ido2db.pid' + $idoutils_socket_name = '/var/spool/icinga/ido.sock' + $idoutils_clear_tables_at_startup = 1 # Plugin: Report $jasper_vhost = '/etc/httpd/conf.d/jasperserver.conf' diff --git a/manifests/plugins/checkmem.pp b/manifests/plugins/checkmem.pp index 070d037..38e2a21 100644 --- a/manifests/plugins/checkmem.pp +++ b/manifests/plugins/checkmem.pp @@ -7,11 +7,14 @@ $max_check_attempts = $::icinga::max_check_attempts, $notification_period = $::icinga::notification_period, $notifications_enabled = $::icinga::notifications_enabled, + $mem_package = [ 'nagios-plugins-mem' ], ) inherits icinga { if $icinga::client { - package{'nagios-plugins-mem': - ensure => 'present', + if $mem_package { + package{'nagios-plugins-mem': + ensure => 'present', + } } @@nagios_service{"check_mem_${::fqdn}": diff --git a/manifests/plugins/idoutils/config.pp b/manifests/plugins/idoutils/config.pp index 1f5c674..8354c9c 100644 --- a/manifests/plugins/idoutils/config.pp +++ b/manifests/plugins/idoutils/config.pp @@ -29,24 +29,24 @@ "${::icinga::confdir_server}/idomod.cfg": content => template('icinga/plugins/idoutils/idomod.cfg'); - "${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql": - content => template('icinga/plugins/idoutils/icinga-web-priv.sql.erb'), - require => Mysqldb[$icinga::idoutils_dbname]; +# "${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql": +# content => template('icinga/plugins/idoutils/icinga-web-priv.sql.erb'), +# require => Mysqldb[$icinga::idoutils_dbname]; } - Exec { - require => [ - Package[$icinga::idoutils_pkg], - File["${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql"] - ], - } - - exec { - 'icinga-db-priv': - command => "/usr/bin/mysql -u ${::icinga::idoutils_dbuser} --password=${::icinga::idoutils_dbpass} ${::icinga::idoutils_dbname} < ${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql", - unless => "/usr/bin/mysql -e \"select * from information_schema.user_privileges\" | grep ${::icinga::idoutils_dbname}"; - 'icinga-db-tables': - command => "/usr/bin/mysql -u ${::icinga::idoutils_dbuser} --password=${::icinga::idoutils_dbpass} ${::icinga::idoutils_dbname} < ${::icinga::idoutils_confdir}/mysql/mysql.sql", - unless => "/usr/bin/mysqlshow ${::icinga::idoutils_dbname} | grep icinga_contacts", - } +# Exec { +# require => [ +# Package[$icinga::idoutils_pkg], +# File["${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql"] +# ], +# } + +# exec { +# 'icinga-db-priv': +# command => "/usr/bin/mysql -u ${::icinga::idoutils_dbuser} --password=${::icinga::idoutils_dbpass} ${::icinga::idoutils_dbname} < ${::icinga::idoutils_confdir}/mysql/icinga-web-priv.sql", +# unless => "/usr/bin/mysql -e \"select * from information_schema.user_privileges\" | grep ${::icinga::idoutils_dbname}"; +# 'icinga-db-tables': +# command => "/usr/bin/mysql -u ${::icinga::idoutils_dbuser} --password=${::icinga::idoutils_dbpass} ${::icinga::idoutils_dbname} < ${::icinga::idoutils_confdir}/mysql/mysql.sql", +# unless => "/usr/bin/mysqlshow ${::icinga::idoutils_dbname} | grep icinga_contacts", +# } } diff --git a/templates/common/nrpe.cfg.erb b/templates/common/nrpe.cfg.erb index 58ad89d..16345e8 100644 --- a/templates/common/nrpe.cfg.erb +++ b/templates/common/nrpe.cfg.erb @@ -187,7 +187,7 @@ include_dir=<%= scope.lookupvar('icinga::includedir_client') %> # The following examples use hardcoded command arguments... command[check_users]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_users -w 5 -c 10 -command[check_disk]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_disk -w 20% -c 10% +command[check_disk]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_disk -w 15% -c 10% command[check_zombie_procs]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_procs -w 5 -c 10 -s Z <% if scope.lookupvar('icinga::nrpe_allow_arguments') == '1' -%> command[check_total_procs]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ @@ -195,4 +195,4 @@ command[check_total_procs]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugi command[check_total_procs]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_procs -w <%= scope.lookupvar('icinga::params::checktotalprocs_warning_level') %> -c <%= scope.lookupvar('icinga::params::checktotalprocs_critical_level') %> <% end -%> command[check_mem]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_mem -w 90,25 -c 95,50 -command[check_ping]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_ping -H $ARG1$ -4 -w $ARG2$ -c $ARG3$ -p 5 \ No newline at end of file +command[check_ping]=<%= scope.lookupvar('icinga::usrlib') %>/nagios/plugins/check_ping -H $ARG1$ -4 -w $ARG2$ -c $ARG3$ -p 5 diff --git a/templates/debian/cgi.cfg b/templates/debian/cgi.cfg index 882f648..4f9dcf7 100644 --- a/templates/debian/cgi.cfg +++ b/templates/debian/cgi.cfg @@ -131,7 +131,7 @@ use_ssl_authentication=0 # Alternatively you can specify contactgroups too, starting # with Icinga 1.5.0 -authorized_for_system_information=<%= scope.lookupvar('icinga::icinga_admins') %> +authorized_for_system_information=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> # CONFIGURATION INFORMATION ACCESS @@ -144,7 +144,7 @@ authorized_for_system_information=<%= scope.lookupvar('icinga::icinga_admins') % # Alternatively you can specify contactgroups too, starting # with Icinga 1.5.0 -authorized_for_configuration_information=<%= scope.lookupvar('icinga::icinga_admins') %> +authorized_for_configuration_information=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> # SYSTEM/PROCESS COMMAND ACCESS @@ -158,7 +158,7 @@ authorized_for_configuration_information=<%= scope.lookupvar('icinga::icinga_adm # Alternatively you can specify contactgroups too, starting # with Icinga 1.5.0 -authorized_for_system_commands=<%= scope.lookupvar('icinga::icinga_admins') %> +authorized_for_system_commands=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> # GLOBAL HOST/SERVICE VIEW ACCESS @@ -172,8 +172,8 @@ authorized_for_system_commands=<%= scope.lookupvar('icinga::icinga_admins') %> # with Icinga 1.5.0 -authorized_for_all_services=<%= scope.lookupvar('icinga::icinga_admins') %> -authorized_for_all_hosts=<%= scope.lookupvar('icinga::icinga_admins') %> +authorized_for_all_services=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> +authorized_for_all_hosts=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> # GLOBAL HOST/SERVICE COMMAND ACCESS @@ -187,8 +187,8 @@ authorized_for_all_hosts=<%= scope.lookupvar('icinga::icinga_admins') %> # Alternatively you can specify contactgroups too, starting # with Icinga 1.5.0 -authorized_for_all_service_commands=<%= scope.lookupvar('icinga::icinga_admins') %> -authorized_for_all_host_commands=<%= scope.lookupvar('icinga::icinga_admins') %> +authorized_for_all_service_commands=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> +authorized_for_all_host_commands=<%= scope.lookupvar('icinga::icinga_admins').join(",") %> diff --git a/templates/debian/icinga.cfg b/templates/debian/icinga.cfg index f056805..97af307 100644 --- a/templates/debian/icinga.cfg +++ b/templates/debian/icinga.cfg @@ -247,7 +247,7 @@ event_broker_options=-1 # Uncomment this to enable idomod.o # Don't forget to also enable the daemon in /etc/default/icinga -#broker_module=/usr/lib/icinga/idomod.o config_file=/etc/icinga/idomod.cfg +broker_module=/usr/lib/icinga/idomod.so config_file=/etc/icinga/idomod.cfg # LOG ROTATION METHOD # This is the log rotation method that Icinga should use to rotate @@ -1132,7 +1132,7 @@ high_host_flap_threshold=20.0 # strict-iso8601 (YYYY-MM-DDTHH:MM:SS) # -date_format=us +date_format=strict-iso8601 diff --git a/templates/plugins/idoutils/ido2db.cfg.erb b/templates/plugins/idoutils/ido2db.cfg.erb index ae57cbc..40c36c4 100644 --- a/templates/plugins/idoutils/ido2db.cfg.erb +++ b/templates/plugins/idoutils/ido2db.cfg.erb @@ -13,7 +13,7 @@ # This is the lockfile that IDO2DB will use to store its PID number # in when it is running in daemon mode. -lock_file=/var/run/ido2db.pid +lock_file=<%= scope.lookupvar('icinga::idoutils_lock_file') %> @@ -44,7 +44,7 @@ socket_type=unix # This option is only valid if the socket type specified above # is "unix". -socket_name=/var/spool/icinga/ido.sock +socket_name=<%= scope.lookupvar('icinga::idoutils_socket_name') %> # SOCKET PERMISSIONS @@ -131,7 +131,6 @@ db_port=3306 #db_socket=/var/lib/mysql/mysql.sock - # DATABASE NAME # This option specifies the name of the database that should be used. # @@ -214,7 +213,7 @@ max_acknowledgements_age=44640 # Values: 0 - don't clean # 1 - clean (default) -clean_realtime_tables_on_core_startup=1 +clean_realtime_tables_on_core_startup=<%= scope.lookupvar('icinga::idoutils_clear_tables_at_startup') %> ## CLEAN CONFIG TABLES AT CORE STARTUP @@ -226,7 +225,7 @@ clean_realtime_tables_on_core_startup=1 # Values: 0 - don't clean # 1 - clean (default) -clean_config_tables_on_core_startup=1 +clean_config_tables_on_core_startup=<%= scope.lookupvar('icinga::idoutils_clear_tables_at_startup') %> # ***EXPERIMENTAL*** DB TRIMMING INTERVAL diff --git a/templates/plugins/idoutils/idomod.cfg b/templates/plugins/idoutils/idomod.cfg index f5e6a5a..ded8e11 100644 --- a/templates/plugins/idoutils/idomod.cfg +++ b/templates/plugins/idoutils/idomod.cfg @@ -35,7 +35,7 @@ output_type=unixsocket #output=/var/icinga/ido.dat #output=127.0.0.1 -output=/var/icinga/ido.sock +output=/var/lib/icinga/ido.sock @@ -80,7 +80,7 @@ output_buffer_items=5000 # Icinga (re)starts, the IDO NEB module will read the contents of this # file and send it to the IDO2DB daemon for processing. -buffer_file=/var/icinga/idomod.tmp +buffer_file=/var/lib/icinga/idomod.tmp @@ -236,7 +236,7 @@ debug_verbosity=1 # DEBUG FILE # This option determines where the daemon should write debugging information. -debug_file=/var/icinga/idomod.debug +debug_file=/var/log/icinga/idomod.debug