diff options
33 files changed, 449 insertions, 326 deletions
@@ -31,11 +31,11 @@ Hosts ----- On a node which shall be monitored with nagios, include the "nagios::target". -This just creates a host declaration for this host's "$ipaddress" fact. If -the $ipaddress of your target is not the one you wish to modify, you can use -"nagios::target::fqdn" instead, which will use the $fqdn fact of the host instead. +This just creates a host declaration for this host's "$::ipaddress" fact. If +the $::ipaddress of your target is not the one you wish to modify, you can use +"nagios::target::fqdn" instead, which will use the $::fqdn fact of the host instead. -Set the $nagios_parents variable in the node scope for enabling the reachability +Pass the $parents variable to the target class for enabling the reachability features of nagios. If a node needs more customisation, use the native "@@nagios_host" type directly (the double-ampersand declares the object as an exported resource). @@ -72,14 +72,14 @@ Upgrade Notes The nagios::target bits have been reworked, the notable changes that may affect an upgrade are: -. previous versions had nagios::target::nat which used the $fqdn for +. previous versions had nagios::target::nat which used the $::fqdn for the address part of nagios::target, this has been renamed to nagios::target::fqdn to be more clear. if you were using nagios::target::nat then you will need to change those references to ::fqdn -. previous versions of this module used $fqdn for the nagios::target -address, now it is using $ipaddress. If you need $fqdn, use +. previous versions of this module used $::fqdn for the nagios::target +address, now it is using $::ipaddress. If you need $::fqdn, use nagios::target::fqdn instead of nagios::target . previous versions of nagios_host used the parameter named 'ip', that @@ -132,41 +132,43 @@ See : http://projects.reductivelabs.com/issues/1180 Variables ========= -Options to change the behavior of the nagios module: +Options to change the behavior of the nagios class: -- nagios_allow_external_cmd: Set to true, if you'd like to ensure that your http - daemon can write to the external command file. You - may also need to flip "check_external_commands" in - "nagios.cfg" to enable this functionality. +- allow_external_cmd: Set to true, if you'd like to ensure that your http + daemon can write to the external command file. You + may also need to flip "check_external_commands" in + "nagios.cfg" to enable this functionality. -- nagios_nsa_socket: This optional variable can be used to specify the path to - the socket file that the IRC daemon should use. +For the irc_bot class: -- nagios_nsa_server: When using the IRC bot, this defines the server address of - the IRC network on which the bot will connect. +- nsa_socket: This optional variable can be used to specify the path to + the socket file that the IRC daemon should use. -- nagios_nsa_port: Defines the port number on the IRC server on which the bot - should connect. When this variable is not set, the port used - by default is 6667. +- nsa_server: When using the IRC bot, this defines the server address of + the IRC network on which the bot will connect. -- nagios_nsa_nickname: This is the nickname that the IRC bot will take. +- nsa_port: Defines the port number on the IRC server on which the bot + should connect. When this variable is not set, the port used + by default is 6667. -- nagios_nsa_password: Some networks require a password to connect to them. - This defines such a password. +- nsa_nickname: This is the nickname that the IRC bot will take. -- nagios_nsa_channel: The name of the channel that the IRC bot will join and - will post notifications to. +- nsa_password: Some networks require a password to connect to them. + This defines such a password. -- nagios_nsa_pidfile: This optional variable can be used to define the path to - the file that will contain the process ID of the IRC bot - daemon. -- nagios_nsa_realname: The IRC bot user's real name that will be displayed. By - default, the real name is 'Nagios'. +- nsa_channel: The name of the channel that the IRC bot will join and + will post notifications to. -- nagios_nsa_usenotices: The IRC bot will by default "say" to the channel the - nagios message, but you can switch this variable to - 'notice' if you would prefer them to be sent as IRC - NOTICE messages. +- nsa_pidfile: This optional variable can be used to define the path to + the file that will contain the process ID of the IRC bot + daemon. +- nsa_realname: The IRC bot user's real name that will be displayed. By + default, the real name is 'Nagios'. + +- nsa_usenotices: The IRC bot will by default "say" to the channel the + nagios message, but you can switch this variable to + 'notice' if you would prefer them to be sent as IRC + NOTICE messages. Examples ======== @@ -202,9 +204,10 @@ $HOSTADDRESS$' node target { - # Monitor th () is host - $nagios_parents = 'router01' - include nagios::target + # Monitor this host + class{'nagios::target': + parents = 'router01' + } # monitor a service $apache2_port = 8080 diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login new file mode 100644 index 0000000..dac0e1f --- /dev/null +++ b/files/plugins/check_jabber_login @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'rubygems' +require 'xmpp4r' + + +def usage + puts "#{$0} jabberid password" + exit 3 +end + +usage unless ARGV.size == 2 + +begin + my_client = Jabber::Client.new(ARGV[0]) + my_client.connect + my_client.auth(ARGV[1]) +rescue Jabber::ClientAuthenticationFailure => detail + puts "CRITICAL: Login Error" + exit 2 +rescue Errno::ECONNREFUSED => detail + puts "CRITICAL: Connection refused" + exit 2 +rescue SocketError => detail + puts "CRITICAL: Socket Error" + exit 2 +#rescue +# puts "CRITICAL: Unknown Error" +# exit 2 +end +puts "OK: Login for #{ARGV[0]} successfull" diff --git a/manifests/apache.pp b/manifests/apache.pp index 2c8efa6..a90d0ee 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,21 +1,29 @@ -class nagios::apache inherits ::apache { - $nagios_httpd = 'apache' - include nagios +class nagios::apache( + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false +) { + class{'nagios': + httpd => 'apache', + allow_external_cmd => $allow_external_cmd, + manage_munin => $manage_munin, + manage_shorewall => $manage_shorewall, + } - case $::operatingsystem { - 'debian': { - file { "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf": - ensure => present, - source => ["puppet:///site_nagios/configs/${fqdn}/apache2.conf", - "puppet:///site_nagios/configs/apache2.conf", - "puppet:///nagios/configs/apache2.conf"], - } + case $::operatingsystem { + 'debian': { + file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf": + ensure => present, + source => [ "puppet:///site_nagios/configs/${::fqdn}/apache2.conf", + "puppet:///site_nagios/configs/apache2.conf", + "puppet:///nagios/configs/apache2.conf"], + } - apache::config::global { "nagios3.conf": - ensure => link, - target => "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf", - require => File["${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf"], - } - } + apache::config::global { "nagios3.conf": + ensure => link, + target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf", + require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"], + } } + } } diff --git a/manifests/base.pp b/manifests/base.pp index 28474f9..c4ba260 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -4,7 +4,7 @@ class nagios::base { package { 'nagios': alias => 'nagios', - ensure => present, + ensure => present, } service { 'nagios': @@ -16,26 +16,26 @@ class nagios::base { # this file should contain all the nagios_puppet-paths: file { 'nagios_main_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/nagios.cfg", - source => [ "puppet:///modules/site_nagios/configs/${fqdn}/nagios.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/nagios.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/nagios.cfg", "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios.cfg", "puppet:///modules/site_nagios/configs/nagios.cfg", "puppet:///modules/nagios/configs/${::operatingsystem}/nagios.cfg", "puppet:///modules/nagios/configs/nagios.cfg" ], notify => Service['nagios'], mode => 0644, owner => root, group => root; - } + } file { 'nagios_commands_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/commands.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/commands.cfg", ensure => present, notify => Service['nagios'], mode => 0644, owner => root, group => root; } file { 'nagios_cgi_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/cgi.cfg", - source => [ "puppet:///modules/site_nagios/configs/${fqdn}/cgi.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/cgi.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/cgi.cfg", "puppet:///modules/site_nagios/configs/${::operatingsystem}/cgi.cfg", "puppet:///modules/site_nagios/configs/cgi.cfg", "puppet:///modules/nagios/configs/${::operatingsystem}/cgi.cfg", @@ -45,14 +45,14 @@ class nagios::base { } file { 'nagios_htpasswd': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/htpasswd.users", + path => "${nagios::defaults::vars::int_cfgdir}/htpasswd.users", source => [ "puppet:///modules/site_nagios/htpasswd.users", "puppet:///modules/nagios/htpasswd.users" ], mode => 0640, owner => root, group => apache; } file { 'nagios_private': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/", + path => "${nagios::defaults::vars::int_cfgdir}/private/", ensure => directory, purge => true, recurse => true, @@ -61,7 +61,7 @@ class nagios::base { } file { 'nagios_private_resource_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/resource.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/private/resource.cfg", source => [ "puppet:///modules/site_nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", "puppet:///modules/nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}" ], notify => Service['nagios'], @@ -69,15 +69,13 @@ class nagios::base { } file { 'nagios_confd': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/", + path => "${nagios::defaults::vars::int_cfgdir}/conf.d/", ensure => directory, purge => true, recurse => true, notify => Service['nagios'], mode => '0750', owner => root, group => nagios; } - Package <<| tag == 'nagios::plugin::deploy::package' |>> - File <<| tag == 'nagios::plugin::deploy::file' |>> Nagios_command <<||>> Nagios_contactgroup <<||>> Nagios_contact <<||>> @@ -92,91 +90,90 @@ class nagios::base { Nagios_serviceextinfo <<||>> Nagios_service <<||>> Nagios_timeperiod <<||>> - File <<| tag == 'nagios_plugin' |>> Nagios_command <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contact <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contactgroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_host <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostdependency <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", notify => Service['nagios'], } Nagios_hostescalation <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", notify => Service['nagios'], } Nagios_hostextinfo <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostgroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_service <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_servicegroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", notify => Service['nagios'], } Nagios_servicedependency <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceescalation <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceextinfo <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_timeperiod <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg", require => File['nagios_confd'], notify => Service['nagios'], } - file{[ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: + file{[ "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: ensure => file, replace => false, notify => Service['nagios'], @@ -186,16 +183,11 @@ class nagios::base { # manage nagios cfg files # must be defined after exported resource overrides and cfg file defs file { 'nagios_cfgdir': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/", + path => "${nagios::defaults::vars::int_cfgdir}/", ensure => directory, recurse => true, purge => true, notify => Service['nagios'], mode => 0755, owner => root, group => root; } - - if $use_munin { - include nagios::munin - } - } diff --git a/manifests/centos.pp b/manifests/centos.pp index 35379b8..5a2ba23 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -9,7 +9,7 @@ class nagios::centos inherits nagios::base { hasstatus => true, } - if ($nagios_allow_external_cmd) { + if $nagios::allow_external_cmd { file { '/var/spool/nagios/cmd': ensure => 'directory', require => Package['nagios'], diff --git a/manifests/debian.pp b/manifests/debian.pp index b9e87ec..bb9bb38 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -14,13 +14,13 @@ class nagios::debian inherits nagios::base { File['nagios_htpasswd', 'nagios_cgi_cfg'] { group => 'www-data' } - file { "${nagios::defaults::vars::int_nagios_cfgdir}/stylesheets": + file { "${nagios::defaults::vars::int_cfgdir}/stylesheets": ensure => directory, purge => false, recurse => true, } - if ($nagios_allow_external_cmd) { + if $nagios::allow_external_cmd { exec { 'nagios_external_cmd_perms_overrides': command => 'dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3', unless => 'dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3', diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index aefed8a..bb19638 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -66,7 +66,7 @@ class nagios::defaults::commands { check_http_url: command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; check_http_url_regex: - command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$'; + command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -e $ARG4$'; check_https_url: command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; check_https_url_regex: diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index 18f8161..abd8b52 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -1,5 +1,4 @@ class nagios::defaults::plugins { - nagios::plugin { 'check_mysql_health': source => 'nagios/plugins/check_mysql_health'; @@ -8,5 +7,4 @@ class nagios::defaults::plugins { 'check_dnsbl': source => 'nagios/plugins/check_dnsbl'; } - } diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp index 57718cd..9711dd4 100644 --- a/manifests/defaults/templates.pp +++ b/manifests/defaults/templates.pp @@ -1,15 +1,14 @@ class nagios::defaults::templates { - include nagios::defaults::vars - - file { 'nagios_templates': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_templates.cfg", - source => [ "puppet:///modules/site_nagios/configs/${fqdn}/nagios_templates.cfg", - "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios_templates.cfg", - "puppet:///modules/site_nagios/configs/nagios_templates.cfg", - "puppet:///modules/nagios/configs/${::operatingsystem}/nagios_templates.cfg", - "puppet:///modules/nagios/configs/nagios_templates.cfg" ], - notify => Service['nagios'], - mode => 0644, owner => root, group => root; - } + include nagios::defaults::vars + file { 'nagios_templates': + path => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_templates.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/nagios_templates.cfg", + "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios_templates.cfg", + "puppet:///modules/site_nagios/configs/nagios_templates.cfg", + "puppet:///modules/nagios/configs/${::operatingsystem}/nagios_templates.cfg", + "puppet:///modules/nagios/configs/nagios_templates.cfg" ], + notify => Service['nagios'], + mode => 0644, owner => root, group => root; + } } diff --git a/manifests/defaults/vars.pp b/manifests/defaults/vars.pp index b0aef57..87f41f8 100644 --- a/manifests/defaults/vars.pp +++ b/manifests/defaults/vars.pp @@ -1,10 +1,10 @@ class nagios::defaults::vars { - case $nagios_cfgdir { - '': { $int_nagios_cfgdir = $::operatingsystem ? { + case $nagios::cfgdir { + '': { $int_cfgdir = $::operatingsystem ? { centos => '/etc/nagios/', default => '/etc/nagios3' } } - default: { $int_nagios_cfgdir = $nagios_cfgdir } + default: { $int_cfgdir = $nagios::cfgdir } } } diff --git a/manifests/init.pp b/manifests/init.pp index 5050b69..5cbd3f3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,28 +8,37 @@ # Marcel Härry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License version 3 as published by +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by # the Free Software Foundation. # -class nagios { - case $nagios_httpd { - 'absent': { } - 'lighttpd': { include lighttpd } - 'apache': { include apache } - default: { include apache } +# manage nagios +class nagios( + $httpd = 'apache', + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false +) { + case $nagios::httpd { + 'absent': { } + 'lighttpd': { include ::lighttpd } + 'apache': { include ::apache } + default: { include ::apache } + } + case $::operatingsystem { + 'centos': { + $cfgdir = '/etc/nagios' + include nagios::centos } - case $::operatingsystem { - 'centos': { - $nagios_cfgdir = '/etc/nagios' - include nagios::centos - } - 'debian': { - $nagios_cfgdir = '/etc/nagios3' - include nagios::debian - } - default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } + 'debian': { + $cfgdir = '/etc/nagios3' + include nagios::debian } + default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } + } + if $manage_munin { + include nagios::munin + } } diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index ea8d79b..88d769c 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -1,22 +1,51 @@ -class nagios::irc_bot { - if ( ! ($nagios_nsa_server and $nagios_nsa_nickname and $nagios_nsa_channel) ) { - fail("Please provide values at least for \$nagios_nsa_server, \$nagios_nsa_nickname and \$nagios_nsa_channel") +<<<<<<< HEAD +class nagios::irc_bot( + $nsa_socket = 'absent', + $nsa_server, + $nsa_port = 6667, + $nsa_nickname, + $nsa_password = '', + $nsa_channel, + $nsa_pidfile = 'absent', + $nsa_realname = 'Nagios', + $nsa_usenotices = false, + $nsa_commandfile = 'absent' +) { + $real_nsa_socket = $nsa_socket ? { + 'absent' => $::operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.socket', + default => '/var/run/nagios3/nsa.socket' + }, + default => $nsa_socket, + } + $real_nsa_pidfile = $nsa_pidfile ? { + 'absent' => $::operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.pid', + default => '/var/run/nagios3/nsa.pid' + }, + default => $nsa_pidfile, + } + $real_nsa_commandfile = $nsa_commandfile ? { + 'absent' => $::operatingsystem ? { + centos => '/var/spool/nagios/cmd/nagios.cmd', + default => '/var/lib/nagios3/rw/nagios.cmd' + }, + default => $nsa_commandfile, } case $::operatingsystem { centos: { - $nagios_nsa_default_socket = '/var/run/nagios-nsa/nsa.socket' - $nagios_nsa_default_pidfile = '/var/run/nagios-nsa/nsa.pid' include nagios::irc_bot::centos } + debian,ubuntu: { + include nagios::irc_bot::debian + } default: { - $nagios_nsa_default_socket = '/var/run/nagios3/nsa.socket' - $nagios_nsa_default_pidfile = '/var/run/nagios3/nsa.pid' include nagios::irc_bot::base } } - if $use_shorewall { + if $nagios::manage_shorewall { include shorewall::rules::out::irc } } diff --git a/manifests/irc_bot/base.pp b/manifests/irc_bot/base.pp index ee3ea39..5014bcb 100644 --- a/manifests/irc_bot/base.pp +++ b/manifests/irc_bot/base.pp @@ -1,69 +1,37 @@ class nagios::irc_bot::base { + file { + '/usr/local/bin/riseup-nagios-client.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl', + owner => root, group => root, mode => 0755; + '/usr/local/bin/riseup-nagios-server.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl', + owner => root, group => root, mode => 0755; + '/etc/init.d/nagios-nsa': + content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), + require => File['/usr/local/bin/riseup-nagios-server.pl'], + owner => root, group => root, mode => 0755; + '/etc/nagios_nsa.cfg': + ensure => present, + content => template('nagios/irc_bot/nsa.cfg.erb'), + owner => nagios, group => root, mode => 0400; + } - # Default values for the two first variables are defined in nagios::irc_bot - $nagios_nsa_socket = $nagios_nsa_socket ? { - '' => $nagios_nsa_default_socket, - default => $nagios_nsa_socket, - } - $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { - '' => $nagios_nsa_default_pidfile, - default => $nagios_nsa_pidfile, - } - $nagios_nsa_port = $nagios_nsa_port ? { - '' => '6667', - default => $nagios_nsa_port, - } - $nagios_nsa_realname = $nagios_nsa_realname ? { - '' => 'Nagios', - default => $nagios_nsa_realname, - } + package { 'libnet-irc-perl': + ensure => present, + } - if (! $nagios_nsa_password) { - $nagios_nsa_password = '' - } + service { "nagios-nsa": + ensure => "running", + hasstatus => true, + require => [ File["/etc/nagios_nsa.cfg"], + Package["libnet-irc-perl"], + Service['nagios'] ], + } - if (! $nagios_nsa_usenotices) { - $nagios_nsa_usenotices = '' - } - - file { "/usr/local/bin/riseup-nagios-client.pl": - owner => root, group => 0, mode => 0755, - source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl", - } - file { "/usr/local/bin/riseup-nagios-server.pl": - owner => root, group => 0, mode => 0755, - source => "puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl", - } - file { "/etc/init.d/nagios-nsa": - owner => root, group => 0, mode => 0755, - content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), - require => File["/usr/local/bin/riseup-nagios-server.pl"], - } - file { "/etc/nagios_nsa.cfg": - ensure => present, - owner => nagios, group => 0, mode => 0400, - content => template('nagios/irc_bot/nsa.cfg.erb'), - notify => Service["nagios-nsa"], - } - - package { "libnet-irc-perl": - ensure => present, - } - - service { "nagios-nsa": - ensure => "running", - hasstatus => true, - enable => true, - require => [File["/etc/nagios_nsa.cfg"], - File["/etc/init.d/nagios-nsa"], - Package["libnet-irc-perl"], - Service['nagios'] ], - } - - nagios_command { - "notify-by-irc": - command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ $SERVICEATTEMPT$/$MAXSERVICEATTEMPTS$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; - "host-notify-by-irc": - command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ $HOSTATTEMPT$/$MAXHOSTATTEMPTS$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; - } + nagios_command { + 'notify-by-irc': + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; + 'host-notify-by-irc': + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; + } } diff --git a/manifests/irc_bot/centos.pp b/manifests/irc_bot/centos.pp index e77e93a..d7b1906 100644 --- a/manifests/irc_bot/centos.pp +++ b/manifests/irc_bot/centos.pp @@ -1,7 +1,9 @@ class nagios::irc_bot::centos inherits nagios::irc_bot::base { + Package['libnet-irc-perl']{ + name => 'perl-Net-IRC', + } - Package['libnet-irc-perl']{ - name => 'perl-Net-IRC', - } - + Service['nagios-nsa']{ + enable => true, + } } diff --git a/manifests/irc_bot/debian.pp b/manifests/irc_bot/debian.pp new file mode 100644 index 0000000..93ea64b --- /dev/null +++ b/manifests/irc_bot/debian.pp @@ -0,0 +1,8 @@ +class nagios::irc_bot::debian inherits nagios::irc_bot::base { + exec { "nagios_nsa_init_script": + command => "/usr/sbin/update-rc.d nagios-nsa defaults", + unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", + require => File["/etc/init.d/nagios-nsa"], + before => Service['nagios-nsa'], + } +} diff --git a/manifests/lighttpd.pp b/manifests/lighttpd.pp index 27aff43..0f29896 100644 --- a/manifests/lighttpd.pp +++ b/manifests/lighttpd.pp @@ -1,4 +1,12 @@ -class nagios::lighttpd { - $nagios_httpd = 'lighttpd' - include nagios +class nagios::lighttpd( + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false +) { + class{'nagios': + httpd => 'lighttpd', + allow_external_cmd => $allow_external_cmd, + manage_munin => $manage_munin, + manage_shorewall => $manage_shorewall, + } } diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp index 403f5ec..e58721d 100644 --- a/manifests/nsca/client.pp +++ b/manifests/nsca/client.pp @@ -1,9 +1,9 @@ class nagios::nsca::client { package { 'nsca': ensure => installed } - + file { '/etc/send_nsca.cfg': - source => [ "puppet:///modules/site_nagios/nsca/{$fqdn}/send_nsca.cfg", + source => [ "puppet:///modules/site_nagios/nsca/{$::fqdn}/send_nsca.cfg", "puppet:///modules/site_nagios/nsca/send_nsca.cfg", "puppet:///modules/nagios/nsca/send_nsca.cfg" ], owner => 'nagios', diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp index 26f7e3b..8ba0116 100644 --- a/manifests/nsca/server.pp +++ b/manifests/nsca/server.pp @@ -1,15 +1,15 @@ class nagios::nsca::server { package { 'nsca': ensure => installed } - + service { 'nsca': ensure => running, hasstatus => false, hasrestart => true, } - + file { '/etc/nsca.cfg': - source => [ "puppet:///modules/site_nagios/nsca/{$fqdn}/nsca.cfg", + source => [ "puppet:///modules/site_nagios/nsca/{$::fqdn}/nsca.cfg", "puppet:///modules/site_nagios/nsca/nsca.cfg", "puppet:///modules/nagios/nsca/nsca.cfg" ], owner => 'nagios', @@ -17,5 +17,5 @@ class nagios::nsca::server { mode => '400', notify => Service['nsca'], } - + } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index abaa6e5..d32606b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -2,15 +2,15 @@ define nagios::plugin( $source = 'absent', $ensure = present ){ - @@file{$name: - path => $hardwaremodel ? { - 'x86_64' => "/usr/lib64/nagios/plugins/$name", - default => "/usr/lib/nagios/plugins/$name", + file{$name: + path => $::hardwaremodel ? { + 'x86_64' => "/usr/lib64/nagios/plugins/${name}", + default => "/usr/lib/nagios/plugins/${name}", }, ensure => $ensure, source => $source ? { - 'absent' => "puppet:///modules/nagios/plugins/$name", - default => "puppet:///modules/$source" + 'absent' => "puppet:///modules/nagios/plugins/${name}", + default => "puppet:///modules/${source}" }, tag => 'nagios_plugin', require => Package['nagios-plugins'], diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 75f87d7..3f2a1a4 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -5,26 +5,26 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ default => $ensure } $real_source = $source ? { - '' => "nagios/plugins/$plugin_src", + '' => "nagios/plugins/${plugin_src}", default => $source } if !defined(Package[$require_package]) { - @@package { $require_package: + package { $require_package: ensure => installed, tag => "nagios::plugin::deploy::package"; } } - + include nagios::plugin::scriptpaths - @@file { "nagios_plugin_${name}": + file { "nagios_plugin_${name}": path => "$nagios::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/modules/$real_source", + source => "puppet:///modules/${real_source}", mode => 0755, owner => root, group => 0, require => Package[$require_package], tag => "nagios::plugin::deploy::file"; } # register the plugin - @@nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } + nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 6065709..9cd4b5d 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,5 +1,5 @@ class nagios::plugin::scriptpaths { - case $hardwaremodel { + case $::hardwaremodel { x86_64: { $script_path = "/usr/lib64/nagios/plugins/" } default: { $script_path = "/usr/lib/nagios/plugins" } } diff --git a/manifests/plugins/jabber.pp b/manifests/plugins/jabber.pp new file mode 100644 index 0000000..380a5c0 --- /dev/null +++ b/manifests/plugins/jabber.pp @@ -0,0 +1,10 @@ +class nagios::plugins::jabber { + + # for check_jabber_login + require rubygems::xmpp4r + + nagios::plugin { 'check_jabber_login': + source => 'nagios/plugins/check_jabber_login' + } +} + diff --git a/manifests/service.pp b/manifests/service.pp index a739317..9eb993e 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,65 +1,74 @@ define nagios::service ( - $ensure = present, - $host_name = $::fqdn, - $check_command, - $check_period = '', - $normal_check_interval = '', - $retry_check_interval = '', - $max_check_attempts = '', - $notification_interval = '', - $notification_period = '', - $notification_options = '', - $contact_groups = '', - $use = 'generic-service', - $service_description = 'absent' ) + $ensure = present, + $host_name = $::fqdn, + $check_command = 'absent', + $check_period = '', + $normal_check_interval = '', + $retry_check_interval = '', + $max_check_attempts = '', + $notification_interval = '', + $notification_period = '', + $notification_options = '', + $contact_groups = '', + $use = 'generic-service', + $service_description = 'absent' ) { - # TODO: this resource should normally accept all nagios_host parameters + # TODO: this resource should normally accept all nagios_host parameters - $real_name = "${::hostname}_${name}" + $real_name = "${::hostname}_${name}" - @@nagios_service { "${real_name}": - ensure => $ensure, - check_command => $check_command, - host_name => $host_name, - use => $use, - notify => Service[nagios], - service_description => $service_description ?{ - 'absent' => $name, - default => $service_description - } + @@nagios_service { "${real_name}": + ensure => $ensure, + notify => Service[nagios]; + } + + if $ensure != 'absent' { + if $check_comand == 'absent' { + fail("Must pass a check_command to ${name} if it should be present") } - if ($check_period != '') { - Nagios_service["${real_name}"] { check_period => $check_period } + Nagios_service["${real_name}"] { + check_command => $check_command, + host_name => $host_name, + use => $use, + service_description => $service_description ?{ + 'absent' => $name, + default => $service_description + } } + if ($check_period != '') { + Nagios_service["${real_name}"] { check_period => $check_period } + } + if ($normal_check_interval != '') { - Nagios_service["${real_name}"] { normal_check_interval => $normal_check_interval } + Nagios_service["${real_name}"] { normal_check_interval => $normal_check_interval } } - + if ($retry_check_interval != '') { - Nagios_service["${real_name}"] { retry_check_interval => $retry_check_interval } + Nagios_service["${real_name}"] { retry_check_interval => $retry_check_interval } } - + if ($max_check_attempts != '') { - Nagios_service["${real_name}"] { max_check_attempts => $max_check_attempts } + Nagios_service["${real_name}"] { max_check_attempts => $max_check_attempts } } - + if ($notification_interval != '') { - Nagios_service["${real_name}"] { notification_interval => $notification_interval } + Nagios_service["${real_name}"] { notification_interval => $notification_interval } } - + if ($notification_period != '') { - Nagios_service["${real_name}"] { notification_period => $notification_period } + Nagios_service["${real_name}"] { notification_period => $notification_period } } - + if ($notification_options != '') { - Nagios_service["${real_name}"] { notification_options => $notification_options } + Nagios_service["${real_name}"] { notification_options => $notification_options } } - + if ($contact_groups != '') { - Nagios_service["${real_name}"] { contact_groups => $contact_groups } + Nagios_service["${real_name}"] { contact_groups => $contact_groups } } + } } diff --git a/manifests/service/dns.pp b/manifests/service/dns.pp new file mode 100644 index 0000000..5ef6e3e --- /dev/null +++ b/manifests/service/dns.pp @@ -0,0 +1,19 @@ +define nagios::service::dns( + $host_name = $::fqdn, + $comment = $name, + $check_domain = $name, + $ip +){ + if $name != $comment { + $check_name = "${comment}_${name}_${::hostname}" + } else { + $check_name = "${name}_${::hostname}" + } + + nagios::service{ + $check_name: + check_command => "check_dns2!${check_domain}!${ip}", + host_name => $host_name, + service_description => "check if ${::host_name} is resolving ${check_domain}"; + } +} diff --git a/manifests/service/dns_host.pp b/manifests/service/dns_host.pp new file mode 100644 index 0000000..d88f373 --- /dev/null +++ b/manifests/service/dns_host.pp @@ -0,0 +1,22 @@ +# add a special host and monitor +# it's dns service +define nagios::service::dns_host( + $check_domain, + $host_alias, + $parent, + $ip +){ + @@nagios_host{$name: + address => $ip, + alias => $host_alias, + use => 'generic-host', + parents => $parent, + } + + nagios::service::dns{$name: + host_name => $name, + comment => 'public_ns', + check_domain => $check_domain, + ip => $ip, + } +} diff --git a/manifests/service/http.pp b/manifests/service/http.pp index 8fd5059..ef63abb 100644 --- a/manifests/service/http.pp +++ b/manifests/service/http.pp @@ -6,6 +6,7 @@ define nagios::service::http( $ensure = present, $check_domain = 'absent', + $port = '80', $check_url = '/', $check_code = 'OK', $use = 'generic-service', @@ -27,7 +28,7 @@ define nagios::service::http( nagios::service{"httprd_${name}": ensure => $ensure, use => $use, - check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'", + check_command => "check_http_url_regex!${real_check_domain}!${port}!${check_url}!'301'", } } } @@ -38,7 +39,7 @@ define nagios::service::http( nagios::service{"http_${name}_${check_code}": ensure => $ensure, use => $use, - check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'", + check_command => "check_http_url_regex!${real_check_domain}!${port}!${check_url}!'${check_code}'", } } } diff --git a/manifests/service/ntp.pp b/manifests/service/ntp.pp index eca255a..b3cde2a 100644 --- a/manifests/service/ntp.pp +++ b/manifests/service/ntp.pp @@ -1,9 +1,9 @@ # manifests/service/ntp.pp class nagios::service::ntp { - nagios::service{ "check_ntp": - check_command => "check_ntp_time", - host_name => $fqdn, - } + nagios::service{ "check_ntp": + check_command => "check_ntp_time", + host_name => $::fqdn, + } } diff --git a/manifests/service/ping.pp b/manifests/service/ping.pp index c705c68..f1c8d87 100644 --- a/manifests/service/ping.pp +++ b/manifests/service/ping.pp @@ -1,13 +1,9 @@ define nagios::service::ping( - $ensure = present + $ensure = present, + $ping_rate = '!100.0,20%!500.0,60%' ){ - $real_nagios_ping_rate = $nagios_ping_rate ? { - '' => '!100.0,20%!500.0,60%', - default => $nagios_ping_rate - } - - nagios::service{ "check_ping": - ensure => $ensure, - check_command => "check_ping${real_nagios_ping_rate}", - } + nagios::service{ "check_ping": + ensure => $ensure, + check_command => "check_ping${ping_rate}", + } } diff --git a/manifests/target.pp b/manifests/target.pp index 675ac1a..f9b7e13 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -1,15 +1,22 @@ # manifests/target.pp -class nagios::target { +class nagios::target( + $parents = 'absent', + $address = $::ipaddress, + $nagios_alias = $::hostname, + $hostgroups = 'absent' +){ + @@nagios_host { $::fqdn: + address => $address, + alias => $nagios_alias, + use => 'generic-host', + } - @@nagios_host { "${fqdn}": - address => $ipaddress, - alias => $hostname, - use => 'generic-host', - } - - if ($nagios_parents != '') { - Nagios_host["${fqdn}"] { parents => $nagios_parents } - } + if ($parents != 'absent') { + Nagios_host["${::fqdn}"] { parents => $parents } + } + if ($hostgroups != 'absent') { + Nagios_host["${::fqdn}"] { hostgroups => $hostgroups } + } } diff --git a/manifests/target/fqdn.pp b/manifests/target/fqdn.pp index acac5d6..6bb16c1 100644 --- a/manifests/target/fqdn.pp +++ b/manifests/target/fqdn.pp @@ -1,5 +1,10 @@ -class nagios::target::fqdn inherits nagios::target { - - Nagios_host["${fqdn}"] { address => "${fqdn}" } - +class nagios::target::fqdn( + $hostgroups = 'absent', + $parents = 'absent' +) { + class{'nagios::target': + address => $::fqdn, + hostgroups => $hostgroups, + parents => $parents + } } diff --git a/templates/irc_bot/CentOS/nagios-nsa.sh.erb b/templates/irc_bot/CentOS/nagios-nsa.sh.erb index 1561afd..0f9f87b 100644 --- a/templates/irc_bot/CentOS/nagios-nsa.sh.erb +++ b/templates/irc_bot/CentOS/nagios-nsa.sh.erb @@ -19,8 +19,8 @@ exec="/usr/local/bin/riseup-nagios-server.pl" prog="nsa" -PIDFILE=<%= nagios_nsa_pidfile %> -SOCKFILE=<%= nagios_nsa_socket %> +PIDFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %> +SOCKFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %> [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog diff --git a/templates/irc_bot/Debian/nagios-nsa.sh.erb b/templates/irc_bot/Debian/nagios-nsa.sh.erb index c9d1966..43c0e79 100644 --- a/templates/irc_bot/Debian/nagios-nsa.sh.erb +++ b/templates/irc_bot/Debian/nagios-nsa.sh.erb @@ -9,8 +9,8 @@ # Short-Description: Nagios Simple IRC Agent ### END INIT INFO -PIDFILE=<%= nagios_nsa_pidfile %> -SOCKFILE=<%= nagios_nsa_socket %> +PIDFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %> +SOCKFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %> . /lib/lsb/init-functions diff --git a/templates/irc_bot/nsa.cfg.erb b/templates/irc_bot/nsa.cfg.erb index 41e6319..5dd7d0e 100644 --- a/templates/irc_bot/nsa.cfg.erb +++ b/templates/irc_bot/nsa.cfg.erb @@ -1,15 +1,15 @@ -%Nsa = ( - 'socket' => '<%= nagios_nsa_socket %>', - 'server' => '<%= nagios_nsa_server %>', - 'port' => '<%= nagios_nsa_port %>', - 'nickname' => '<%= nagios_nsa_nickname %>', - 'password' => '<%= nagios_nsa_password %>', +%%Nsa = ( + 'socket' => '<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %>', + 'server' => '<%= scope.lookupvar('nagios::irc_bot::nsa_server') %>', + 'port' => '<%= scope.lookupvar('nagios::irc_bot::nsa_port') %>', + 'nickname' => '<%= scope.lookupvar('nagios::irc_bot::nsa_nickname') %>', + 'password' => '<%= scope.lookupvar('nagios::irc_bot::nsa_password') %>', # this needs libio-socket-ssl-perl # doesn't actually works because Net::IRC is braindead and tries to use IO::Socket::SSL->read/write instead of the builtin print, see http://search.cpan.org/dist/IO-Socket-SSL/SSL.pm - #'SSL' => 0, - 'channel' => '<%= nagios_nsa_channel %>', - 'pidfile' => '<%= nagios_nsa_pidfile %>', # set to undef to disable - 'realname' => "<%= nagios_nsa_realname %>", - 'usenotices' => "<%= nagios_nsa_usenotices %>", - 'commandfile' => '/var/lib/nagios3/rw/nagios.cmd', + #'SSL' => 0, + 'channel' => '<%= scope.lookupvar('nagios::irc_bot::nsa_channel') %>', + 'pidfile' => '<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %>', # set to undef to disable + 'realname' => "<%= scope.lookupvar('nagios::irc_bot::nsa_realname') %>", + 'usenotices' => "<%= scope.lookupvar('nagios::irc_bot::nsa_usenotices') %>", + 'commandfile' => "<%= scope.lookupvar('nagios::irc_bot::real_nsa_commandfile') %>", ); |