diff options
Diffstat (limited to 'net-mgmt/pnp/files')
-rw-r--r-- | net-mgmt/pnp/files/extra-patch-share::pnp::include::function.inc.php | 150 | ||||
-rw-r--r-- | net-mgmt/pnp/files/npcd.sh.in | 37 | ||||
-rw-r--r-- | net-mgmt/pnp/files/patch-sample-config::Makefile.in | 28 | ||||
-rw-r--r-- | net-mgmt/pnp/files/patch-scripts::Makefile.in | 10 | ||||
-rw-r--r-- | net-mgmt/pnp/files/pkg-deinstall.in | 35 | ||||
-rw-r--r-- | net-mgmt/pnp/files/pkg-install.in | 35 | ||||
-rw-r--r-- | net-mgmt/pnp/files/pkg-message.in | 55 |
7 files changed, 350 insertions, 0 deletions
diff --git a/net-mgmt/pnp/files/extra-patch-share::pnp::include::function.inc.php b/net-mgmt/pnp/files/extra-patch-share::pnp::include::function.inc.php new file mode 100644 index 000000000000..7fe0021b2b1b --- /dev/null +++ b/net-mgmt/pnp/files/extra-patch-share::pnp::include::function.inc.php @@ -0,0 +1,150 @@ +--- share/pnp/include/function.inc.php.orig 2008-06-18 12:02:41.000000000 +0400 ++++ share/pnp/include/function.inc.php 2008-08-16 23:35:30.000000000 +0400 +@@ -819,114 +819,15 @@ + } + + function doPDF($display,$data) { +- require ('fpdi.php'); +- global $NAGIOS; +- global $conf; +- if(file_exists($conf['background_pdf'])){ +- $use_bg=1; +- } +- class PDF extends FPDI { +- //Page header +- function Header() { +- //Arial bold 10 +- $this->SetFont('Arial', 'B', 10); +- //Move to the right +- $this->Cell(80); +- //Title +- $this->Cell(30, 10, _PDFTITLE, 0, 1, 'C'); +- //Line break +- #$this->Ln(20); +- } +- +- //Page footer +- function Footer() { +- //Position at 1.5 cm from bottom +- $this->SetY(-20); +- //Arial italic 8 +- $this->SetFont('Arial', 'I', 8); +- //Page number +- $this->Cell(0, 10, _PDFPAGE . $this->PageNo() . '/{nb}', 0, 0, 'C'); +- } +- } +- +- $pdf =& new PDF('P', 'mm', 'A4'); +- $pdf->AliasNbPages(); +- $pdf->SetAutoPageBreak('off'); +- $pdf->SetMargins(12.5,25,10); +- $pdf->AddPage(); +- if($use_bg){ +- $pdf->setSourceFile($conf['background_pdf']); +- $tplIdx = $pdf->importPage(1,'/MediaBox'); +- $pdf->useTemplate($tplIdx); +- } +- $pdf->SetCreator('Created with PNP'); +- $pdf->SetAuthor($_PHP['REMOTE_USER']); +- $pdf->SetFont('Arial', '', 10); +- $pdf->Cell(120, 4, '', 0, 1, 'L'); +- if($display == "service"){ +- foreach($data as $d) { +- if ($pdf->GetY() > 220) { +- $pdf->AddPage(); +- if($use_bg){$pdf->useTemplate($tplIdx);} +- } +- +- $pdf->SetFont('Arial', '', 10); +- $pdf->CELL(120, 5, $d["n_hostname"]." / ".$d["n_servicedesc"] , 0, 1); +- $pdf->SetFont('Arial', '', 8); +- $pdf->CELL(120, 5, $d["view_title"]. " (" . $d["f_start"]." - ".$d["f_end"].")", 0, 1); +- +- $img = saveImage($d['rrd_opts']); +- $Y = $pdf->GetY(); +- $cell_height = ($img['height'] * 0.23); +- $cell_width = ($img['width'] * 0.23); +- $pdf->Image($img['name'], 12.5, $Y, $cell_width, $cell_height, 'PNG'); +- $pdf->CELL(120, $cell_height, '', 0, 1); +- unlink($img['name']); +- } +- } +- if($display == "page"){ +- foreach($data as $d) { +- if ($pdf->GetY() > 220) { +- $pdf->AddPage(); +- if($use_bg){$pdf->useTemplate($tplIdx);} +- } +- +- $pdf->SetFont('Arial', '', 10); +- $pdf->CELL(120, 5, $d["hostname"]." / ".$d["servicedesc"] , 0, 1); +- $pdf->SetFont('Arial', '', 8); +- $pdf->CELL(120, 5, $d["f_start"]." - ".$d["f_end"], 0, 1); +- +- $img = saveImage($d['rrd_opts']); +- $Y = $pdf->GetY(); +- $cell_height = ($img['height'] * 0.23); +- $cell_width = ($img['width'] * 0.23); +- $pdf->Image($img['name'], 12.5, $Y, $cell_width, $cell_height, 'PNG'); +- $pdf->CELL(120, $cell_height, '', 0, 1); +- unlink($img['name']); +- } +- } +- if($display == "host_list"){ +- foreach($data as $d) { +- if ($pdf->GetY() > 220) { +- $pdf->AddPage(); +- if($use_bg){$pdf->useTemplate($tplIdx);} +- } +- $pdf->SetFont('Arial', '', 10); +- $pdf->CELL(120, 7, $d["hostname"]." / ".$d["servicedesc"] , 0, 1); +- $pdf->SetFont('Arial', '', 8); +- $pdf->CELL(120, 5, $d["f_start"]." - ".$d["f_end"], 0, 1); +- +- $img = saveImage($d['rrd_opts']); +- $Y = $pdf->GetY(); +- $cell_height = ($img['height'] * 0.23); +- $cell_width = ($img['width'] * 0.23); +- $pdf->Image($img['name'], 12.5, $Y, $cell_width, $cell_height, 'PNG'); +- $pdf->CELL(120, $cell_height, '', 0, 1); +- unlink($img['name']); +- } +- } +- +- $pdf->Output(); ++ print "<html>\n"; ++ print "<head>\n"; ++ print "<title>Failed</title>\n"; ++ print "</head>\n"; ++ print "<body>\n"; ++ print "<h1>Failed</h1>\n"; ++ print "</body>\n"; ++ print "<html>\n"; ++ exit(0); + } + + function doStrip($string) { +@@ -1173,23 +1074,6 @@ + } + + function doPDFIcon($type){ +- global $hostname; +- global $servicedesc; +- global $start; +- global $end; +- global $source; +- global $view; +- global $display; +- global $page; +- +- switch($type){ +- case "PAGE": +- print "<a href=\"index.php?page=$page&display=$display&view=$view&do=pdf\"><img src=\"images/pdf.png\" HEIGHT=\"32px\" WIDTH=\"32px\" title=\"Display PDF\" ></a>\n"; +- break; +- default: +- print "<a href=\"index.php?host=$hostname&srv=$servicedesc&display=$display&view=$view&source=$source&end=$end&start=$start&do=pdf\"><img src=\"images/pdf.png\" HEIGHT=\"32px\" WIDTH=\"32px\" title=\"Display PDF\" ></a>\n"; +- break; +- } + } + + function doXMLIcon(){ diff --git a/net-mgmt/pnp/files/npcd.sh.in b/net-mgmt/pnp/files/npcd.sh.in new file mode 100644 index 000000000000..94369f3b572f --- /dev/null +++ b/net-mgmt/pnp/files/npcd.sh.in @@ -0,0 +1,37 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: npcd +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable/tune npcd: +# npcd_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable npcd. +# npcd_flags (str): Set to "" by default. +# npcd_configfile (str): Set to "%%PREFIX%%/etc/pnp/npcd.cfg" by default. +# + +. %%RC_SUBR%% + +name="npcd" +rcvar=`set_rcvar` + +command="%%PREFIX%%/bin/npcd" +command_args="-d" +pidfile=/var/run/${name}.pid + +: ${npcd_enable="NO"} +: ${npcd_flags=""} +: ${npcd_configfile:="%%PREFIX%%/etc/pnp/npcd.cfg"} + +load_rc_config "${name}" + +required_files="${npcd_configfile}" +command_args="${command_args} -f ${npcd_configfile}" + +run_rc_command "$1" diff --git a/net-mgmt/pnp/files/patch-sample-config::Makefile.in b/net-mgmt/pnp/files/patch-sample-config::Makefile.in new file mode 100644 index 000000000000..74b8179e80b8 --- /dev/null +++ b/net-mgmt/pnp/files/patch-sample-config::Makefile.in @@ -0,0 +1,28 @@ +--- sample-config/Makefile.in.orig 2008-08-16 23:03:08.000000000 +0400 ++++ sample-config/Makefile.in 2008-08-16 23:04:53.000000000 +0400 +@@ -28,22 +28,18 @@ + devclean: distclean + + install: +- -rm -f $(HTMLDIR)/conf/config.php +- + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR) + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/check_commands + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/pages +- $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/config.php $(DESTDIR)$(CFGDIR) +- $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/background.pdf $(DESTDIR)$(CFGDIR) ++ $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/config.php $(DESTDIR)$(CFGDIR)/config.php-sample ++ $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/background.pdf $(DESTDIR)$(CFGDIR)/background.pdf-sample + + install-config: +- -rm -f $(DESTDIR)$(HTMLDIR)/conf/config.php +- + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR) + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/check_commands + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/pages + +- $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/config.php $(DESTDIR)$(CFGDIR) ++ $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/config.php $(DESTDIR)$(CFGDIR)/config.php-sample + $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/process_perfdata.cfg-sample $(DESTDIR)$(CFGDIR) + $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/rra.cfg-sample $(DESTDIR)$(CFGDIR) + $(INSTALL) -m 664 $(INSTALL_OPTS) pnp/check_commands/check_nwstat.cfg-sample $(DESTDIR)$(CFGDIR)/check_commands diff --git a/net-mgmt/pnp/files/patch-scripts::Makefile.in b/net-mgmt/pnp/files/patch-scripts::Makefile.in new file mode 100644 index 000000000000..2add42254768 --- /dev/null +++ b/net-mgmt/pnp/files/patch-scripts::Makefile.in @@ -0,0 +1,10 @@ +--- scripts/Makefile.in.orig 2008-08-17 00:52:43.000000000 +0400 ++++ scripts/Makefile.in 2008-08-17 00:52:47.000000000 +0400 +@@ -37,7 +37,6 @@ + $(INSTALL) -m 774 $(INSTALL_OPTS) net2pnp.pl $(DESTDIR)$(BINDIR) + + install: +- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(PERFDATADIR) + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR) + $(MAKE) install-processperfdata + diff --git a/net-mgmt/pnp/files/pkg-deinstall.in b/net-mgmt/pnp/files/pkg-deinstall.in new file mode 100644 index 000000000000..631082094eda --- /dev/null +++ b/net-mgmt/pnp/files/pkg-deinstall.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PNP_RRDS=%%PNP_RRDS%% +PNP_SPOOL=%%PNP_SPOOL%% +PNP_STATE=%%PNP_STATE%% +NAGIOSUSER=%%NAGIOSUSER%% +NAGIOSGROUP=%%NAGIOSGROUP%% + +dirs () { + local notempty + + for i in "$PNP_RRDS" "$PNP_SPOOL" "$PNP_STATE"; do + if ! rmdir "$i" > /dev/null 2>&1; then + notempty="$notempty $i" + fi + done + + if [ -n "$notempty" ]; then + echo + echo "The following directories were not removed:" + for i in $notempty; do + echo " $i" + done + echo + echo "Unless you're upgrading, remove them manually." + echo + fi +} + +if [ "x$2" = "xPOST-DEINSTALL" ]; then + dirs +fi diff --git a/net-mgmt/pnp/files/pkg-install.in b/net-mgmt/pnp/files/pkg-install.in new file mode 100644 index 000000000000..ca442c1db99d --- /dev/null +++ b/net-mgmt/pnp/files/pkg-install.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PNP_RRDS=%%PNP_RRDS%% +PNP_SPOOL=%%PNP_SPOOL%% +NAGIOSUSER=%%NAGIOSUSER%% +NAGIOSGROUP=%%NAGIOSGROUP%% + +dirs () { + for i in "$PNP_RRDS" "$PNP_SPOOL"; do + if ! [ -d "$i" ]; then + mkdir -p "$i" + chmod 750 "$i" + chown "$NAGIOSUSER":"$NAGIOSGROUP" "$i" + fi + done +} + +check_sanity () { + if ! pw group show "$NAGIOSGROUP" 2>&1 > /dev/null; then + echo "No group '$NAGIOSGROUP'. Create it and try again." + exit 1 + fi + if ! pw user show "$NAGIOSUSER" 2>&1 > /dev/null; then + echo "No user '$NAGIOSUSER'. Create it and try again." + exit 1 + fi +} + +if [ "x$2" = "xPOST-INSTALL" ]; then + check_sanity + dirs +fi diff --git a/net-mgmt/pnp/files/pkg-message.in b/net-mgmt/pnp/files/pkg-message.in new file mode 100644 index 000000000000..7b89f0a92f42 --- /dev/null +++ b/net-mgmt/pnp/files/pkg-message.in @@ -0,0 +1,55 @@ +======================================================================== + +You just installed/upgraded PNP graphing tool for Nagios. + +For tool configuration tasks read + http://www.pnp4nagios.org/pnp/config + +For Web-frontend configuration tasks read + http://www.pnp4nagios.org/pnp/webfe + +We recommend to start with the following restrictive Apache +configuration for the PNP area: + +<Directory "%%WWWDIR%%/"> + Order deny,allow + Allow from all + Deny from all + DirectoryIndex index.php + AddHandler application/x-httpd-php .php +</Directory> + +<Directory "%%WWWDIR%%/include/"> + Options None + Order allow,deny + Deny from all + <FilesMatch ".css$"> + Order deny,allow + Allow from all + Deny from all + </FilesMatch> +</Directory> + +<Directory "%%WWWDIR%%/include/js/"> + Order deny,allow + Allow from all + Deny from all +</Directory> +<Directory "%%WWWDIR%%/lang/"> + Order allow,deny + Deny from all +</Directory> +<Directory "%%WWWDIR%%/templates/"> + Order allow,deny + Deny from all +</Directory> +<Directory "%%WWWDIR%%/templates.dist/"> + Order allow,deny + Deny from all +</Directory> + + +Remember to restart NPCD service after upgrade if you're using +'bulk' mode with NPCD. + +======================================================================== |