summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-04-25 12:06:44 -0400
committerMicah Anderson <micah@riseup.net>2013-04-25 12:06:44 -0400
commit7d910cc66ea98fea4e83a3d1003bb7c3a0c6a7ce (patch)
treeeaf8ac5503880e64d9d8e0e5c415ccc836e1aa81
parent57a1140b437a8cfb9cfd5d94a5759b1e3ed86d45 (diff)
parenta814cdad2b1ff47066df4c8b5d948f22210c0832 (diff)
Merge branch 'master' into leap
Conflicts: README README.pnp4nagios manifests/defaults/pnp4nagios.pp manifests/munin.pp manifests/pnp4nagios.pp manifests/pnp4nagios/popup.pp
-rw-r--r--README22
-rw-r--r--README.pnp4nagios16
-rw-r--r--files/munin/nagios_hosts10
-rw-r--r--files/munin/nagios_perf8
-rw-r--r--files/munin/nagios_svc12
-rw-r--r--manifests/defaults/pnp4nagios.pp17
-rw-r--r--manifests/headless.pp5
-rw-r--r--manifests/munin.pp41
-rw-r--r--manifests/pnp4nagios.pp68
-rw-r--r--manifests/pnp4nagios/popup.pp16
10 files changed, 103 insertions, 112 deletions
diff --git a/README b/README
index 7fd1f02..90a97c6 100644
--- a/README
+++ b/README
@@ -185,30 +185,10 @@ For the irc_bot class:
'notice' if you would prefer them to be sent as IRC
NOTICE messages.
-
-PNP4Nagios Nagios Grapher integration
-=====================================
-
-see README.pnp4nagios
-
PNP4Nagios integration
======================
-Currently, there are no pnp4nagios debian packages - you need to install pnp4nagios
-from source. See http://docs.pnp4nagios.org/pnp-0.6/start for installation notes.
-Integration in the nagios/icinga webinterface is configured by including either the
-nagios::pnp4nagios or the nagios::pnp4nagios::popup class, the later one includes
-fancy popups when you hoover over the extra service action image.
-For hosts you need to use the host-pnp definition, for services the srv-pnp def.
-i.e.
-
- @@nagios_service { "ping_example_node":
- use => "generic-service,srv-pnp",
- ...
-
- nagios_host { 'example_node':
- use => 'generic-host,host-pnp',
- ...
+For PNP4Nagios integration information, please see README.pnp4nagios
Examples
========
diff --git a/README.pnp4nagios b/README.pnp4nagios
index ac929e9..dd40702 100644
--- a/README.pnp4nagios
+++ b/README.pnp4nagios
@@ -3,6 +3,22 @@ PNP4Nagios integration
As of 2012/01 debian packages for pnp4nagios are availible from lenny-backports on.
+See http://docs.pnp4nagios.org/pnp-0.6/start for installation notes.
+
+Integration in the nagios/icinga webinterface is configured by including either
+the nagios::pnp4nagios or the nagios::pnp4nagios::popup class, the later one
+includes fancy popups when you hoover over the extra service action image. For
+hosts you need to use the host-pnp definition, for services the srv-pnp def.
+i.e.
+
+ @@nagios_service { "ping_example_node":
+ use => "generic-service,srv-pnp",
+ ...
+
+ nagios_host { 'example_node':
+ use => 'generic-host,host-pnp',
+ ...
+
In the default config files the "Bulk Mode with NPCD" is used
(see http://docs.pnp4nagios.org/en/pnp-0.6/config for more infos about the different
modes).
diff --git a/files/munin/nagios_hosts b/files/munin/nagios_hosts
index fa8f9dc..3fa00f1 100644
--- a/files/munin/nagios_hosts
+++ b/files/munin/nagios_hosts
@@ -1,5 +1,9 @@
#!/bin/bash
+if [ -z "$nag_stats_binary" ]; then
+ nag_stats_binary=/usr/sbin/nagios3stats
+fi
+
if [ "$1" = "config" ]; then
echo 'graph_title Nagios host stats'
echo 'graph_args --base 1000 -l 0'
@@ -20,9 +24,9 @@ if [ "$1" = "config" ]; then
fi
echo -n 'up.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMHSTUP
+$nag_stats_binary --mrtg --data NUMHSTUP
echo -n 'down.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMHSTDOWN
+$nag_stats_binary --mrtg --data NUMHSTDOWN
echo -n 'unr.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMHSTUNR
+$nag_stats_binary --mrtg --data NUMHSTUNR
diff --git a/files/munin/nagios_perf b/files/munin/nagios_perf
index 35fd9cd..609d62f 100644
--- a/files/munin/nagios_perf
+++ b/files/munin/nagios_perf
@@ -1,5 +1,9 @@
#!/bin/bash
+if [ -z "$nag_stats_binary" ]; then
+ nag_stats_binary=/usr/sbin/nagios3stats
+fi
+
NAME=$(basename $0)
TYPE=${NAME##nagios_perf_}
@@ -30,5 +34,5 @@ if [ "$1" = "config" ]; then
exit 0
fi
-echo "act_lat_$TYPE_ABBR.value " $(/usr/local/sbin/nagiostats --mrtg --data AVGACT${TYPE_ABBR}LAT)
-echo "act_ext_$TYPE_ABBR.value " $(/usr/local/sbin/nagiostats --mrtg --data AVGACT${TYPE_ABBR}EXT)
+echo "act_lat_$TYPE_ABBR.value " $($nag_stats_binary --mrtg --data AVGACT${TYPE_ABBR}LAT)
+echo "act_ext_$TYPE_ABBR.value " $($nag_stats_binary --mrtg --data AVGACT${TYPE_ABBR}EXT)
diff --git a/files/munin/nagios_svc b/files/munin/nagios_svc
index 0a9a9bf..97c8bfc 100644
--- a/files/munin/nagios_svc
+++ b/files/munin/nagios_svc
@@ -1,5 +1,9 @@
#!/bin/bash
+if [ -z "$nag_stats_binary" ]; then
+ nag_stats_binary=/usr/sbin/nagios3stats
+fi
+
if [ "$1" = "config" ]; then
echo 'graph_title Nagios service stats'
echo 'graph_args --base 1000 -l 0'
@@ -23,11 +27,11 @@ if [ "$1" = "config" ]; then
fi
echo -n 'ok.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMSVCOK
+$nag_stats_binary --mrtg --data NUMSVCOK
echo -n 'warn.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMSVCWARN
+$nag_stats_binary --mrtg --data NUMSVCWARN
echo -n 'crit.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMSVCCRIT
+$nag_stats_binary --mrtg --data NUMSVCCRIT
echo -n 'unkn.value '
-/usr/local/sbin/nagiostats --mrtg --data NUMSVCUNKN
+$nag_stats_binary --mrtg --data NUMSVCUNKN
diff --git a/manifests/defaults/pnp4nagios.pp b/manifests/defaults/pnp4nagios.pp
index f6556c9..662d13b 100644
--- a/manifests/defaults/pnp4nagios.pp
+++ b/manifests/defaults/pnp4nagios.pp
@@ -7,21 +7,4 @@ class nagios::defaults::pnp4nagios {
'process-host-perfdata-file-pnp4nagios-bulk-npcd':
command_line => '/bin/mv /var/lib/nagios3/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$'
}
-
- # nagios host templates
- # http://docs.pnp4nagios.org/de/pnp-0.6/webfe
-
- # this doesn't work, see manifests/pnp4nagios.pp
- #nagios_host { 'host-pnp':
- # action_url => '/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_',
- # register => 0,
- # #ensure => absent;
- #}
-
- #nagios_service { 'service-pnp':
- # #naginatorname => 'service-pnp',
- # action_url => '/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$',
- # register => 0,
- # ensure => absent;
- #}
}
diff --git a/manifests/headless.pp b/manifests/headless.pp
index cccfce7..ba8af8f 100644
--- a/manifests/headless.pp
+++ b/manifests/headless.pp
@@ -1,4 +1,5 @@
class nagios::headless {
- $nagios_httpd = 'absent'
- include nagios
+ class { 'nagios':
+ httpd => 'absent',
+ }
}
diff --git a/manifests/munin.pp b/manifests/munin.pp
index 490b016..dc5cc4c 100644
--- a/manifests/munin.pp
+++ b/manifests/munin.pp
@@ -1,28 +1,19 @@
-class nagios::munin inherits munin::plugins::base {
+class nagios::munin {
+ include munin::plugins::base
- munin::plugin::deploy {
- nagios_hosts:
- source => 'nagios/munin/nagios_hosts',
- config => 'user root';
- nagios_svc:
- source => 'nagios/munin/nagios_svc',
- config => 'user root';
- nagios_perf_hosts:
- source => 'nagios/munin/nagios_perf',
- config => 'user root';
- nagios_perf_svc:
- source => 'nagios/munin/nagios_perf',
- config => 'user root';
- }
-
- exec { 'munin_nagios2stats_link':
- command => 'ln -s /usr/sbin/nagios2stats /usr/local/sbin/nagiostats',
- onlyif => ["/usr/bin/test ! -e /usr/local/sbin/nagiostats", "/usr/bin/test -e /usr/sbin/nagios2stats"],
- }
-
- exec { 'munin_nagios3stats_link':
- command => 'ln -s /usr/sbin/nagios3stats /usr/local/sbin/nagiostats',
- onlyif => ["/usr/bin/test ! -e /usr/local/sbin/nagiostats", "/usr/bin/test -e /usr/sbin/nagios3stats"],
- }
+ munin::plugin::deploy {
+ 'nagios_hosts':
+ source => 'nagios/munin/nagios_hosts',
+ config => 'user nagios';
+ 'nagios_svc':
+ source => 'nagios/munin/nagios_svc',
+ config => 'user nagios';
+ 'nagios_perf_hosts':
+ source => 'nagios/munin/nagios_perf',
+ config => 'user nagios';
+ 'nagios_perf_svc':
+ source => 'nagios/munin/nagios_perf',
+ config => 'user nagios';
+ }
}
diff --git a/manifests/pnp4nagios.pp b/manifests/pnp4nagios.pp
index 7c960a7..5ade74f 100644
--- a/manifests/pnp4nagios.pp
+++ b/manifests/pnp4nagios.pp
@@ -1,57 +1,63 @@
class nagios::pnp4nagios {
include nagios::defaults::pnp4nagios
- package { pnp4nagios:
+ package { 'pnp4nagios':
ensure => installed }
- # unfortunatly i didn't find a way to use nagios_host and nagios_service definition, because
- # imho puppet can't handle the "name" variable needed in these 2 definitions
- # so we need to copy a file here.
+ # unfortunatly we can't use the nagios_host and nagios_service
+ # definition to define templates, so we need to copy a file here.
+ # see http://projects.reductivelabs.com/issues/1180 for this limitation
file { 'pnp4nagios-templates.cfg':
- path => "${nagios::defaults::vars::int_cfgdir}/conf.d/pnp4nagios-templates.cfg",
- source => [ "puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-templates.cfg",
- "puppet:///modules/nagios/pnp4nagios/pnp4nagios-templates.cfg" ],
- mode => 0644, owner => root, group => root,
- notify => Service['nagios'],
+ path => "${nagios::defaults::vars::int_cfgdir}/conf.d/pnp4nagios-templates.cfg",
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/pnp4nagios-templates.cfg',
+ 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-templates.cfg' ],
+ mode => '0644',
+ owner => root,
+ group => root,
+ notify => Service['nagios'],
}
-
+
file { 'apache.conf':
- path => "/etc/pnp4nagios/apache.conf",
- source => [ "puppet:///modules/site-nagios/pnp4nagios/apache.conf",
- "puppet:///modules/nagios/pnp4nagios/apache.conf" ],
- mode => 0644, owner => root, group => root,
- notify => Service['apache'],
+ path => '/etc/pnp4nagios/apache.conf',
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/apache.conf',
+ 'puppet:///modules/nagios/pnp4nagios/apache.conf' ],
+ mode => '0644',
+ owner => root,
+ group => root,
+ notify => Service['apache'],
require => Package['pnp4nagios'],
}
# run npcd as daemon
file { '/etc/default/npcd':
- path => "/etc/default/npcd",
- source => [ "puppet:///modules/site-nagios/pnp4nagios/npcd",
- "puppet:///modules/nagios/pnp4nagios/npcd" ],
- mode => 0644, owner => root, group => root,
+ path => '/etc/default/npcd',
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/npcd',
+ 'puppet:///modules/nagios/pnp4nagios/npcd' ],
+ mode => '0644',
+ owner => root,
+ group => root,
notify => Service['npcd'];
}
service { 'npcd':
- ensure => running,
- enable => true,
- hasstatus => true,
- require => Package['pnp4nagios'],
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => Package['pnp4nagios'],
}
-
+
# modify action.gif
-
+
file { '/usr/share/nagios3/htdocs/images/action.gif':
- path => "/usr/share/nagios3/htdocs/images/action.gif",
- source => [ "puppet:///modules/site-nagios/pnp4nagios/action.gif",
- "puppet:///modules/nagios/pnp4nagios/action.gif" ],
- mode => 0644, owner => root, group => root,
+ path => '/usr/share/nagios3/htdocs/images/action.gif',
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/action.gif',
+ 'puppet:///modules/nagios/pnp4nagios/action.gif' ],
+ mode => '0644',
+ owner => root,
+ group => root,
notify => Service['nagios'];
}
-
-
}
diff --git a/manifests/pnp4nagios/popup.pp b/manifests/pnp4nagios/popup.pp
index a8de7c7..0dc04b0 100644
--- a/manifests/pnp4nagios/popup.pp
+++ b/manifests/pnp4nagios/popup.pp
@@ -1,17 +1,19 @@
class nagios::pnp4nagios::popup inherits nagios::pnp4nagios {
File['pnp4nagios-templates.cfg']{
- source => [ "puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-popup-templates.cfg",
- "puppet:///modules/nagios/pnp4nagios/pnp4nagios-popup-templates.cfg" ],
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/pnp4nagios-popup-templates.cfg',
+ 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-popup-templates.cfg' ],
}
- file { "/usr/share/nagios3/htdocs/ssi":
+ file { '/usr/share/nagios3/htdocs/ssi':
ensure => directory }
file { 'status-header.ssi':
- path => "/usr/share/nagios3/htdocs/ssi/status-header.ssi",
- source => [ "puppet:///modules/site-nagios/pnp4nagios/status-header.ssi",
- "puppet:///modules/nagios/pnp4nagios/status-header.ssi"],
- mode => 0644, owner => root, group => root,
+ path => '/usr/share/nagios3/htdocs/ssi/status-header.ssi',
+ source => [ 'puppet:///modules/site_nagios/pnp4nagios/status-header.ssi',
+ 'puppet:///modules/nagios/pnp4nagios/status-header.ssi' ],
+ mode => '0644',
+ owner => root,
+ group => root,
notify => Service['nagios'],
}
}