summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2010-10-23 02:55:17 +0200
committerLeap devs <sysdev@leap.se>2012-09-19 16:04:45 +0000
commit124754b2fe6cfcc88b4f4c02ca690f141511bae2 (patch)
tree9f08f2722555d496c4c2edaedaa92400d8a43303
parent66257f3c425fea5fcea2acb999854aae5e7cf9f1 (diff)
basic pnp4nagios grapher integration
-rw-r--r--README19
-rw-r--r--files/pnp4nagios/pnp4nagios-popup-templates.cfg14
-rw-r--r--files/pnp4nagios/pnp4nagios-templates.cfg14
-rw-r--r--files/pnp4nagios/status-header.ssi8
-rw-r--r--manifests/defaults/pnp4nagios.pp27
-rw-r--r--manifests/pnp4nagios.pp17
-rw-r--r--manifests/pnp4nagios/popup.pp17
7 files changed, 116 insertions, 0 deletions
diff --git a/README b/README
index de1294d..47f17a9 100644
--- a/README
+++ b/README
@@ -213,6 +213,25 @@ Options to change the behavior of the nagios module:
'notice' if you would prefer them to be sent as IRC
NOTICE messages.
+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',
+ ...
+
+
Examples
========
diff --git a/files/pnp4nagios/pnp4nagios-popup-templates.cfg b/files/pnp4nagios/pnp4nagios-popup-templates.cfg
new file mode 100644
index 0000000..0035c63
--- /dev/null
+++ b/files/pnp4nagios/pnp4nagios-popup-templates.cfg
@@ -0,0 +1,14 @@
+# http://docs.pnp4nagios.org/de/pnp-0.6/webfe
+
+define host {
+ name host-pnp
+ action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
+ register 0
+}
+
+define service {
+ name srv-pnp
+ action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
+ register 0
+}
+
diff --git a/files/pnp4nagios/pnp4nagios-templates.cfg b/files/pnp4nagios/pnp4nagios-templates.cfg
new file mode 100644
index 0000000..14b60c9
--- /dev/null
+++ b/files/pnp4nagios/pnp4nagios-templates.cfg
@@ -0,0 +1,14 @@
+# http://docs.pnp4nagios.org/de/pnp-0.6/webfe
+
+define host {
+ name host-pnp
+ action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
+ register 0
+}
+
+define service {
+ name srv-pnp
+ action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
+ register 0
+}
+
diff --git a/files/pnp4nagios/status-header.ssi b/files/pnp4nagios/status-header.ssi
new file mode 100644
index 0000000..472be3a
--- /dev/null
+++ b/files/pnp4nagios/status-header.ssi
@@ -0,0 +1,8 @@
+<script src="/pnp4nagios/media/js/jquery-min.js" type="text/javascript"></script>
+<script src="/pnp4nagios/media/js/jquery.cluetip.js" type="text/javascript"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+ $('a.tips').cluetip({ajaxCache: false, dropShadow: false,showTitle: false });
+});
+</script>
+
diff --git a/manifests/defaults/pnp4nagios.pp b/manifests/defaults/pnp4nagios.pp
new file mode 100644
index 0000000..f6556c9
--- /dev/null
+++ b/manifests/defaults/pnp4nagios.pp
@@ -0,0 +1,27 @@
+class nagios::defaults::pnp4nagios {
+ # performance data cmds
+ # http://docs.pnp4nagios.org/de/pnp-0.6/config#bulk_mode_mit_npcd
+ nagios_command {
+ 'process-service-perfdata-file-pnp4nagios-bulk-npcd':
+ command_line => '/bin/mv /var/lib/nagios3/service-perfdata /var/spool/pnp4nagios/npcd/service-perfdata.$TIMET$';
+ '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/pnp4nagios.pp b/manifests/pnp4nagios.pp
new file mode 100644
index 0000000..051bad8
--- /dev/null
+++ b/manifests/pnp4nagios.pp
@@ -0,0 +1,17 @@
+class nagios::pnp4nagios {
+ include nagios::defaults::pnp4nagios
+
+ package { [php5, php5-gd, rrdcollect, rrdtool, librrdp-perl, librrds-perl ]:
+ 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.
+
+ file { 'pnp4nagios-templates.cfg':
+ path => "$nagios::nagios_cfgdir/conf.d/pnp4nagios-templates.cfg",
+ source => [ "puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-templates.cfg",
+ "puppet:///modules/nagios/pnp4nagios/pnp4nagios-templates.cfg" ]
+ }
+}
diff --git a/manifests/pnp4nagios/popup.pp b/manifests/pnp4nagios/popup.pp
new file mode 100644
index 0000000..372fe3b
--- /dev/null
+++ b/manifests/pnp4nagios/popup.pp
@@ -0,0 +1,17 @@
+class nagios::pnp4nagios::popup inherits nagios::pnp4nagios {
+ File['pnp4nagios-templates.cfg']{
+ path => "$nagios::nagios_cfgdir/conf.d/pnp4nagios-templates.cfg",
+ source => [ "puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-popup-templates.cfg",
+ "puppet:///modules/nagios/pnp4nagios/pnp4nagios-popup-templates.cfg" ]
+ }
+
+ file { "/usr/share/$nagios::nagios_packagename/htdocs/ssi":
+ ensure => directory }
+
+ file { 'status-header.ssi':
+ path => "/usr/share/$nagios::nagios_packagename/htdocs/ssi/status-header.ssi",
+ source => [ "puppet:///modules/site-nagios/pnp4nagios/status-header.ssi",
+ "puppet:///modules/nagios/pnp4nagios/status-header.ssi" ]
+ }
+
+}