diff options
author | varac <varacanero@zeromail.org> | 2010-10-23 02:55:17 +0200 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-02-14 17:58:59 -0500 |
commit | bab19af527a21d689324a95aa9a0134c9aadb863 (patch) | |
tree | ba066100758aa5876b811de04ef181c6818fdf3e | |
parent | e06e4bd98c6a9310a349f26530bfa152b9cc4224 (diff) |
basic pnp4nagios grapher integration
-rw-r--r-- | README | 19 | ||||
-rw-r--r-- | files/pnp4nagios/pnp4nagios-popup-templates.cfg | 14 | ||||
-rw-r--r-- | files/pnp4nagios/pnp4nagios-templates.cfg | 14 | ||||
-rw-r--r-- | files/pnp4nagios/status-header.ssi | 8 | ||||
-rw-r--r-- | manifests/defaults/pnp4nagios.pp | 27 | ||||
-rw-r--r-- | manifests/pnp4nagios.pp | 17 | ||||
-rw-r--r-- | manifests/pnp4nagios/popup.pp | 17 |
7 files changed, 116 insertions, 0 deletions
@@ -193,6 +193,25 @@ For the irc_bot class: '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" ] + } + +} |