Compare commits

...

17 Commits

Author SHA1 Message Date
Mario Fetka 770aca21de correct fuzzy patch 2017-10-20 17:30:58 +02:00
Mario Fetka 0b991e6294 Bump 2017-10-20 17:19:42 +02:00
Mario Fetka 25de787b3b Merge tag 'upstream/0.6.26'
Upstream version 0.6.26
2017-10-20 17:10:51 +02:00
Mario Fetka a6b4158f1f Imported Upstream version 0.6.26 2017-10-20 17:10:51 +02:00
Mario Fetka 6f819398fe prepare for bump 2017-10-20 17:10:37 +02:00
Mario Fetka 997a632ca7 Bump 2017-05-23 20:55:41 +02:00
Mario Fetka 6ca723cebe upstream js and fpdf 2017-05-20 22:16:12 +02:00
Mario Fetka bd7f077c77 kohana to webapp dir 2017-05-20 22:08:10 +02:00
Mario Fetka bd55adea07 update fpdf and fpdi 2017-05-20 22:02:18 +02:00
Mario Fetka cb87236f6b update fpdf and fpdi 2017-05-20 21:59:50 +02:00
Mario Fetka c0391eb5ba php7 compat first round 2017-05-20 21:41:48 +02:00
Mario Fetka fce3ef7f28 no no need for jsmin 2017-05-20 18:33:39 +02:00
Mario Fetka 1635f8cf19 no dfsg source package 2017-05-20 18:12:33 +02:00
Mario Fetka 45853aaaf7 Bump patches 2017-05-20 17:53:41 +02:00
Mario Fetka 8327b61924 Bump 2017-05-20 17:30:13 +02:00
Mario Fetka 2594665299 Merge tag 'upstream/0.6.25'
Upstream version 0.6.25
2017-05-20 15:29:40 +02:00
Micah Anderson 69f960eb4a Imported Debian patch 0.6.24+dfsg1-4~bpo80+1 2017-05-20 15:26:22 +02:00
208 changed files with 16339 additions and 2851 deletions

3
.gitignore vendored
View File

@ -36,3 +36,6 @@ scripts/rrd_convert.pl
scripts/rrd_converter.pl
man/npcd.8
*.swp
*.swo

View File

@ -1,4 +1,12 @@
**pnp-0.6.?? ??/??/2015**
**pnp-0.6.?? ??/??/2017**
**pnp-0.6.26 08/21/2017**
* Bugfix: Use complete option arguments for compatibility with rrdtool 1.6.0 (sbraz)
* Bugfix: Zoom on a special template not possbile (stinnux)
* Update: Update for FPDF (1.81) and FPDI (1.6.1) (Jan T. Bein )
* Bugfix: address behaviour of rrdtool1.5+ tp not export timestamp by default
* Feature: Template for icinga2's built-in icinga check (Tontonitch)
* Bugfix: fix non well formed numeric value encountered (sni)
**pnp-0.6.25 01/03/2015**
* Update: FPDF Update to Version 1.7

22
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for pnp 0.6.25.
# Generated by GNU Autoconf 2.61 for pnp 0.6.26.
#
# Report bugs to <pnp4nagios-devel@lists.sourceforge.net>.
#
@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='pnp'
PACKAGE_TARNAME='pnp'
PACKAGE_VERSION='0.6.25'
PACKAGE_STRING='pnp 0.6.25'
PACKAGE_VERSION='0.6.26'
PACKAGE_STRING='pnp 0.6.26'
PACKAGE_BUGREPORT='pnp4nagios-devel@lists.sourceforge.net'
ac_unique_file="src/"
@ -1219,7 +1219,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pnp 0.6.25 to adapt to many kinds of systems.
\`configure' configures pnp 0.6.26 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1284,7 +1284,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pnp 0.6.25:";;
short | recursive ) echo "Configuration of pnp 0.6.26:";;
esac
cat <<\_ACEOF
@ -1380,7 +1380,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pnp configure 0.6.25
pnp configure 0.6.26
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1394,7 +1394,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pnp $as_me 0.6.25, which was
It was created by pnp $as_me 0.6.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@ -1764,9 +1764,9 @@ _ACEOF
PKG_NAME=pnp4nagios
PKG_VERSION="0.6.25"
PKG_VERSION="0.6.26"
PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start"
PKG_REL_DATE="03-01-2015"
PKG_REL_DATE="08-21-2017"
@ -6330,7 +6330,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pnp $as_me 0.6.25, which was
This file was extended by pnp $as_me 0.6.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6379,7 +6379,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
pnp config.status 0.6.25
pnp config.status 0.6.26
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(pnp, 0.6.25, pnp4nagios-devel@lists.sourceforge.net)
AC_INIT(pnp, 0.6.26, pnp4nagios-devel@lists.sourceforge.net)
AC_CONFIG_SRCDIR(src/)
AC_CONFIG_HEADERS(include/config.h:include/config.h.in)
AC_PREFIX_DEFAULT(/usr/local/pnp4nagios)
@ -11,9 +11,9 @@ AC_DEFINE([DEFAULT_NAGIOS_USER], [nagios], [Default Nagios User])
AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group])
PKG_NAME=pnp4nagios
PKG_VERSION="0.6.25"
PKG_VERSION="0.6.26"
PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start"
PKG_REL_DATE="03-01-2015"
PKG_REL_DATE="08-21-2017"
AC_SUBST(PKG_NAME)
AC_SUBST(PKG_VERSION)
AC_SUBST(PKG_HOME_URL)

93
debian/README.Debian vendored Normal file
View File

@ -0,0 +1,93 @@
PNP4Nagios for Debian
---------------------
PNP4Nagios supports several modes of operation. They differ in the way how
performance data is being processed and, thus, the efficiency of PNP. Detailed
documentation is available at <http://docs.pnp4nagios.org/pnp-0.6/modes>.
Using bulk mode for Nagios3
---------------------------
We recommend to use bulk mode with NPCD and npcdmod. This will facilitate an
easy installation and fast processing of performance data. To enable NPCD, set
'RUN' to 'yes' in /etc/default/npcd.
In order to enable processing of performance data in Nagios, please change the
"process_performance_data" statement in "/etc/nagios3/nagios.cfg" to
"process_performance_data=1".
To register the NPC event broker module (npcdmod), add the following line
(without quotes) to "/etc/nagios3/nagios.cfg":
"broker_module=/usr/lib/pnp4nagios/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg"
Finally reload your Nagios server by running "service nagios3 reload". All
performance data should be processed now.
Using bulk mode for Icinga
---------------------------
We recommend to use bulk mode with NPCD and npcdmod. This will facilitate an
easy installation and fast processing of performance data. To enable NPCD, set
'RUN' to 'yes' in /etc/default/npcd.
In order to enable processing of performance data in Icinga, please change the
"process_performance_data" statement in "/etc/icinga/icinga.cfg" to
"process_performance_data=1".
To register the NPC event broker module (npcdmod), copy the file
"/usr/share/doc/pnp4nagios-bin/examples/npcdmod.cfg" to
"/etc/icinga/modules"
Finally reload your Icinga server by running "service icinga reload". All
performance data should be processed now.
-- Markus Frosch <lazyfrosch@debian.org> Sun, 26 Oct 2014 15:49:10 +0100
Add links for PNP4Nagios to Nagios / Icinga Webfrontend
-------------------------------------------------------
If you want links to PNP4Nagios for your monitored hosts and services in the
Nagios web frontend just add
- "action_url /pnp4nagios/graph?host=$HOSTNAME$"
to your hosts or host template(s)
- "action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
to your services or service template(s)
For more information and different modes of operation, see
<http://docs.pnp4nagios.org/pnp-0.6/config>.
-- Sven Velt <sven@velt.de> Wed, 30 Sep 2009 13:55:35 +0000
Using Gearman mode
------------------
Starting with version 0.6.12, PNP4Nagios may operate as a Gearman worker. This
is useful in large, distributed setups using Nagios's mod_gearman. To use
the PNP Gearman worker, you'll need a running mod_gearman environment. See
<http://labs.consol.de/lang/en/nagios/mod-gearman/> for detailed setup
instructions.
In addition, the following configuration is required to get you started:
- Enable processing of performance data in Nagios: set
'process_performance_data=1' in "/etc/nagios3/nagios.cfg" or
"/etc/icinga/icinga.cfg" and reload your monitoring system:
"service nagios3 reload" / "service icinga reload".
- Enable the PNP Gearman worker daemon by setting 'RUN' to 'yes' in
/etc/default/pnp_gearman_worker. Check the Gearman related options in
"/etc/pnp4nagios/process_perfdata.cfg" (GEARMAN_HOST and encryption
settings) and start the Gearman worker: /etc/init.d/pnp_gearman_worker start
- Enable distribution of performance data in mod_gearman by setting the
'perfdata=yes' option.
When operating in Gearman mode, process_perfdata.pl requires the
Gearman::Worker, MIME::Base64, and Crypt::Rijndael Perl modules. These are
available in the libgearman-client-perl, perl, and libcrypt-rijndael-perl
Debian packages (see packages suggested by pnp4nagios-bin).
-- Sebastian Harl <tokkee@debian.org> Wed, 27 Apr 2011 09:32:52 +0200

4
debian/README.source vendored Normal file
View File

@ -0,0 +1,4 @@
This package uses quilt to manage all modifications to the upstream source.
See /usr/share/doc/quilt/README.source for instructions how to generate the
patched source, add a new modification, and remove an existing one.

7
debian/README.templates.d vendored Normal file
View File

@ -0,0 +1,7 @@
#
# As of Debian version 0.6.16-1, the default config.php adds all directories
# inside /etc/pnp4nagios/templates.d/ to the templates_dirs configuration.
# This allows third-party packages to provide their own set of PNP4Nagios
# templates and create a symlink to the template directory inside
# /etc/pnp4nagios/templates.d.
#

4
debian/TODO vendored Normal file
View File

@ -0,0 +1,4 @@
* Config split
- dependencies on -web
- apache
- testing testing testing

268
debian/changelog vendored Normal file
View File

@ -0,0 +1,268 @@
pnp4nagios (0.6.26-1) UNRELEASED; urgency=medium
* 0.6.26
-- Mario Fetka <mario.fetka@gmail.com> Fri, 20 Oct 2017 17:15:49 +0200
pnp4nagios (0.6.25-1) UNRELEASED; urgency=medium
* Bump to new upstream verison
-- Mario Fetka <mario.fetka@gmail.com> Sat, 20 May 2017 17:29:18 +0200
pnp4nagios (0.6.24+dfsg1-4~bpo80+1) jessie-backports; urgency=medium
* Backport to jessie-backports.
* Add myself to Uploaders.
-- Micah Anderson <micah@debian.org> Tue, 08 Dec 2015 13:39:31 -0500
pnp4nagios (0.6.24+dfsg1-4) unstable; urgency=medium
[ Peter Michael Green ]
* [d7b0b89] Fix FTBFS on arm64 due to outdated config.sub/guess
(Closes: #774047)
[ Markus Frosch ]
* [c672afa] Fix use of hardening flags with a patch
-- Markus Frosch <lazyfrosch@debian.org> Wed, 01 Jul 2015 20:07:30 +0200
pnp4nagios (0.6.24+dfsg1-3) unstable; urgency=medium
* [8021d79] Do JS minification with Python's jsmin (Closes: #769696)
-- Markus Frosch <lazyfrosch@debian.org> Sat, 27 Dec 2014 22:37:09 +0100
pnp4nagios (0.6.24+dfsg1-2) unstable; urgency=medium
* [36db791] Fix and clarify package descriptions
-- Markus Frosch <lazyfrosch@debian.org> Mon, 27 Oct 2014 14:30:17 +0100
pnp4nagios (0.6.24+dfsg1-1) unstable; urgency=medium
[ Sebastian Harl ]
* [48a705e9] Merged branch 'configsplit'.
* [bfcb36ca] README.Debian: Replaced c&p'ed Nagios with Icinga.
* [91a75610] README.Debian: Fixed typo (icingacfg → icinga.cfg).
* [9f1e4167] README.Debian: Improved typesetting a bit ;-)
* [a7f12f2d] README.Debian: Fixed typo (nagios → nagios3).
Also, made the document a bit more "DAU"-proof ;-)
* [009534c4] npcdmod.cfg: Fixed a few typos and improved wording.
[ Bernd Zeimetz ]
* [832a9632] Refreshing patches.
[ Markus Frosch ]
* [14693ff] Replace Sven Velt with Markus Frosch as secondary uploader
(Closes: #739098)
* [f2f01d4] Initial upstream branch
* [29d5377] Imported Upstream version 0.6.21
* [d4a4cdb] DFSG cleaned upstream version 0.6.21+dfsg1
(Closes: #737457) (Closes: #753457)
* [82701a7] Removed GBP config, we imported the tarball into GIT
* [45e91cc] Changes for the DFSG tarball, JQuery depends, links and cleanup
* [36ab52d] Switch to source format 3.0 (quilt)
* [fafe97f] Update watch file for DFSG versions
* [318fa21] Remove potential flattr code from documentation
* [913caf2] Control, Lintian and Standards Cleanup
* [28272e9] Add missing dependencies of config packages and fix arch
* [ce4e5ae] Modernize and split Apache configuration (Closes: #669839)
* [a79e4af] Prefer Icinga over Nagios3
* [cb1832a] Fill config packages
* [2a2c4f6] Modernize rules
* [0a244f8] Update copyright
* [311c9c5] Include default build flags
* [c37bcc4] Fix Apache configuration handling
* [a65f63a] Revert "DFSG cleaned upstream version 0.6.21+dfsg1"
* [b542e4a] Imported Upstream version 0.6.24
* [b920288] DFSG cleaned upstream version 0.6.24+dfsg1
* [b87ba16] Update patch privacy-warning for 0.6.24
* [eed3190] Add patch install_opts to avoid setting owners on dh_auto_install
* [46e24b7] Update README.Debian
* [7f49d88] Bump Standards version
-- Markus Frosch <lazyfrosch@debian.org> Sun, 26 Oct 2014 16:02:13 +0100
pnp4nagios (0.6.19-1) experimental; urgency=low
* New upstream release; thanks to Christoph Anton Mitterer for reporting
this (Closes: #682175).
* Uploading to experimental because of the Wheezy freeze.
* debian/pnp4nagios.postrm:
- Fixed typo: Apache's config files use file suffix .conf rather than
.cfg; this prevented /etc/apache2/conf.d/pnp4nagios.conf from being
removed on remove/purge; thanks to Andreas Beckmann for reporting this
(cf. #669839).
* debian/control:
- Optionally depend on php5-cgi instead of libapache2-mod-php5 to allow
for easier installations when not using Apache; thanks to Matthias
Wamser for reporting this (Closes: #671231).
- Updated standards-version to 3.9.4 -- no changes.
- Let pnp4nagios-bin suggest rrdtool which is used by the rrd_convert
helper script; thanks to Christoph Anton Mitterer for suggesting this
(cf. #684420).
* debian/patches:
- fix-npcd-path updated for 0.6.19.
- Added format-security; fixing a missing printf-style format argument.
* debian/rules:
- Manually clean-up auto-generated scripts/rrd_modify.pl.
- Use dpkg-buildflags to determine CPPFLAGS/CFLAGS.
* debian/icinga-module.cfg, debian/rules:
- Provide a sample Icinga module configuration; thanks to Christoph Anton
Mitterer for providing this (Closes: #683459).
* debian/nagios.cfg:
- Unified whitespacing; thanks to Christoph Anton Mitterer for the patch
(Closes: #683471).
* debian/pnp4nagios-bin.postinst:
- Don't use world-readable permissions for process_perfdata.cfg as this
would allow local users to read the Gearman shared key; thanks to
Christoph Anton Mitterer for reporting this; fixes CVE-2012-3457
(Closes: #683879).
-- Sebastian Harl <tokkee@debian.org> Thu, 24 Jan 2013 16:30:51 +0100
pnp4nagios (0.6.16-2) unstable; urgency=low
* debian/control:
- Adapted versioned build-dep on libjs-jquery-ui to the workaround used by
that package (1.8.14 -> 1.8.ooops.14). Thanks to Christoph Anton
Mitterer for reporting this (Closes: #683100).
* debian/patches/:
- adjust-template-path: Fixed the patch for empty templates.d and some
versions of glob() which in this case returns nothing resulting in PHP
syntax errors and a crash of PNP4Nagios; thanks to Christoph Anton
Mitterer for reporting this and pointing out a fix (Closes: #683138).
-- Sebastian Harl <tokkee@debian.org> Sat, 24 Nov 2012 15:34:54 +0100
pnp4nagios (0.6.16-1) unstable; urgency=low
* New upstream version.
* debian/control:
- Depend on jQuery >= 1.6.2 and jQuery-ui >= 1.8.14 (rather than
unversioned dependencies); this is what upstream did as well.
* debian/rules:
- Added recommended targets build-{arch,indep} depending on build-stamp.
* debian/pnp4nagios-bin.install:
- Install verify_pnp_config_v2.pl to /u/l/pnp4nagios/libexec/.
* debian/pnp4nagios-web.postinst:
- Call a2mod / restart apache2 only if the binaries are available; thanks
to Wouter Schoot for reporting this (Closes: #636218).
* debian/po/:
- Added Spanish debconf translations; thanks to Camaleón for providing
those (Closes: #632953).
- Added Portuguese debconf translations; thanks to Pedro Ribeiro for
providing those (Closes: #651432).
- Added Dutch debconf translations; thanks to Jeroen Schot for providing
those (Closes: #654214).
- Added Danish debconf translations; thanks to Joe Dalton for providing
those (Closes: #654816).
- Added Czech debconf translations; thanks to Michal Šimůnek for providing
those (Closes: #655132).
* debian/README.Debian:
- Added a note about installation with Icinga referring to the different
htpasswd.users file location; thanks to Alexander Reichle-Schmehl for
reporting this (Closes: #646587).
* debian/patches/adjust-template-path:
- Added support for /etc/pnp4nagios/templates.d.
* debian/README.templates.d:
- Added README file for the use of /etc/pnp4nagios/templates.d. The file
will be installed to that directory.
-- Sebastian Harl <tokkee@debian.org> Tue, 31 Jan 2012 14:00:47 +0100
pnp4nagios (0.6.13-1) unstable; urgency=low
* New upstream release.
* debian/README.Debian:
- Added more verbose instructions about how to setup mod_gearman mode.
* debian/patches/:
- Removed manpage-hyphen -- applied upstream.
* debian/rules:
- Don't remove scripts/rc.pnp_gearman_worker in 'clean' -- this is now
taken care of in the upstream Makefile.
* debian/po/:
- Added Japanese debconf translation; thanks to Hideki Yamane for
providing the translation (Closes: #626386).
- Added Swedish debconf translation; thanks to Martin Bagge for providing
the translation (Closes: #628926).
* debian/control:
- Updated standards-version to 3.9.2 -- no changes.
-- Sebastian Harl <tokkee@debian.org> Wed, 22 Jun 2011 12:42:18 +0200
pnp4nagios (0.6.12-1) unstable; urgency=low
* New upstream release.
* debian/patches/:
- Removed raise-process-perfdata-timeout -- a similar patch has been
included upstream.
- Added manpage-hyphen -- do not use hyphens as minus sign in npcd.8.
* debian/rules:
- npcd.cfg and process_perfdata.cfg are not longer installed as sample
configs by the upstream Makefile; so, don't rename those files.
- Do not pass --prefix to configure and set man-/infodir correctly. The
prefix is set by layout=debian and cannot be overwritten, thus do not
pretend this is possible. Also, do not use $prefix when setting man-/
infodir but specify the complete path.
- Do not install config_local.php and config.php.$PKG_VERSION.
- Remove generated scripts/rc.pnp_gearman_worker in 'clean'.
* debian/rules, debian/pnp4nagios-bin.install:
- Do not install npcd.8 using dh_installman; this is done by the upstream
Makefile now.
* debian/pnp4nagios-bin.pnp_gearman_worker.default,
pnp4nagios-bin.pnp_gearman_worker.init:
- Added init script for the PNP4Nagios Gearman worker daemon.
- The daemon is disabled by default.
-- Sebastian Harl <tokkee@debian.org> Wed, 27 Apr 2011 09:05:48 +0200
pnp4nagios (0.6.11-2) unstable; urgency=low
* debian/po/:
- Added French debconf translation; thanks to Christian Perrier for
providing the translation (Closes: #623181).
- Added German debconf translation.
- Added Russian debconf translation; thanks to Yuri Kozlov for providing
the translation (Closes: #623798).
* debian/pnp4nagios-web.postinst:
- Do not set permissions of /var/log/pnp4nagios/stats -- this is done in
pnp4nagios-bin.postinst which ships the directory. This fixes an error
when installing -web without -bin.
-- Sebastian Harl <tokkee@debian.org> Tue, 26 Apr 2011 11:48:54 +0200
pnp4nagios (0.6.11-1) unstable; urgency=low
[ Sven Velt ]
* Initial release (Closes: #479031)
* Use "php-fpdf", "php-fpdf-tpl" and "php-fpdi" packages instead of bundled
copies.
* Do not use the bundled copy of Kohana2 but rather depend on
libkohana2-php.
* Ship all configuration in /etc and create appropriate symlinks.
* Ship upstream sample configs as default configs.
* debian/patches:
- Added adjust-template-path: install templates into /etc/ rather than
/usr/share/.
- Added apache-fix-path-to-userfile: fix config directory in the sample
httpd.conf.
- Added fix-nagios-url: fix cgi-bin path in config.php.
- Added fix-npcd-path: fix perfdata paths in npcd.cfg.
- Added fix-path-fpdi: FPDI is shipped in its own subdirectory -- adopt
path in pdf.php.
- Added raise-process-perfdata-timeout: set timeout to 10s in
process_perfdata.cfg; in large and/or virtualized setups, 5s might not
be enough.
[ Sebastian Harl ]
* Build the following binary packages:
- pnp4nagios-bin: NPCD and process_perfdata.pl
- pnp4nagios-web: web interface
- pnp4nagios: metapackage depending on the other two
* debian/watch: mangle upstream version to replace ".rc" with "~rc".
* Make Apache2 configuration optional using debconf.
-- Sebastian Harl <tokkee@debian.org> Mon, 14 Feb 2011 13:15:46 +0100

15
debian/check_commands/check_nrpe.cfg vendored Normal file
View File

@ -0,0 +1,15 @@
#
# Adapt the Template if check_command should not be the PNP Template
#
# check_command check_nrpe!check_disk!20%!10%
# ________0__________| | | |
# ________1_____________________| | |
# ________2____________________________| |
# ________3_______________________________|
#
CUSTOM_TEMPLATE = 1
#
# Change the RRD Datatype based on the check_command Name.
# Defaults to GAUGE.
#
# DATATYPE = COUNTER

View File

@ -0,0 +1,15 @@
#
# Adapt the Template if check_command should not be the PNP Template
#
# check_command check_nrpe!check_disk!20%!10%
# ________0__________| | | |
# ________1_____________________| | |
# ________2____________________________| |
# ________3_______________________________|
#
CUSTOM_TEMPLATE = 1
#
# Change the RRD Datatype based on the check_command Name.
# Defaults to GAUGE.
#
# DATATYPE = COUNTER

2
debian/clean vendored Normal file
View File

@ -0,0 +1,2 @@
scripts/rrd_modify.pl
share/pnp/media/js/jquery.imgareaselect.min.js

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
8

114
debian/control vendored Normal file
View File

@ -0,0 +1,114 @@
Source: pnp4nagios
Section: net
Priority: optional
Maintainer: Debian Nagios Maintainer Group <pkg-nagios-devel@lists.alioth.debian.org>
Uploaders:
Markus Frosch <lazyfrosch@debian.org>,
Micah Anderson <micah@debian.org>
Build-Depends:
autotools-dev,
debhelper (>= 8),
dh-autoreconf,
quilt,
rrdtool,
librrds-perl,
python
Standards-Version: 3.9.6
Homepage: http://www.pnp4nagios.org/
Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-pnp4nagios.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-pnp4nagios.git
Package: pnp4nagios
Architecture: all
Depends:
${misc:Depends},
pnp4nagios-bin,
pnp4nagios-web,
Description: monitoring addon to create graphs from performance data
PNP is a graphing tool for Nagios, Icinga or similar frameworks that
analyzes performance data provided by plugins and stores them
automatically into Round Robin Databases (RRD).
.
It offers integration into the Nagios and Icinga Frontends.
.
PNP's goal is to be easily configurable and maintainable.
.
This is a metapackage depending on all parts of PNP4Nagios.
Package: pnp4nagios-bin
Architecture: any
Depends:
${misc:Depends},
${perl:Depends},
${shlibs:Depends},
librrds-perl,
adduser
Recommends: pnp4nagios-web, icinga | nagios4
Suggests: rrdtool, rrdcached, perl, libgearman-client-perl, libcrypt-rijndael-perl
Description: monitoring addon to create graphs from performance data - binaries
PNP is a graphing tool for Nagios, Icinga or similar frameworks that
analyzes performance data provided by plugins and stores them
automatically into Round Robin Databases (RRD).
.
It offers integration into the Nagios and Icinga Frontends.
.
PNP's goal is to be easily configurable and maintainable.
.
This package contains the NPCD-related binaries and process_perfdata.pl.
Package: pnp4nagios-web-config-icinga
Architecture: all
Depends: pnp4nagios-web (=${source:Version}), ${misc:Depends}
Recommends: apache2 | httpd
Suggests: icinga, icinga-cgi
Conflicts: pnp4nagios-web-config-nagios4
Replaces: pnp4nagios-web (<< 0.6.21)
Description: monitoring addon to create graphs from performance data - Icinga Classic config
PNP is a graphing tool for Nagios, Icinga or similar frameworks that
analyzes performance data provided by plugins and stores them
automatically into Round Robin Databases (RRD).
.
It offers integration into the Nagios and Icinga Frontends.
.
PNP's goal is to be easily configurable and maintainable.
.
This package contains the icinga-cgi configuration for pnp4nagios-web.
Package: pnp4nagios-web-config-nagios4
Architecture: all
Depends: pnp4nagios-web (=${source:Version}), ${misc:Depends}
Recommends: apache2 | httpd
Suggests: nagios4, nagios4-cgi
Conflicts: pnp4nagios-web-config-icinga
Replaces: pnp4nagios-web (<< 0.6.21)
Description: monitoring addon to create graphs from performance data - nagios4 CGI config
PNP is a graphing tool for Nagios, Icinga or similar frameworks that
analyzes performance data provided by plugins and stores them
automatically into Round Robin Databases (RRD).
.
It offers integration into the Nagios and Icinga Frontends.
.
PNP's goal is to be easily configurable and maintainable.
.
This package contains the nagios4-cgi configuration for pnp4nagios-web.
Package: pnp4nagios-web
Architecture: all
Depends:
${misc:Depends},
libapache2-mod-php5 | libapache2-mod-php7.0 | php5-cgi | php7.0-cgi | php7.0 | php5,
php7.0-gd | php5-gd ,
rrdtool,
adduser
Recommends: pnp4nagios-bin, pnp4nagios-web-config-icinga | pnp4nagios-web-config-nagios4
Suggests: rrdcached
Description: monitoring addon to create graphs from performance data - web interface
PNP is a graphing tool for Nagios, Icinga or similar frameworks that
analyzes performance data provided by plugins and stores them
automatically into Round Robin Databases (RRD).
.
It offers integration into the Nagios and Icinga Frontends.
.
PNP's goal is to be easily configurable and maintainable.
.
This package contains the web-interface for PNP4Nagios.

489
debian/copyright vendored Normal file
View File

@ -0,0 +1,489 @@
Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=166
Upstream-Name: PNP4Nagios
Upstream-Contact: Jörg Linge <pitchfork@pnp4nagios.org>
Source: http://docs.pnp4nagios.org/pnp-0.6/about#download
Files: *
Copyright:
2005-2014 Jörg Linge <pitchfork@pnp4nagios.org>
License: GPL-2+
Comment: See the file THANKS for a list of contributors.
Files:
scripts/verify_pnp_config.pl.in
Copyright:
2008-2010 Wolfgang Nieder
License: GPL-2+
Files: include/*
Copyright:
1999-2008 Ethan Galstad <nagios@nagios.org>
License: GPL-2
Files: include/npcdmod.h
Copyright:
2008 Hendrik Baecker
License: GPL-2
Files: lib/kohana/*
Copyright:
2007-2009 Kohana Team
License: BSD-3-clause
Comment: See <http://kohanaframework.org/team> for the list of team members.
Files:
lib/kohana/system/core/utf8.php
lib/kohana/system/core/utf8/*
Copyright:
2007, Kohana Team
2005, Harry Fuecks
License: LGPL-2.1
Files: lib/kohana/system/fonts/*
Copyright:
2003, Bitstream, Inc.
2006, Tavmjong Bah.
License: fonts-copyright
Files: lib/kohana/system/libraries/drivers/Database/Pdosqlite.php
Copyright:
Doutu
Greg MacLellan
License: BSD-3-clause
Files:
scripts/verify_pnp_config_v2.pl
scripts/rrd_modify.pl.in
Copyright:
2005-2012, PNP4Nagios Developer Team
License: GPL-2+
Files: share/pnp/templates.dist/check_apachestatus.php
Copyright:
Roman Ovchinnikov <coolthecold@gmail.com>
License: GPL-2+
Files: share/pnp/templates.dist/check_ntp_time.php
Copyright:
Mathias Kettner
License: GPL-2+
Files: share/pnp/templates.dist/check_esx3.php
Copyright:
2009 op5 AB (author: Mattias Ryrlen <dev@op5.com>)
Joerg Linge <joerg.linge@pnp4nagios.org>
License: GPL-2
Files: share/pnp/templates.dist/check_messpc_temp.php
Copyright:
Joerg Peter Geissler <lairdofglencairn@nagios-wiki.de>
License: GPL-2+
Files: check_mssql_health.php
Copyright:
2009-2011 Gerhard Lausser <gerhard.lausser@consol.de>
2011 Joerg Linge <support@pnp4nagios.org>
License: GPL-2+
Files: share/pnp/templates.dist/check_multi_nagiostats.php
Copyright:
2009 Matthias Flacke
License: GPL-2+
Files: share/pnp/templates.dist/check_mysql_health.php
Copyright:
2009 Gerhard Lausser <gerhard.lausser@consol.de>
License: GPL-2+
Files: share/pnp/templates.dist/check_openmanage.php
Copyright:
2008-2011 Trond Hasle Amundsen <t.h.amundsen@usit.uio.no>
License: GPL-3+
Files: share/pnp/application/lib/json.php
Copyright:
2005 Michal Migurski <mike-json@teczno.com>
Matt Knapp <mdknapp@gmail.com>
Brett Stimmerman <brettstimmerman@gmail.com>
License: BSD-2-clause
Files: share/pnp/application/vendor/fpdf/*
Copyright:
2008 Olivier Plathey <olivier@fpdf.org>
License: FPDF-license
Files:
share/pnp/application/vendor/fpdf/fpdf_tpl.php
share/pnp/application/vendor/fpdf/fpdi*
share/pnp/application/vendor/fpdf/pdf_context.php
share/pnp/application/vendor/fpdf/pdf_parser.php
share/pnp/application/vendor/fpdf/filters/*
Copyright:
2004-2009 Setasign - Jan Slabon
License: Apache-2.0
Files:
share/pnp/media/css/jquery.mobile.min.css
share/pnp/media/js/jquery.mobile.min.js
Copyright:
2010 jQuery Project
License: MIT and GPL-2+
Files:
share/pnp/media/js/jquery.imgareaselect.min.js
Copyright:
2008-2011 Michal Wojciechowski (odyniec.net)
License: MIT and GPL-2+
Files:
share/pnp/media/js/jquery-ui.min.js
share/pnp/media/css/ui-*
Copyright:
2010-2011 Brandon Aaron
2010-2011 Paul Bakaus (paulbakaus.com)
2010-2011 David Bolter
2010-2011 Rich Caloggero
2010-2011 Chi Cheng (cloudream@gmail.com)
2010-2011 Colin Clark (http://colin.atrc.utoronto.ca/)
2010-2011 Michelle D'Souza
2010-2011 Aaron Eisenberger (aaronchi@gmail.com)
2010-2011 Ariel Flesler
2010-2011 Bohdan Ganicky
2010-2011 Scott González
2010-2011 Marc Grabanski (m@marcgrabanski.com)
2010-2011 Klaus Hartl (stilbuero.de)
2010-2011 Scott Jehl
2010-2011 Cody Lindley
2010-2011 Eduardo Lundgren (eduardolundgren@gmail.com)
2010-2011 Todd Parker
2010-2011 John Resig
2010-2011 Patty Toland
2010-2011 Ca-Phun Ung (yelotofu.com)
2010-2011 Keith Wood (kbwood@virginbroadband.com.au)
2010-2011 Maggie Costello Wachs
2010-2011 Richard D. Worth (rdworth.org)
2010-2011 Jörn Zaefferer (bassistance.de)
License: MIT and GPL-2+
Files:
share/pnp/media/js/jquery-ui-timepicker-addon.js
Copyright:
2011 Trent Richardson
License: MIT and GPL-2+
Files: share/pnp/media/js/jquery.cluetip.js
Copyright:
2009 Karl Swedberg
License: MIT and GPL-2+
Comment: Copyright and license extracted from upstream website and sources.
Files: share/pnp/media/js/jquery-min.js
Copyright:
2010-2011 John Resig
2010-2011 The Dojo Foundation
License: MIT and BSD-3-clause and GPL-2+
Comment: License details extracted from upstream website.
Files: src/*
Copyright:
2006-2010 Hendrik Baecker <andurin@process-zero.de>
License: GPL-2
Files: src/utils.c
Copyright:
2006-2009 Hendrik Baecker <andurin@process-zero.de>
1999-2006 Ethan Galstad <nagios@nagios.org>
License: GPL-2
Files: debian/*
Copyright:
2009-2011, Sven Velt <sven@velt.de>
2011, Sebastian Harl <tokkee@debian.org>
2014, Markus Frosch <lazyfrosch@debian.org>
License: BSD-2-clause
Files:
debian/pnp4nagios-bin.npcd.init
Copyright:
2007 Javier Fernandez-Sanguino <jfs@debian.org>
2009 Sven Velt <sven@velt.de>
License: BSD-2-clause
Files:
debian/pnp4nagios-bin.pnp_gearman_worker.init
Copyright:
2007, Javier Fernandez-Sanguino <jfs@debian.org>
2011, Sebastian Harl <tokkee@debian.org>
License: BSD-2-clause
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache License, Version 2.0
can be found in the file `/usr/share/common-licenses/Apache-2.0'.
License: BSD-3-clause
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
* Neither the name of the Kohana nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: BSD-2-clause
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: LGPL-2.1
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
License: GPL-2
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the full text of the GNU General Public License version 2
can be found in the file `/usr/share/common-licenses/GPL-2'. The latest
version of the library can be found in the file
`/usr/share/common-licenses/GPL-2'.
License: GPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the full text of the GNU General Public License version 2
can be found in the file `/usr/share/common-licenses/GPL-2'.
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public License version 3
can be found in the file `/usr/share/common-licenses/GPL-3'.
License: FPDF-license
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software to use, copy, modify, distribute, sublicense, and/or sell
copies of the software, and to permit persons to whom the software is
furnished to do so.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED.
License: fonts-copyright
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
.
Bitstream Vera Fonts Copyright
------------------------------
.
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
.
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
.
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
.
Arev Fonts Copyright
------------------------------
.
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:
.
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".
.
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.
.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
.
Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.

2
debian/docs vendored Normal file
View File

@ -0,0 +1,2 @@
AUTHORS
README.md

11
debian/icinga-module.cfg vendored Normal file
View File

@ -0,0 +1,11 @@
# This is a sample module definition for Icinga.
#
# Copy this file to /etc/icinga/modules/ in order to activate it.
define module {
module_name npcdmod
module_type neb
path /usr/lib/pnp4nagios/npcdmod.o
args config_file=/etc/pnp4nagios/npcd.cfg
}

2
debian/icinga/config.icinga.php vendored Normal file
View File

@ -0,0 +1,2 @@
<?php
$conf['nagios_base'] = "/cgi-bin/icinga";

15
debian/icinga/npcdmod.cfg vendored Normal file
View File

@ -0,0 +1,15 @@
# Icinga configuration for PNP4Nagios's npcdmod
#
# In order to enable the npcdmod event broker module in Icinga, you'll have to
# put a file similar to this one into /etc/icinga/modules/.
#
# ATTENTION: DO NOT load the same module here AND via broker_module in
# icinga.cfg. This can lead to problems with races on ressources.
#
define module{
module_name npcdmod
module_type neb
path /usr/lib/pnp4nagios/npcdmod.o
args config_file=/etc/pnp4nagios/npcd.cfg
}

24
debian/icinga/pnp4nagios.conf vendored Normal file
View File

@ -0,0 +1,24 @@
Alias /pnp4nagios "/usr/share/pnp4nagios/html"
<Directory "/usr/share/pnp4nagios/html">
AllowOverride None
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/htpasswd.users
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
Options symLinksIfOwnerMatch
# Installation directory
RewriteBase /pnp4nagios/
# Protect application and system files from being viewed
RewriteRule "^(?:application|modules|system)/" - [F]
# Allow any files or directories that exist to be displayed directly
RewriteCond "%{REQUEST_FILENAME}" !-f
RewriteCond "%{REQUEST_FILENAME}" !-d
# Rewrite all other URLs to index.php/URL
RewriteRule "^.*$" "index.php/$0" [PT]
</IfModule>
</Directory>

34
debian/nagios.cfg vendored Normal file
View File

@ -0,0 +1,34 @@
define command {
command_name pnp-synchronous-service
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name pnp-synchronous-host
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
##############################################################################
define command {
command_name pnp-bulk-service
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl --bulk=/var/spool/pnp4nagios/nagios/service-perfdata
}
define command {
command_name pnp-bulk-host
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl --bulk=/var/spool/pnp4nagios/nagios/host-perfdata
}
##############################################################################
define command {
command_name pnp-bulknpcd-service
command_line /bin/mv /var/spool/pnp4nagios/nagios/service-perfdata /var/spool/pnp4nagios/npcd/service-perfdata.$TIMET$
}
define command {
command_name pnp-bulknpcd-host
command_line /bin/mv /var/spool/pnp4nagios/nagios/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$
}

2
debian/nagios4/config.nagios4.php vendored Normal file
View File

@ -0,0 +1,2 @@
<?php
$conf['nagios_base'] = "/cgi-bin/nagios4";

24
debian/nagios4/pnp4nagios.conf vendored Normal file
View File

@ -0,0 +1,24 @@
Alias /pnp4nagios "/usr/share/pnp4nagios/html"
<Directory "/usr/share/pnp4nagios/html">
AllowOverride None
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios4/htpasswd.users
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
Options symLinksIfOwnerMatch
# Installation directory
RewriteBase /pnp4nagios/
# Protect application and system files from being viewed
RewriteRule "^(?:application|modules|system)/" - [F]
# Allow any files or directories that exist to be displayed directly
RewriteCond "%{REQUEST_FILENAME}" !-f
RewriteCond "%{REQUEST_FILENAME}" !-d
# Rewrite all other URLs to index.php/URL
RewriteRule "^.*$" "index.php/$0" [PT]
</IfModule>
</Directory>

29
debian/patches/adjust-template-path vendored Normal file
View File

@ -0,0 +1,29 @@
Description: Install templates into /etc/ rather than /usr/share/.
Also, add support for templates.d directory.
Author: Sven Velt <sven@velt.de>, Sebastian Harl <tokkee@debian.org
Forwarded: not-needed
--- a/sample-config/pnp/config.php.in
+++ b/sample-config/pnp/config.php.in
@@ -230,13 +230,19 @@ $conf['RRD_DAEMON_OPTS'] = '';
# Add your own template directories here
# First match wins!
#$conf['template_dirs'][] = '/usr/local/check_mk/pnp-templates';
-$conf['template_dirs'][] = '@datarootdir@/templates';
+$conf['template_dirs'][] = '@sysconfdir@/templates';
+$templates_d = glob("/etc/pnp4nagios/templates.d/*", GLOB_ONLYDIR);
+if (is_array($templates_d) && (count($templates_d) > 0)) {
+ foreach ($templates_d as $dirname) {
+ $conf['template_dirs'][] = "$dirname";
+ }
+}
$conf['template_dirs'][] = '@datarootdir@/templates.dist';
#
# Directory to search for special templates
#
-$conf['special_template_dir'] = '@datarootdir@/templates.special';
+$conf['special_template_dir'] = '@sysconfdir@/templates.special';
#
# Regex to detect mobile devices

View File

@ -0,0 +1,15 @@
Description: Fix config directory in the sample httpd.conf.
Author: Sven Velt <sven@velt.de>
Forwarded: not-needed
--- a/sample-config/httpd.conf.in
+++ b/sample-config/httpd.conf.in
@@ -11,7 +11,7 @@
#
AuthName "Nagios Access"
AuthType Basic
- AuthUserFile /usr/local/nagios/etc/htpasswd.users
+ AuthUserFile /etc/nagios4/htpasswd.users
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting

28
debian/patches/config_instances vendored Normal file
View File

@ -0,0 +1,28 @@
Description: Include a instance based config
Author: Markus Frosch <lazyfrosch@debian.org>
Last-Update: 2017-05-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sample-config/pnp/config.php.in 2017-05-20 17:52:02.532000000 +0200
+++ b/sample-config/pnp/config.php.in 2017-05-20 17:48:33.008000000 +0200
@@ -89,7 +89,8 @@
#
# Link back to Nagios or Thruk ( www.thruk.org )
#
-$conf['nagios_base'] = "/cgi-bin/nagios4";
+## Debian: please see /etc/pnp4nagios/config.<NAME>.php
+##$conf['nagios_base'] = "/cgi-bin/nagios4";
#
# Link back to check_mk´s multisite ( http://mathias-kettner.de/checkmk_multisite.html )
@@ -278,4 +279,10 @@
'#F6E8C3','#C7EAE5','#DFC27D','#80CDC1','#BF812D','#35978F','#8C510A','#01665E');
$scheme['mixed3'] = array ('#67001F','#80CDC1','#B2182B','#35978F','#D6604D','#01665E','#F4A582','#003C30',
'#FDDBC7','#92C5DE','#D1E5F0','#2166AC','#4393C3','#8C510A','#053061','#BF812D');
+
+if (file_exists('/etc/pnp4nagios/config.icinga.php')) {
+ include '/etc/pnp4nagios/config.icinga.php';
+} else if (file_exists('/etc/pnp4nagios/config.nagios4.php')) {
+ include '/etc/pnp4nagios/config.nagios4.php';
+}
?>

15
debian/patches/fix-nagios-url vendored Normal file
View File

@ -0,0 +1,15 @@
Description: Fix cgi-bin path in config.php.
Author: Sven Velt <sven@velt.de>
Forwarded: not-needed
--- a/sample-config/pnp/config.php.in
+++ b/sample-config/pnp/config.php.in
@@ -89,7 +89,7 @@ $conf['temp'] = "/var/tmp";
#
# Link back to Nagios or Thruk ( www.thruk.org )
#
-$conf['nagios_base'] = "/nagios/cgi-bin";
+$conf['nagios_base'] = "/cgi-bin/nagios4";
#
# Link back to check_mk´s multisite ( http://mathias-kettner.de/checkmk_multisite.html )

24
debian/patches/fix-npcd-path vendored Normal file
View File

@ -0,0 +1,24 @@
Description: Fix perfdata paths in npcd.cfg.
Author: Sven Velt <sven@velt.de>
Forwarded: not-needed
--- a/sample-config/pnp/npcd.cfg-sample.in
+++ b/sample-config/pnp/npcd.cfg-sample.in
@@ -76,7 +76,7 @@
# perfdata_spool_dir = </path/to/directory/>
#
-perfdata_spool_dir = @PERFDATA_SPOOL_DIR@
+perfdata_spool_dir = @PERFDATA_SPOOL_DIR@/npcd/
# Execute following command for each found file
@@ -163,7 +163,7 @@
# perfdata_file = </path/to/file>
#
-perfdata_file = @localstatedir@/perfdata.dump
+perfdata_file = @PERFDATA_SPOOL_DIR@/nagios/perfdata.dump
# perfdata_spool_filename - declare the destination

26
debian/patches/hardening vendored Normal file
View File

@ -0,0 +1,26 @@
Description: Fix use of flags in Makefiles
To pass all hardening flags to gcc.
Author: Markus Frosch <lazyfrosch@debian.org>
Last-Update: 2015-07-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -83,7 +83,7 @@
#
###############################
npcd: npcd.c $(NPCDOBJS) $(NPCDHEAD)
- $(CC) $(CFLAGS) -o $@ npcd.c $(NPCDOBJS) -lpthread
+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ npcd.c $(NPCDOBJS) $(LDFLAGS) -lpthread
###############################
#
@@ -91,7 +91,7 @@
#
###############################
npcdmod.o: npcdmod.c
- $(CC) $(MOD_CFLAGS) $(CFLAGS) -o npcdmod.o npcdmod.c $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) -fPIC
+ $(CC) $(MOD_CFLAGS) $(CFLAGS) $(CPPFLAGS) -o npcdmod.o npcdmod.c $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) -fPIC
###############################
#

16
debian/patches/install_opts vendored Normal file
View File

@ -0,0 +1,16 @@
Description: Disable INSTALL_OPTS
Author: Markus Frosch <lazyfrosch@debian.org>
Last-Update: 2014-10-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,7 @@
AC_SUBST(nagios_grp)
AC_DEFINE_UNQUOTED(DEFAULT_NAGIOS_USER,"$nagios_user")
AC_DEFINE_UNQUOTED(DEFAULT_NAGIOS_GROUP,"$nagios_grp")
-INSTALL_OPTS="-o $nagios_user -g $nagios_grp"
+INSTALL_OPTS=""
AC_SUBST(INSTALL_OPTS)
# Checks for programs.

475
debian/patches/pnp-metrics-api vendored Normal file
View File

@ -0,0 +1,475 @@
diff -uNr pnp4nagios.orig/README pnp4nagios-0.6.26/README
--- pnp4nagios.orig/README 2017-08-21 17:52:37.000000000 +0200
+++ pnp4nagios-0.6.26/README 2017-10-20 17:29:21.680000000 +0200
@@ -8,3 +8,8 @@
http://pnp4nagios.sourceforge.net or:
http://docs.pnp4nagios.org/
+
+## pnp-metrics-api ###
+
+https://github.com/lingej/pnp-metrics-api
+README.md
diff -uNr pnp4nagios.orig/README.md pnp4nagios-0.6.26/README.md
--- pnp4nagios.orig/README.md 1970-01-01 01:00:00.000000000 +0100
+++ pnp4nagios-0.6.26/README.md 2017-10-20 17:02:31.336000000 +0200
@@ -0,0 +1,56 @@
+# pnp-metrics-api
+## Usage examples
+### CURL
+#### Query metrics of a service on a specific host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "targets":[
+ {
+ "host":"host1.example.org",
+ "service":"_HOST_",
+ "perflabel":"rta",
+ "type":"AVERAGE"
+ },
+ {
+ "host":"host2.example.org",
+ "service":"_HOST_",
+ "perflabel":"rta",
+ "type":"AVERAGE"
+ }
+ ],
+ "start":'UNIXEPOCHTIMESTAMP_START',
+ "end":'UNIXEPOCHTIMESTAMP_END'
+}' https://example.org/pnp4nagios/index.php/api/metrics
+```
+#### List all hosts
+```
+curl -s -u '<username>:<password>' https://example.org/pnp4nagios/index.php/api/hosts
+```
+
+#### List services of a host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"host.example.org"
+}' https://example.org/pnp4nagios/index.php/api/services
+```
+
+You can use regular expressions for host lists:
+
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"/^local"
+}' https://example.org/pnp4nagios/index.php/api/services
+```
+
+
+#### List labels of a service of specific host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"host.example.org",
+ "service":"_HOST_"
+}' https://example.org/pnp4nagios/index.php/api/labels
+```
diff -uNr pnp4nagios.orig/share/pnp/application/controllers/api.php pnp4nagios-0.6.26/share/pnp/application/controllers/api.php
--- pnp4nagios.orig/share/pnp/application/controllers/api.php 1970-01-01 01:00:00.000000000 +0100
+++ pnp4nagios-0.6.26/share/pnp/application/controllers/api.php 2017-10-20 17:29:56.444000000 +0200
@@ -0,0 +1,399 @@
+<?php defined('SYSPATH') OR die('No direct access allowed.');
+/**
+* API controller.
+*
+* @package pnp4nagios
+* @author Joerg Linge
+* @license GPL
+*/
+class Api_Controller extends System_Controller {
+
+ public function __construct(){
+ parent::__construct();
+ // Disable auto-rendering
+ $this->auto_render = FALSE;
+ $this->data->getTimeRange($this->start,$this->end,$this->view);
+ // Graphana sends JSON via POST
+ $this->post_data = json_decode(file_get_contents('php://input'), true);
+
+ }
+
+ public function index() {
+ $data['pnp_version'] = PNP_VERSION;
+ $data['pnp_rel_date'] = PNP_REL_DATE;
+ $data['error'] = "";
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function hosts($query = false) {
+ $data = array();
+ $hosts = getHosts($this->data, $query);
+ foreach ( $hosts as $host ){
+ $data['hosts'][] = array(
+ 'name' => $host
+ );
+ }
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function services() {
+ $data = array();
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+
+ $host = arr_get($pdata, "host");
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ $services = array();
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts);
+ $duplicates = array();
+
+ foreach($services as $service){
+ // skip duplicates
+ if(isset($duplicates[$service['servicedesc']])) {
+ continue;
+ }
+ $duplicates[$service['servicedesc']] = true;
+ $data['services'][] = array(
+ 'name' => $service['name'],
+ 'servicedesc' => $service['servicedesc'],
+ 'hostname' => $service['hostname']
+ );
+ }
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function labels ( $host=false, $service=false ) {
+ $data = array();
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+ $host = arr_get($pdata, "host");
+ $service = arr_get($pdata, "service");
+
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $service === false ){
+ $data['error'] = "No service specified";
+ return_json($data, 901);
+ return;
+ }
+
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts, $service);
+ $duplicates = array();
+
+ foreach($services as $service){
+ try {
+ // read XML file
+ $this->data->readXML($service['hostname'], $service['name']);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ foreach( $this->data->DS as $KEY => $DS) {
+ // skip duplicates
+ if(isset($duplicates[$DS['LABEL']])) {
+ continue;
+ }
+ $duplicates[$DS['LABEL']] = true;
+ $data['labels'][] = array(
+ 'name' => $DS['NAME'],
+ 'label' => $DS['LABEL'],
+ 'service' => $service['name'],
+ 'hostname' => $service['hostname']
+ );
+ }
+ }
+ return_json($data, 200);
+ }
+
+
+ public function metrics(){
+ // extract metrics for a given datasource
+ // TODO Multiple sources via regex
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $hosts = array(); // List of all Hosts
+ $services = array(); // List of services for a given host
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+ $data = array();
+
+ if ( !isset($pdata['targets']) ){
+ $data['error'] = "No targets specified";
+ return_json($data, 901);
+ return;
+ }
+
+ foreach( $pdata['targets'] as $key => $target){
+
+ $this->data->TIMERANGE['start'] = arr_get($pdata, 'start');
+ $this->data->TIMERANGE['end'] = arr_get($pdata, 'end');
+ $host = arr_get($target, 'host');
+ $service = arr_get($target, 'service');
+ $perflabel = arr_get($target, 'perflabel');
+ $type = arr_get($target, 'type');
+ $refid = arr_get($target, 'refid');
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $service === false ){
+ $data['error'] = "No service specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $perflabel === false ){
+ $data['error'] = "No perfdata label specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $type === false ){
+ $data['error'] = "No perfdata type specified";
+ return_json($data, 901);
+ return;
+ }
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts, $service);
+
+ $hk = 0; // Host Key
+
+ foreach ( $services as $service) {
+ $host = $service['hostname'];
+ $service = $service['name'];
+ try {
+ // read XML file
+ $this->data->readXML($host, $service);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ // create a Perflabel List
+ $perflabels = array();
+ foreach( $this->data->DS as $value){
+ $label = arr_get($value, "LABEL" );
+ if (isRegex($perflabel)) {
+ if(!preg_match( $perflabel, $label ) ){
+ continue;
+ }
+ } elseif ( $perflabel != $label ) {
+ continue;
+ }
+ $perflabels[] = array(
+ "label" => arr_get($value, "NAME" ),
+ "warn" => arr_get($value, "WARN" ),
+ "crit" => arr_get($value, "CRIT" )
+ );
+ }
+
+ foreach ( $perflabels as $tmp_perflabel){
+ try {
+ $this->data->buildXport($host, $service);
+ $xml = $this->rrdtool->doXport($this->data->XPORT);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ $xpd = simplexml_load_string($xml);
+ $i = 0;
+ $index = -1;
+ foreach ( $xpd->meta->legend->entry as $k=>$v){
+ if($type == "WARNING" || $type == "CRITICAL") {
+ if( $v == $tmp_perflabel['label']."_AVERAGE"){
+ $index = $i;
+ break;
+ }
+ }
+ else {
+ if( $v == $tmp_perflabel['label']."_".$type){
+ $index = $i;
+ break;
+ }
+ }
+ $i++;
+ }
+ if ( $index === -1 ){
+ $data['error'] = "No perfdata found for ".$tmp_perflabel['label']."_".$type;
+ return_json($data, 901);
+ return;
+ }
+
+ $start = (string) $xpd->meta->start;
+ $end = (string) $xpd->meta->end;
+ $step = (string) $xpd->meta->step;
+ $data['targets'][$key][$hk]['start'] = $start * 1000;
+ $data['targets'][$key][$hk]['end'] = $end * 1000;
+ $data['targets'][$key][$hk]['host'] = $host;
+ $data['targets'][$key][$hk]['service'] = $service;
+ $data['targets'][$key][$hk]['perflabel'] = $tmp_perflabel['label'];
+ $data['targets'][$key][$hk]['type'] = $type;
+
+ $i = 0;
+ if($type == "WARNING" || $type == "CRITICAL") {
+ foreach ( $xpd->data->row as $row=>$value){
+ // timestamp in milliseconds
+ $timestamp = ( $start + $i * $step ) * 1000;
+ if($type == "WARNING") {
+ $d = floatval($tmp_perflabel['warn']);
+ } else {
+ $d = floatval($tmp_perflabel['crit']);
+ }
+ $data['targets'][$key][$hk]['datapoints'][] = array( $d, $timestamp );
+ $i++;
+ }
+ } else {
+ foreach ( $xpd->data->row as $row=>$value){
+ // timestamp in milliseconds
+ $timestamp = ( $start + $i * $step ) * 1000;
+ $d = (string) $value->v->$index;
+ if ($d == "NaN"){
+ $d = null;
+ }else{
+ $d = floatval($d);
+ }
+ $data['targets'][$key][$hk]['datapoints'][] = array( $d, $timestamp );
+ $i++;
+ }
+ }
+
+ $hk++;
+
+ }
+ }
+ }
+
+ return_json($data, 200);
+ }
+}
+/*
+* return array key
+*/
+function arr_get($array, $key=false, $default=false){
+ if ( isset($array) && $key == false ){
+ return $array;
+ }
+ $keys = explode(".", $key);
+ foreach ($keys as $key_part) {
+ if ( isset($array[$key_part] ) === false ) {
+ if (! is_array($array) or ! array_key_exists($key_part, $array)) {
+ return $default;
+ }
+ }
+ $array = $array[$key_part];
+ }
+ return $array;
+}
+
+/*
+*
+*/
+function return_json( $data, $status=200 ){
+ $json = json_encode($data);
+ header('Status: '.$status);
+ header('Content-type: application/json');
+ print $json;
+}
+
+function isRegex($string){
+ // if string looks like an regex /regex/
+ if ( substr($string,0,1) == "/" && substr($string,-1,1) == "/" && strlen($string) >= 2 ){
+ return true;
+ }else{
+ return false;
+ }
+}
+
+function getHosts($data, $query = false) {
+ $result = array();
+ $hosts = $data->getHosts();
+ $isRegex = false;
+ if ($query !== false && isRegex($query) ) {
+ $isRegex = true;
+ }
+ foreach ( $hosts as $host ){
+ if ( $host['state'] != 'active' ){
+ continue;
+ }
+ if($isRegex) {
+ if(preg_match("$query", $host['name']) ) {
+ $result[] = $host['name'];
+ }
+ }
+ elseif ($query !== false) {
+ if("$query" == $host['name']) {
+ $result[] = $host['name'];
+ }
+ } else {
+ $result[] = $host['name'];
+ }
+ }
+ return($result);
+}
+
+/*
+* returns list of service hashes
+*/
+function getServices($data, $hosts, $query = false) {
+ $result = array();
+ $isRegex = false;
+ if ($query !== false && isRegex($query) ) {
+ $isRegex = true;
+ }
+ foreach ( $hosts as $host){
+ $services = $data->getServices($host);
+ foreach ($services as $value) {
+ if ($isRegex) {
+ if ( preg_match("$query", $value['name']) || preg_match("$query", $value['servicedesc'])) {
+ $result[] = $value;
+ }
+ }
+ elseif ($query !== false) {
+ if("$query" == $value['name'] || "$query" == $value['servicedesc']) {
+ $result[] = $value;
+ }
+ } else {
+ $result[] = $value;
+ }
+ }
+ }
+ return($result);
+}

8
debian/patches/series vendored Normal file
View File

@ -0,0 +1,8 @@
apache-fix-path-to-userfile
fix-npcd-path
fix-nagios-url
adjust-template-path
config_instances
install_opts
hardening
pnp-metrics-api

1
debian/pnp4nagios-bin.examples vendored Normal file
View File

@ -0,0 +1 @@
debian/icinga/npcdmod.cfg

13
debian/pnp4nagios-bin.install vendored Normal file
View File

@ -0,0 +1,13 @@
etc/pnp4nagios/nagios.cfg
etc/pnp4nagios/check_commands/
etc/pnp4nagios/*.cfg
usr/lib/pnp4nagios/libexec/
usr/lib/pnp4nagios/npcdmod.o
../../scripts/verify_pnp_config_v2.pl /usr/lib/pnp4nagios/libexec/
usr/sbin/npcd
usr/share/doc/pnp4nagios/examples/*.cfg
usr/share/doc/pnp4nagios/examples/check_commands/
usr/share/man/man8/npcd.8
var/log/pnp4nagios/stats/
var/lib/pnp4nagios/perfdata/
var/spool/pnp4nagios/

7
debian/pnp4nagios-bin.npcd.default vendored Normal file
View File

@ -0,0 +1,7 @@
# Default settings for the NPCD init script.
# Should NPCD be started? ("yes" to enable)
RUN="no"
# Additional options that are passed to the daemon.
DAEMON_OPTS="-d -f /etc/pnp4nagios/npcd.cfg"

204
debian/pnp4nagios-bin.npcd.init vendored Normal file
View File

@ -0,0 +1,204 @@
#!/bin/sh
#
# init.d script for NPCD of PNP4Nagios
#
# Based on a example script of Javier Fernandez-Sanguino
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
# Copyright (c) 2009 Sven Velt <sven@velt.de>
#
### BEGIN INIT INFO
# Provides: npcd
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nagios Performance C Daemon
# Description: Speed up processing of Nagios' performance data
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/npcd
NAME=npcd
DESC="Nagios Performance C Daemon (PNP4Nagios)"
LOGDIR=/var/log/pnp4nagios
PIDFILE=/var/run/$NAME.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Default options, these can be overriden by the information
# at /etc/default/$NAME
DAEMON_OPTS=""
DIETIME=10
STARTTIME=2
LOGFILE=$LOGDIR/$NAME.log
# Include defaults if available
if [ -f /etc/default/npcd ] ; then
. /etc/default/npcd
fi
# Check if RUN is set to "yes" in /etc/defaults/npcd
if [ "x$RUN" != "xyes" ] ; then
echo "$NAME has been disabled in /etc/default/npcd."
exit 0
fi
set -e
# Check if a given process pid's cmdline matches a given name
running_pid() {
pid=$1
name=$2
[ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n" | head -n 1 | cut -d : -f 1`
# Is this the expected server
[ "$cmd" != "$name" ] && return 1
return 0
}
# Check if the process is running looking at /proc
# (works for all users)
running() {
# No pidfile, probably no daemon present
[ ! -f "$PIDFILE" ] && return 1
pid=`cat $PIDFILE`
running_pid $pid $DAEMON || return 1
return 0
}
# Start the process using the wrapper
start_server() {
start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
errcode=$?
return $errcode
}
# Stop the process using the wrapper
stop_server() {
killproc -p $PIDFILE $DAEMON
errcode=$?
return $errcode
}
reload_server() {
[ ! -f "$PIDFILE" ] && return 1
pid=pidofproc $PIDFILE # This is the daemon's pid
# Send a SIGHUP
kill -1 $pid
return $?
}
# Force the process to die killing it manually
force_stop() {
[ ! -e "$PIDFILE" ] && return
if running ; then
kill -15 $pid
# Is it really dead?
sleep "$DIETIME"s
if running ; then
kill -9 $pid
sleep "$DIETIME"s
if running ; then
echo "Cannot kill $NAME (pid=$pid)!"
exit 1
fi
fi
fi
rm -f $PIDFILE
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
# Check if it's running first
if running ; then
log_progress_msg "apparently already running"
log_end_msg 0
exit 0
fi
if start_server ; then
# NOTE: Some servers might die some time after they start,
# this code will detect this issue if STARTTIME is set
# to a reasonable value
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
if running ; then
# It's ok, the server started and is running
log_end_msg 0
else
# It is not running after we did start
log_end_msg 1
fi
else
# Either we could not start it
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if running ; then
# Only stop the server if we see it running
errcode=0
stop_server || errcode=$?
log_end_msg $errcode
else
# If it's not running don't do anything
log_progress_msg "apparently not running"
log_end_msg 0
exit 0
fi
;;
force-stop)
# First try to stop gracefully the program
$0 stop
if running; then
# If it's still running try to kill it more forcefully
log_daemon_msg "Stopping (force) $DESC" "$NAME"
errcode=0
force_stop || errcode=$?
log_end_msg $errcode
fi
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
errcode=0
stop_server || errcode=$?
# Wait some sensible amount, some server need this
[ -n "$DIETIME" ] && sleep $DIETIME
start_server || errcode=$?
[ -n "$STARTTIME" ] && sleep $STARTTIME
running || errcode=$?
log_end_msg $errcode
;;
status)
log_daemon_msg "Checking status of $DESC" "$NAME"
if running ; then
log_progress_msg "running"
log_end_msg 0
else
log_progress_msg "apparently not running"
log_end_msg 1
exit 1
fi
;;
# Use this if the daemon cannot reload
reload)
log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
log_warning_msg "cannot re-read the config file (use restart)."
exit 1
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,11 @@
# Default settings for the pnp_gearman_worker init script.
# Should the gearman worker daemon be started? ("yes" to enable)
RUN="no"
# Additional options that are passed to the daemon.
DAEMON_OPTS="--config=/etc/pnp4nagios/process_perfdata.cfg"
# Change to this user before starting the daemon.
# Note: the daemon refuses to start as root.
USER=nagios

View File

@ -0,0 +1,210 @@
#!/bin/sh
#
# init.d script for the Gearman worker daemon of PNP4Nagios
#
# Based on an example script for NPCD of Javier Fernandez-Sanguino
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
# Copyright (c) 2011 Sebastian Harl <tokkee@debian.org>
#
### BEGIN INIT INFO
# Provides: pnp_gearman_worker
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PNP4Nagios Gearman worker daemon
# Description: Processing of Nagios' perf data in distributed setups
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/lib/pnp4nagios/libexec/process_perfdata.pl
NAME=pnp_gearman_worker
DESC="PNP4Nagios Gearman worker daemon"
PIDFILE=/var/run/pnp4nagios/$NAME.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Default options, these can be overriden by the information
# at /etc/default/$NAME
DAEMON_OPTS=""
DIETIME=10
STARTTIME=2
USER=nagios
if [ -f /etc/default/pnp_gearman_worker ] ; then
. /etc/default/pnp_gearman_worker
fi
if [ "x$RUN" != "xyes" ] ; then
echo "$NAME has been disabled in /etc/default/pnp_gearman_worker."
exit 0
fi
set -e
# Check if a given process pid's cmdline matches a given name
running_pid() {
pid=$1
name=$2
[ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n" | head -n 1 | cut -d : -f 1`
# Is this the expected server
[ "$cmd" != "$name" ] && return 1
return 0
}
# Check if the process is running looking at /proc
# (works for all users)
running() {
# No pidfile, probably no daemon present
[ ! -f "$PIDFILE" ] && return 1
pid=`cat $PIDFILE`
running_pid "$pid" $DAEMON \
|| running_pid "$pid" "/usr/bin/perl" || return 1
return 0
}
# Start the process using the wrapper
start_server() {
if ! perl -MGearman::Worker -e '1;' > /dev/null 2>&1 \
|| ! perl -MMIME::Base64 -e '1;' > /dev/null 2>&1 \
|| ! perl -MCrypt::Rijndael -e '1;' > /dev/null 2>&1; then
echo "$NAME requires the Gearman::Worker, MIME::Base64 and" >&2
echo "Crypt::Rijndael Perl modules. Make sure that the packages" >&2
echo "perl, libgearman-client-perl and libcrypt-rijndael-perl" >&2
echo "are installed." >&2
exit 1
fi
if [ -d /var/run/pnp4nagios ]; then
chmod 755 /var/run/pnp4nagios
chown nagios.nagios /var/run/pnp4nagios
else
install -d -m 755 -o nagios -g nagios /var/run/pnp4nagios
fi
start_opts="--start --quiet --oknodo --pidfile $PIDFILE"
if [ -n "$USER" ]; then
start_opts="$start_opts --chuid $USER"
fi
start-stop-daemon $start_opts --exec $DAEMON -- \
--pidfile=$PIDFILE --gearman --daemon $DAEMON_OPTS
errcode=$?
return $errcode
}
# Stop the process using the wrapper
stop_server() {
killproc -p $PIDFILE $DAEMON
errcode=$?
return $errcode
}
# Force the process to die killing it manually
force_stop() {
[ ! -e "$PIDFILE" ] && return
if running ; then
kill -15 $pid
# Is it really dead?
sleep "$DIETIME"s
if running ; then
kill -9 $pid
sleep "$DIETIME"s
if running ; then
echo "Cannot kill $NAME (pid=$pid)!"
exit 1
fi
fi
fi
rm -f $PIDFILE
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
# Check if it's running first
if running ; then
log_progress_msg "apparently already running"
log_end_msg 0
exit 0
fi
if start_server ; then
# NOTE: Some servers might die some time after they start,
# this code will detect this issue if STARTTIME is set
# to a reasonable value
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
if running ; then
# It's ok, the server started and is running
log_end_msg 0
else
# It is not running after we did start
log_end_msg 1
fi
else
# Either we could not start it
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if running ; then
# Only stop the server if we see it running
errcode=0
stop_server || errcode=$?
log_end_msg $errcode
else
# If it's not running don't do anything
log_progress_msg "apparently not running"
log_end_msg 0
exit 0
fi
;;
force-stop)
# First try to stop gracefully the program
$0 stop
if running; then
# If it's still running try to kill it more forcefully
log_daemon_msg "Stopping (force) $DESC" "$NAME"
errcode=0
force_stop || errcode=$?
log_end_msg $errcode
fi
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
errcode=0
stop_server || errcode=$?
# Wait some sensible amount, some server need this
[ -n "$DIETIME" ] && sleep $DIETIME
start_server || errcode=$?
[ -n "$STARTTIME" ] && sleep $STARTTIME
running || errcode=$?
log_end_msg $errcode
;;
status)
log_daemon_msg "Checking status of $DESC" "$NAME"
if running ; then
log_progress_msg "running"
log_end_msg 0
else
log_progress_msg "apparently not running"
log_end_msg 1
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

78
debian/pnp4nagios-bin.postinst vendored Normal file
View File

@ -0,0 +1,78 @@
#!/bin/sh
# postinst script for pnp4nagios-bin
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
setperm() {
user="$1"
group="$2"
mode="$3"
file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
case "$1" in
configure)
if ! getent passwd nagios > /dev/null ; then
echo 'Adding system-user for nagios' 1>&2
adduser --system --group --home /var/lib/nagios \
--disabled-login --force-badname nagios > /dev/null
fi
setperm nagios www-data 750 /var/lib/pnp4nagios
setperm nagios nagios 755 /var/lib/pnp4nagios/perfdata
setperm nagios www-data 750 /var/log/pnp4nagios
setperm nagios nagios 750 /var/log/pnp4nagios/stats
setperm nagios nagios 770 /var/spool/pnp4nagios
setperm nagios nagios 770 /var/spool/pnp4nagios/nagios
setperm nagios nagios 770 /var/spool/pnp4nagios/npcd
setperm root nagios 640 /etc/pnp4nagios/process_perfdata.cfg
if [ -d /etc/nagios4/conf.d/ ]; then
if [ ! -e /etc/nagios4/conf.d/pnp4nagios.cfg ]; then
ln -s /etc/pnp4nagios/nagios.cfg /etc/nagios4/conf.d/pnp4nagios.cfg
fi
fi
if [ -d /etc/icinga/objects/ ]; then
if [ ! -e /etc/icinga/objects/pnp4nagios.cfg ]; then
ln -s /etc/pnp4nagios/nagios.cfg /etc/icinga/objects/pnp4nagios.cfg
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

57
debian/pnp4nagios-bin.postrm vendored Normal file
View File

@ -0,0 +1,57 @@
#!/bin/sh
# postrm script for pnp4nagios-bin
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove)
if [ -d /etc/nagios4/conf.d/ ]; then
if [ -L /etc/nagios4/conf.d/pnp4nagios.cfg ]; then
ls -l /etc/nagios4/conf.d/pnp4nagios.cfg | grep -q /etc/pnp4nagios/nagios.cfg
if [ $? -eq 0 ]; then
rm -f /etc/nagios4/conf.d/pnp4nagios.cfg
fi
fi
fi
if [ -d /etc/icinga/objects/ ]; then
if [ -L /etc/icinga/objects/pnp4nagios.cfg ]; then
ls -l /etc/icinga/objects/pnp4nagios.cfg | grep -q /etc/pnp4nagios/nagios.cfg
if [ $? -eq 0 ]; then
rm -f /etc/icinga/objects/pnp4nagios.cfg
fi
fi
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,2 @@
debian/icinga/config.icinga.php etc/pnp4nagios
debian/icinga/pnp4nagios.conf etc/apache2/conf-available

View File

@ -0,0 +1,7 @@
# ignoring apache2 warning
# this is actually not a problem, because the handling is backwards compatible
apache2-reverse-dependency-calls-invoke-rc.d postrm
apache2-reverse-dependency-calls-wrapper-script postinst a2enmod
apache2-reverse-dependency-calls-invoke-rc.d postinst
# we actually want that
non-standard-apache2-configuration-name pnp4nagios.conf != pnp4nagios-web-config-icinga.conf

View File

@ -0,0 +1,63 @@
#!/bin/sh
# postinst script for pnp4nagios-web-config-icinga
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
echo "enabling Apache2 config..."
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
# NEW method for Apache >= 2.4
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod rewrite
apache2_invoke enconf pnp4nagios
# remove OLD Apache 2.2 link
[ -L /etc/apache2/conf.d/pnp4nagios-web.conf ] && rm /etc/apache2/conf.d/pnp4nagios-web.conf
# OLD methods for Apache < 2.4
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
# enable mod rewrite
[ -f /etc/apache2/mods-enabled/rewrite.load ] || a2enmod rewrite
# create symlink if not existing
[ -f /etc/apache2/conf.d/pnp4nagios.conf ] || ln -vs ../conf-available/pnp4nagios.conf /etc/apache2/conf.d/pnp4nagios.conf
# reload webserver
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,54 @@
#!/bin/sh
# postrm script for pnp4nagios-web-config-icinga
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove)
# Apache2
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
echo "disabling Apache2 configuration ..."
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke disconf pnp4nagios-web
fi
if [ -L /etc/apache2/conf.d/pnp4nagios-web.conf ]; then
echo "removing link /etc/apache2/conf.d/pnp4nagios-web.conf ..."
# remove link to config
rm -f /etc/apache2/conf.d/pnp4nagios-web.conf
# reload webserver
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload || true
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,2 @@
debian/nagios4/config.nagios4.php etc/pnp4nagios
debian/nagios4/pnp4nagios.conf etc/apache2/conf-available

View File

@ -0,0 +1,7 @@
# ignoring apache2 warning
# this is actually not a problem, because the handling is backwards compatible
apache2-reverse-dependency-calls-invoke-rc.d postrm
apache2-reverse-dependency-calls-wrapper-script postinst a2enmod
apache2-reverse-dependency-calls-invoke-rc.d postinst
# we actually want that
non-standard-apache2-configuration-name pnp4nagios.conf != pnp4nagios-web-config-nagios4.conf

View File

@ -0,0 +1,63 @@
#!/bin/sh
# postinst script for pnp4nagios-web-config-nagios4
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
echo "enabling Apache2 config..."
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
# NEW method for Apache >= 2.4
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod rewrite
apache2_invoke enconf pnp4nagios
# remove OLD Apache 2.2 link
[ -L /etc/apache2/conf.d/pnp4nagios-web.conf ] && rm /etc/apache2/conf.d/pnp4nagios-web.conf
# OLD methods for Apache < 2.4
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
# enable mod rewrite
[ -f /etc/apache2/mods-enabled/rewrite.load ] || a2enmod rewrite
# create symlink if not existing
[ -f /etc/apache2/conf.d/pnp4nagios.conf ] || ln -vs ../conf-available/pnp4nagios.conf /etc/apache2/conf.d/pnp4nagios.conf
# reload webserver
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@ -0,0 +1,54 @@
#!/bin/sh
# postrm script for pnp4nagios-web-config-nagios4
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove)
# Apache2
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
echo "disabling Apache2 configuration ..."
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke disconf pnp4nagios-web
fi
if [ -L /etc/apache2/conf.d/pnp4nagios-web.conf ]; then
echo "removing link /etc/apache2/conf.d/pnp4nagios-web.conf ..."
# remove link to config
rm -f /etc/apache2/conf.d/pnp4nagios-web.conf
# reload webserver
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload || true
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

1
debian/pnp4nagios-web.examples vendored Normal file
View File

@ -0,0 +1 @@
sample-config/httpd.conf

14
debian/pnp4nagios-web.install vendored Normal file
View File

@ -0,0 +1,14 @@
etc/pnp4nagios/config.php
etc/pnp4nagios/background.pdf
etc/pnp4nagios/templates/
etc/pnp4nagios/templates.d/
etc/pnp4nagios/pages/
etc/pnp4nagios/templates.special/
etc/pnp4nagios/pnp4nagios_release
usr/share/doc/pnp4nagios/examples/templates.special/
usr/share/doc/pnp4nagios/examples/pages/
usr/share/doc/pnp4nagios/examples/ssi/
usr/share/pnp4nagios/html/
usr/lib/pnp4nagios/kohana/
var/log/pnp4nagios/kohana/
var/lib/pnp4nagios/

60
debian/pnp4nagios-web.postinst vendored Normal file
View File

@ -0,0 +1,60 @@
#!/bin/sh
# postinst script for pnp4nagios-web
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
setperm() {
user="$1"
group="$2"
mode="$3"
file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
case "$1" in
configure)
if ! getent passwd nagios > /dev/null ; then
echo 'Adding system-user for nagios' 1>&2
adduser --system --group --home /var/lib/nagios \
--disabled-login --force-badname nagios > /dev/null
fi
setperm nagios www-data 750 /var/lib/pnp4nagios
setperm nagios nagios 755 /var/lib/pnp4nagios/perfdata
setperm nagios www-data 750 /var/log/pnp4nagios
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

113
debian/rules vendored Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/make -f
# debian/rules for PNP4Nagios
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS += -Wextra
%:
dh $@ --with autoreconf,autotools_dev
override_dh_auto_configure:
dh_auto_configure -- \
--with-layout=debian \
--mandir=/usr/share/man \
--infodir=/usr/share/info
# --without-kohana \
# --with-kohana_system=/usr/share/php/kohana2/system
override_dh_auto_build:
dh_auto_build -- all
#python -m jsmin share/pnp/media/js/jquery.imgareaselect.js \
# > share/pnp/media/js/jquery.imgareaselect.min.js
override_dh_auto_install:
dh_auto_install -- install-config
# Ignore install.php (for future debugging don't delete it)
touch debian/tmp/usr/share/pnp4nagios/html/install.ignore
mkdir -p debian/tmp/usr/share/doc/pnp4nagios/examples/
# Move template config dir to /etc/pnp4nagios/templates
rmdir debian/tmp/usr/share/pnp4nagios/html/templates
mkdir debian/tmp/etc/pnp4nagios/templates
mv debian/tmp/usr/share/pnp4nagios/html/templates.special \
debian/tmp/usr/share/doc/pnp4nagios/examples/
mkdir debian/tmp/etc/pnp4nagios/templates.special
mkdir -p debian/tmp/usr/sbin/
mv debian/tmp/usr/bin/npcd \
debian/tmp/usr/sbin/
mv debian/tmp/etc/pnp4nagios/rra.cfg-sample \
debian/tmp/etc/pnp4nagios/rra.cfg
mv debian/tmp/etc/pnp4nagios/nagios.cfg-sample \
debian/tmp/usr/share/doc/pnp4nagios/examples/nagios.cfg
mv debian/tmp/etc/pnp4nagios/misccommands.cfg-sample \
debian/tmp/usr/share/doc/pnp4nagios/examples/misccommands.cfg
mkdir debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands
mv debian/tmp/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \
debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg
mkdir debian/tmp/usr/share/doc/pnp4nagios/examples/pages
mv debian/tmp/etc/pnp4nagios/pages/web_traffic.cfg-sample \
debian/tmp/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg
cp -av contrib/ssi debian/tmp/usr/share/doc/pnp4nagios/examples/
rm -fv debian/tmp/usr/share/doc/pnp4nagios/examples/ssi/*.in
# Icinga module sample configuration
cp debian/icinga-module.cfg debian/tmp/usr/share/doc/pnp4nagios/examples/
# Remove external PHP classes/libraries: FPDF, FPDF-TPL, FPDI
#rm -r debian/tmp/usr/share/pnp4nagios/html/application/vendor/fpdf
# remove source files
#rm -f debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.Debian.txt
#rm -f debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.js
# Remove external JavaScript files: jQuery and jQuery-UI
# no longer present in DFSG tarball
#rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-min.js
#rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-ui.min.js
# Clean up some files
rmdir debian/tmp/usr/bin
mv debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg-sample \
debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg
rm debian/tmp/etc/pnp4nagios/check_commands/check_nrpe.cfg-sample
# Add Debian specific config and placeholder files
#touch debian/tmp/etc/pnp4nagios/pages/.placeholder
cp -av debian/nagios.cfg debian/tmp/etc/pnp4nagios/
cp -av debian/check_commands/* debian/tmp/etc/pnp4nagios/check_commands/
# Remove unnecessary config files (duplicates)
rm -f debian/tmp/etc/pnp4nagios/config_local.php
rm -f debian/tmp/etc/pnp4nagios/config.php.0.6*
# Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes
mkdir debian/tmp/var/spool/pnp4nagios/nagios
mkdir debian/tmp/var/spool/pnp4nagios/npcd
# Delete not used and empty directories
#rmdir debian/tmp/usr/share/pnp4nagios/html/application/logs/
rmdir debian/tmp/usr/share/pnp4nagios/html/application/cache/
rmdir debian/tmp/usr/share/pnp4nagios/html/application/hooks/
#rmdir debian/tmp/usr/share/pnp4nagios/html/application/libraries/
mkdir debian/tmp/etc/pnp4nagios/templates.d
cp debian/README.templates.d debian/tmp/etc/pnp4nagios/templates.d/README
override_dh_installinit:
dh_installinit -ppnp4nagios-bin --name=npcd
dh_installinit -ppnp4nagios-bin --name=pnp_gearman_worker
# vi: noexpandtab ts=4 sw=4 :

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

3
debian/watch vendored Normal file
View File

@ -0,0 +1,3 @@
version=3
opts="dversionmangle=s/\+dfsg\d*//,uversionmangle=s/\.rc/~rc/" \
http://sf.net/pnp4nagios/pnp4nagios-(.+)\.tar\.gz

View File

@ -1044,6 +1044,7 @@ sub parse_perfstring {
my $check_multi_blockcount = 0;
my $multi_parent = cleanup( $NAGIOS{SERVICEDESC} );
my $auth_servicedesc = $NAGIOS{DISP_SERVICEDESC};
my $seen_multi_label = "";
while ($perfstring) {
( $perfstring, %p ) = _parse($perfstring);
if ( !$p{label} ) {
@ -1052,8 +1053,19 @@ sub parse_perfstring {
@perfs = ();
last;
}
if ( $p{label} =~ /$seen_multi_label/ ) {
# multi label format for each perfdata item (e.g Icinga2)
# we're in a sub tree of a multi block, adjust label for further processing
my $tmp_prefix = $seen_multi_label."::";
$p{label} =~ s/$tmp_prefix//;
}
if ( $p{label} =~ /^[']?([a-zA-Z0-9\.\-_\s\/\#]+)::([a-zA-Z0-9\.\-_\s]+)::([^=]+)[']?$/ ) {
@multi = ( $1, $2, $3 );
$seen_multi_label = $multi[0]."::".$multi[1];
if ( $count == 0 ) {
print_log( "DEBUG: First check_multi block", 3 );

View File

@ -1,9 +1,9 @@
#!@SHELL@
#
#
### BEGIN INIT INFO
# Provides: npcd
# Required-Start:
# Required-Stop:
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: @PKG_NAME@ NPCD Daemon Version @PKG_VERSION@
@ -14,7 +14,7 @@
#
# File : npcd
#
servicename=@npcd_name@
prefix=@prefix@
exec_prefix=${prefix}
@ -47,10 +47,10 @@ printstatus_npcd(){
exit 0
elif test $? -eq 2; then
echo "$servicename is not running but subsystem locked"
exit 2
exit 3
else
echo "$servicename is not running"
exit 1
exit 3
fi
}
@ -86,7 +86,7 @@ if [ ! -f $NpcdCfgFile ]; then
echo "Configuration file $NpcdCfgFile not found. Exiting."
exit 1
fi
# See how we were called.
case "$1" in
@ -94,7 +94,7 @@ case "$1" in
status_npcd
if [ $? -eq 0 ]; then
echo "$servicename already started..."
exit 1
exit 0
fi
echo -n "Starting $servicename:"
touch $NpcdRunFile
@ -109,7 +109,7 @@ case "$1" in
status_npcd
if ! [ $? -eq 0 ]; then
echo "$servicename was not running... could not stop"
exit 1
exit 0
fi
echo -n "Stopping $servicename: "
@ -136,7 +136,7 @@ case "$1" in
else
echo 'done.'
fi
rm -f $NpcdLockDir/$NpcdLockFile
rm -f $NpcdLockDir/$NpcdLockFile
;;
status)
@ -158,5 +158,5 @@ case "$1" in
;;
esac
# End of this script

View File

@ -49,7 +49,7 @@ my %conf = (
);
Getopt::Long::Configure('bundling');
my ( $opt_V, $opt_h, $opt_c, $opt_l, $opt_x, $opt_p );
my ( $opt_V, $opt_h, $opt_c, $opt_l, $opt_x, $opt_p, $opt_s, $opt_o, $opt_r );
# defaults
$opt_x = 1;
@ -59,15 +59,22 @@ GetOptions(
"c|check_command=s" => \$opt_c,
"p|cfg_dir=s" => \$opt_p,
"l|list_commands" => \$opt_l,
"s|stepwise" => \$opt_s,
"x|no_structure_check" => \$opt_x,
"o|log_old_xml" => \$opt_o,
"d|dry-run" => \$conf{DRY_RUN},
"t|tmp_dir=s" => \$conf{TMP_DIR},
"force" => \$conf{FORCE},
"r|read=s" => \$opt_r,
);
if (defined($opt_r)) {
$opt_c = "ALL";
}
print_help() if $opt_h;
print_help_opt_p() if !$opt_p;
print_help() if !$opt_c and !$opt_l;
print_help() if (!$opt_c and !$opt_l) and (!$opt_r);
print_version() if $opt_V;
if($opt_p){
@ -100,14 +107,22 @@ main();
sub main{
check_storage_type();
find(\&wanted_xml_files, $conf{RRDPATH});
if ($opt_o) {
create_dir($conf{TMP_DIR});
open(OLDXMLLOG, ">", $conf{TMP_DIR}."/pnp_old_xml_files.list");
print OLDXMLLOG "- generated by rrd_convert.pl - \n";
print OLDXMLLOG "The following XML files are older than $conf{XML_MAX_AGE} seconds:\n\n";
}
build_worklist();
close(OLDXMLLOG);
summary();
if($opt_l){ # List commands and exit
summary_command_list();
exit;
}
if($#worklist+1 > 0 ){
my $answer = read_choice("Start Converter [n|y]?");
my $question = "Start converter? " . ($opt_s ? "(Each conversion will be prompted.) " : "");
my $answer = read_choice($question . "[n|y]");
unless ( $answer =~ m/^y$/i ){
print "Exit...\n";
exit;
@ -123,7 +138,16 @@ sub main{
write_custom_template();
my $t0 = [gettimeofday];
my $i = 0;
my $answered = "";
foreach my $xmlfile ( @worklist ) {
if($opt_s && ($answered !~ $xmlfile)){
my $answer = read_choice("Continue with $xmlfile [n|y]?");
unless ( $answer =~ m/^y$/i ){
print "Exit... (remember to remove the custom template, if created in this run!)\n";
exit;
}
$answered = $xmlfile;
}
$i++;
undef %ds_list;
undef %original_ds_list;
@ -183,43 +207,72 @@ sub check_ds_list{
}
}
sub wanted_xml_files{
sub build_worklist {
if ($opt_r) {
process_xml_files($opt_r);
close XMLLIST;
}else{
find(\&find_xml_files, $conf{RRDPATH});
}
}
# bulk mode, find all XML files
sub find_xml_files{
if(m/.xml$/){
#printf("File: %s\n",$File::Find::name);
my $xmlfile = $File::Find::name;
my ($rrdfile) = $xmlfile =~ /^(.*)\.xml$/;
$rrdfile .= ".rrd";
my $mtime = (stat($xmlfile))[9];
if ( $mtime < $max_age ){
$stats{old_xml}++;
return;
}
open(XML, $xmlfile);
while (<XML>) {
if(/TEMPLATE>(.*)</){
my ($t) = split("!",$1);
push(@commands,$t);
if(( defined $opt_c) and ($t =~ /^$opt_c$/)){
if( -e $rrdfile ){
#print "Found: ".$t." in ".$xmlfile."\n";
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}elsif(( defined $opt_c) and ($opt_c eq 'ALL')){
if( -e $rrdfile ){
# Keyword 'ALL' retunrs all XML Files
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}
}
}
close(XML);
xml2worklist($File::Find::name);
}
}
# file mode, process file with XML filenames
sub process_xml_files{
my $xmllist = shift;
-r $xmllist or die "Cannot open $xmllist: $!";
open XMLLIST, "<$opt_r";
foreach (<XMLLIST>) {
my $file = $_;
chomp($file);
m/.xml$/ && xml2worklist($file);
}
}
sub xml2worklist {
my $xmlfile = shift;
my ($rrdfile) = $xmlfile =~ /^(.*)\.xml$/;
$rrdfile .= ".rrd";
my $mtime = (stat($xmlfile))[9];
if ( $mtime < $max_age ){
$stats{old_xml}++;
if ($opt_o) {
print OLDXMLLOG $xmlfile . ": " . scalar localtime($mtime) ."\n";
}
return;
}
open(XML, $xmlfile);
while (<XML>) {
if(/TEMPLATE>(.*)</){
my ($t) = split("!",$1);
push(@commands,$t);
if(( defined $opt_c) and ($t =~ /^$opt_c$/)){
if( -e $rrdfile ){
#print "Found: ".$t." in ".$xmlfile."\n";
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}elsif (( defined $opt_c) and ($opt_c eq 'ALL') ) {
if( -e $rrdfile ){
# Keyword 'ALL' retunrs all XML Files
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}
}
}
close(XML);
}
sub parse_xml_filename{
my $xmlfile = shift;
$_ = $xmlfile;
@ -327,7 +380,7 @@ sub restore_files(){
sub backup_rrd_file{
my $rrdfile = shift;
if ( $conf{RRD_BACKUP} == 1 ){
if ( $conf{RRD_BACKUP} == 1 && $conf{'DRY_RUN'} == 0 ){
move($rrdfile, $rrdfile.".backup");
}
}
@ -479,7 +532,7 @@ sub change_config {
sub check_storage_type{
if($conf{'RRD_STORAGE_TYPE'} eq "MULTIPLE"){
print "RRD_STORAGE_TYPE is already set to ".$conf{'RRD_STORAGE_TYPE'}."\n";
print "RRD_STORAGE_TYPE is already globally set to ".$conf{'RRD_STORAGE_TYPE'}."\n";
}
}
sub check_custom_template {
@ -500,6 +553,8 @@ sub check_custom_template {
}
sub write_custom_template {
# do not write custom template in --read mode
return if $opt_r;
my $command = $opt_c;
if ( $conf{DRY_RUN} == 1 ){
print "No config check while DRY_RUN = 1\n";
@ -535,8 +590,11 @@ sub print_help{
print " [ --dry-run ]\n";
print " [ --tmp_dir=<temp directory> ]\n";
print " [ --no_structure_check ]\n";
print " [ --log_old_xml ]\n";
print " [ --stepwise ]\n";
print " [ --read=<file with XML filenames> ]\n";
print "\n";
print "This script is used to switch to RRD_STORAGE_TYPE = MULTIPLE for a given Nagios Check Command\n";
print "This script is used to switch to RRD_STORAGE_TYPE = MULTIPLE for all RRDs/a given Nagios Check Command/single RRDs \n";
print "More info online http://docs.pnp4nagios.org/pnp-0.6/rrd_convert\n";
exit;
}

View File

@ -82,7 +82,7 @@ $no = 1 unless (defined $no);
my $ds = `$rrdtool info $rrd | grep '^ds' | grep 'value' | wc -l`;
# determine the decimal sign
$sign = `$rrdtool info $rrd | grep '^ds' | grep 'value' | tail -1`;
($sign) = $sign =~ /.* \d(.)\d+/;
($sign) = $sign =~ /.* -?\d(.)\d+/;
my $end = ($action eq "insert" ? $ds+$no : $ds);
if (($start < 1) or ($start > $ds + 1)) {
print "ERROR: number ($start) must be within 1..".($ds+1)."\n";
@ -188,7 +188,7 @@ sub processing {
next;
}
# value enclosed in XML tags
if (/<(\S+)>\s+(\S+)\s+</) {
if (/<(\S+)>\s*(\S+)\s*</) {
$xml{$1} = $2;
}
next unless ($out);

View File

@ -28,6 +28,12 @@ class Image_Controller extends System_Controller {
if($this->input->get('graph_height') != "" )
$this->rrdtool->config->conf['graph_height'] = intval($this->input->get('graph_height'));
if($this->input->get('graph_only') !== null)
$this->rrdtool->config->conf['graph_only'] = 1;
if($this->input->get('no_legend') !== null)
$this->rrdtool->config->conf['no_legend'] = 1;
$this->data->getTimeRange($this->start,$this->end,$this->view);
if($this->tpl != ""){

View File

@ -121,6 +121,7 @@ class pnp_Core {
preg_match('/^(-?[0-9\.,]+)\s*(\S?)(\S?)/',$value,$matches);
$mag = 0;
$value = $matches[1];
while ($value >= $base){
$value /= $base;
$mag++;

View File

@ -444,6 +444,35 @@ class rrd_Core {
return $line;
}
# http://stackoverflow.com/questions/3512311/how-to-generate-lighter-darker-color-with-php
public static function colbright($hex, $steps) {
if($hex === FALSE){
throw new Kohana_exception("rrd::". __FUNCTION__ . "() First Parameter 'hex' is missing");
}
if($steps === FALSE){
throw new Kohana_exception("rrd::". __FUNCTION__ . "() Second Parameter 'steps' is missing");
}
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps));
// Normalize into a six character long hex string
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
}
// Split into three parts: R, G and B
$color_parts = str_split($hex, 2);
$return = '#';
foreach ($color_parts as $color) {
$color = hexdec($color); // Convert to decimal
$color = max(0,min(255,$color + $steps)); // Adjust color
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
}
return $return;
}
public static function debug($data=FALSE){
if($data != FALSE){
ob_start();

View File

@ -1019,13 +1019,23 @@ class Data_Model extends System_Model
foreach($xml->meta->legend->entry as $key=>$value){
$csv .= ";" . $value ;
}
/*
* from rrdtool 1.5 on, timestamp ( value->t ) is not set anymore
* from 1.6 on it can be reactivated by -- showrime option to rrdtool xport
* here we take care of the timestamp ourselves regardless which
* rrdtool version is used
*/
$timestamp2 = $xml->meta->start;
$step = $xml->meta->step;
$csv .= "\n";
foreach($xml->data->row as $key=>$value){
$csv .= (string) $value->t ;
$csv .= $timestamp2;
foreach($value->v as $item){
$csv .= ";".floatval((string) $item);
}
$csv .= "\n";
$timestamp2 = $timestamp2 + $step;
}
return $csv;
}

View File

@ -106,8 +106,11 @@ class Rrdtool_Model extends System_Model
if ($height > 0){
$command .= " --height=$height";
}
if ($height < 81 ){
$command .= " --only-graph ";
if ($height < 81 || (isset($conf['graph_only']) && $conf['graph_only'])){
$command .= " --only-graph";
}
elseif (isset($conf['no_legend']) && $conf['no_legend']){
$command .= " --no-legend";
}
$command .= $RRD_CMD;

21
share/pnp/application/vendor/fpdf/LICENSE vendored Executable file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Setasign - Jan Slabon, https://www.setasign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,30 @@
{
"name": "setasign/fpdi",
"version": "1.6.1",
"homepage": "https://www.setasign.com/fpdi",
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
"type": "library",
"keywords": ["pdf", "fpdi", "fpdf"],
"license": "MIT",
"authors": [
{
"name": "Jan Slabon",
"email": "jan.slabon@setasign.com",
"homepage": "https://www.setasign.com"
}
],
"autoload": {
"classmap": [
"filters/",
"fpdi.php",
"fpdf_tpl.php",
"fpdi_pdf_parser.php",
"pdf_context.php"
]
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
}
}

View File

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>__construct</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>__construct</h1>
<code>__construct([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> size]]])</code>
<h2>Description</h2>
This is the class constructor. It allows to set up the page size, the orientation and the
unit of measure used in all methods (except for font sizes).
<h2>Parameters</h2>
<dl class="param">
<dt><code>orientation</code></dt>
<dd>
Default page orientation. Possible values are (case insensitive):
<ul>
<li><code>P</code> or <code>Portrait</code></li>
<li><code>L</code> or <code>Landscape</code></li>
</ul>
Default value is <code>P</code>.
</dd>
<dt><code>unit</code></dt>
<dd>
User unit. Possible values are:
<ul>
<li><code>pt</code>: point</li>
<li><code>mm</code>: millimeter</li>
<li><code>cm</code>: centimeter</li>
<li><code>in</code>: inch</li>
</ul>
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
is a very common unit in typography; font sizes are expressed in that unit.
<br>
<br>
Default value is <code>mm</code>.
</dd>
<dt><code>size</code></dt>
<dd>
The size used for pages. It can be either one of the following values (case insensitive):
<ul>
<li><code>A3</code></li>
<li><code>A4</code></li>
<li><code>A5</code></li>
<li><code>Letter</code></li>
<li><code>Legal</code></li>
</ul>
or an array containing the width and the height (expressed in the unit given by <code>unit</code>).<br>
<br>
Default value is <code>A4</code>.
</dd>
</dl>
<h2>Example</h2>
Example with a custom 100x150 mm page size:
<div class="doc-source">
<pre><code>$pdf = new FPDF('P','mm',array(100,150));</code></pre>
</div>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AcceptPageBreak</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AcceptPageBreak</h1>
<code><b>boolean</b> AcceptPageBreak()</code>
<h2>Description</h2>
Whenever a page break condition is met, the method is called, and the break is issued or not
depending on the returned value. The default implementation returns a value according to the
mode selected by SetAutoPageBreak().
<br>
This method is called automatically and should not be called directly by the application.
<h2>Example</h2>
The method is overriden in an inherited class in order to obtain a 3 column layout:
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
var $col = 0;
function SetCol($col)
{
// Move position to a column
$this-&gt;col = $col;
$x = 10+$col*65;
$this-&gt;SetLeftMargin($x);
$this-&gt;SetX($x);
}
function AcceptPageBreak()
{
if($this-&gt;col&lt;2)
{
// Go to next column
$this-&gt;SetCol($this-&gt;col+1);
$this-&gt;SetY(10);
return false;
}
else
{
// Go back to first column and issue page break
$this-&gt;SetCol(0);
return true;
}
}
}
$pdf = new PDF();
$pdf-&gt;AddPage();
$pdf-&gt;SetFont('Arial','',12);
for($i=1;$i&lt;=300;$i++)
$pdf-&gt;Cell(0,5,"Line $i",0,1);
$pdf-&gt;Output();</code></pre>
</div>
<h2>See also</h2>
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddFont</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddFont</h1>
<code>AddFont(<b>string</b> family [, <b>string</b> style [, <b>string</b> file]])</code>
<h2>Description</h2>
Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font
definition file first with the MakeFont utility.
<br>
The definition file (and the font file itself when embedding) must be present in the font directory.
If it is not found, the error "Could not include font definition file" is raised.
<h2>Parameters</h2>
<dl class="param">
<dt><code>family</code></dt>
<dd>
Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
override the corresponding font.
</dd>
<dt><code>style</code></dt>
<dd>
Font style. Possible values are (case insensitive):
<ul>
<li>empty string: regular</li>
<li><code>B</code>: bold</li>
<li><code>I</code>: italic</li>
<li><code>BI</code> or <code>IB</code>: bold italic</li>
</ul>
The default value is regular.
</dd>
<dt><code>file</code></dt>
<dd>
The font definition file.
<br>
By default, the name is built from the family and style, in lower case with no space.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I');</code></pre>
</div>
is equivalent to:
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I','comici.php');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddLink</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddLink</h1>
<code><b>int</b> AddLink()</code>
<h2>Description</h2>
Creates a new internal link and returns its identifier. An internal link is a clickable area
which directs to another place within the document.
<br>
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is
defined with SetLink().
<h2>See also</h2>
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="image.htm">Image</a>,
<a href="link.htm">Link</a>,
<a href="setlink.htm">SetLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddPage</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddPage</h1>
<code>AddPage([<b>string</b> orientation [, <b>mixed</b> size [, <b>int</b> rotation]]])</code>
<h2>Description</h2>
Adds a new page to the document. If a page is already present, the Footer() method is called
first to output the footer. Then the page is added, the current position set to the top-left
corner according to the left and top margins, and Header() is called to display the header.
<br>
The font which was set before calling is automatically restored. There is no need to call
SetFont() again if you want to continue with the same font. The same is true for colors and
line width.
<br>
The origin of the coordinate system is at the top-left corner and increasing ordinates go
downwards.
<h2>Parameters</h2>
<dl class="param">
<dt><code>orientation</code></dt>
<dd>
Page orientation. Possible values are (case insensitive):
<ul>
<li><code>P</code> or <code>Portrait</code></li>
<li><code>L</code> or <code>Landscape</code></li>
</ul>
The default value is the one passed to the constructor.
</dd>
<dt><code>size</code></dt>
<dd>
Page size. It can be either one of the following values (case insensitive):
<ul>
<li><code>A3</code></li>
<li><code>A4</code></li>
<li><code>A5</code></li>
<li><code>Letter</code></li>
<li><code>Legal</code></li>
</ul>
or an array containing the width and the height (expressed in user unit).<br>
<br>
The default value is the one passed to the constructor.
</dd>
<dt><code>rotation</code></dt>
<dd>
Angle by which to rotate the page. It must be a multiple of 90; positive values
mean clockwise rotation. The default value is <code>0</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="__construct.htm">__construct</a>,
<a href="header.htm">Header</a>,
<a href="footer.htm">Footer</a>,
<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AliasNbPages</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AliasNbPages</h1>
<code>AliasNbPages([<b>string</b> alias])</code>
<h2>Description</h2>
Defines an alias for the total number of pages. It will be substituted as the document is
closed.
<h2>Parameters</h2>
<dl class="param">
<dt><code>alias</code></dt>
<dd>
The alias. Default value: <code>{nb}</code>.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print current and total page numbers
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}',0,0,'C');
}
}
$pdf = new PDF();
$pdf-&gt;AliasNbPages();</code></pre>
</div>
<h2>See also</h2>
<a href="pageno.htm">PageNo</a>,
<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

104
share/pnp/application/vendor/fpdf/doc/cell.htm vendored Executable file
View File

@ -0,0 +1,104 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Cell</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Cell</h1>
<code>Cell(<b>float</b> w [, <b>float</b> h [, <b>string</b> txt [, <b>mixed</b> border [, <b>int</b> ln [, <b>string</b> align [, <b>boolean</b> fill [, <b>mixed</b> link]]]]]]])</code>
<h2>Description</h2>
Prints a cell (rectangular area) with optional borders, background color and character string.
The upper-left corner of the cell corresponds to the current position. The text can be aligned
or centered. After the call, the current position moves to the right or to the next line. It is
possible to put a link on the text.
<br>
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is
done before outputting.
<h2>Parameters</h2>
<dl class="param">
<dt><code>w</code></dt>
<dd>
Cell width. If <code>0</code>, the cell extends up to the right margin.
</dd>
<dt><code>h</code></dt>
<dd>
Cell height.
Default value: <code>0</code>.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
Default value: empty string.
</dd>
<dt><code>border</code></dt>
<dd>
Indicates if borders must be drawn around the cell. The value can be either a number:
<ul>
<li><code>0</code>: no border</li>
<li><code>1</code>: frame</li>
</ul>
or a string containing some or all of the following characters (in any order):
<ul>
<li><code>L</code>: left</li>
<li><code>T</code>: top</li>
<li><code>R</code>: right</li>
<li><code>B</code>: bottom</li>
</ul>
Default value: <code>0</code>.
</dd>
<dt><code>ln</code></dt>
<dd>
Indicates where the current position should go after the call. Possible values are:
<ul>
<li><code>0</code>: to the right</li>
<li><code>1</code>: to the beginning of the next line</li>
<li><code>2</code>: below</li>
</ul>
Putting <code>1</code> is equivalent to putting <code>0</code> and calling Ln() just after.
Default value: <code>0</code>.
</dd>
<dt><code>align</code></dt>
<dd>
Allows to center or align the text. Possible values are:
<ul>
<li><code>L</code> or empty string: left align (default value)</li>
<li><code>C</code>: center</li>
<li><code>R</code>: right align</li>
</ul>
</dd>
<dt><code>fill</code></dt>
<dd>
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
Default value: <code>false</code>.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Set font
$pdf-&gt;SetFont('Arial','B',16);
// Move to 8 cm to the right
$pdf-&gt;Cell(80);
// Centered text in a framed 20*10 mm cell and line break
$pdf-&gt;Cell(20,10,'Title',1,1,'C');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="addlink.htm">AddLink</a>,
<a href="ln.htm">Ln</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="write.htm">Write</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Close</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Close</h1>
<code>Close()</code>
<h2>Description</h2>
Terminates the PDF document. It is not necessary to call this method explicitly because Output()
does it automatically.
<br>
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
<h2>See also</h2>
<a href="output.htm">Output</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Error</h1>
<code>Error(<b>string</b> msg)</code>
<h2>Description</h2>
This method is automatically called in case of a fatal error; it simply throws an exception
with the provided message.<br>
An inherited class may override it to customize the error handling but the method should
never return, otherwise the resulting document would probably be invalid.
<h2>Parameters</h2>
<dl class="param">
<dt><code>msg</code></dt>
<dd>
The error message.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Footer</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Footer</h1>
<code>Footer()</code>
<h2>Description</h2>
This method is used to render the page footer. It is automatically called by AddPage() and
Close() and should not be called directly by the application. The implementation in FPDF is
empty, so you have to subclass it and override the method if you want a specific processing.
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print centered page number
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo(),0,0,'C');
}
}</code></pre>
</div>
<h2>See also</h2>
<a href="header.htm">Header</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetPageHeight</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetPageHeight</h1>
<code><b>float</b> GetPageHeight()</code>
<h2>Description</h2>
Returns the current page height.
<h2>See also</h2>
<a href="getpagewidth.htm">GetPageWidth</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetPageWidth</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetPageWidth</h1>
<code><b>float</b> GetPageWidth()</code>
<h2>Description</h2>
Returns the current page width.
<h2>See also</h2>
<a href="getpageheight.htm">GetPageHeight</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetStringWidth</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetStringWidth</h1>
<code><b>float</b> GetStringWidth(<b>string</b> s)</code>
<h2>Description</h2>
Returns the length of a string in user unit. A font must be selected.
<h2>Parameters</h2>
<dl class="param">
<dt><code>s</code></dt>
<dd>
The string whose length is to be computed.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetX</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetX</h1>
<code><b>float</b> GetX()</code>
<h2>Description</h2>
Returns the abscissa of the current position.
<h2>See also</h2>
<a href="setx.htm">SetX</a>,
<a href="gety.htm">GetY</a>,
<a href="sety.htm">SetY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetY</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetY</h1>
<code><b>float</b> GetY()</code>
<h2>Description</h2>
Returns the ordinate of the current position.
<h2>See also</h2>
<a href="sety.htm">SetY</a>,
<a href="getx.htm">GetX</a>,
<a href="setx.htm">SetX</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Header</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Header</h1>
<code>Header()</code>
<h2>Description</h2>
This method is used to render the page header. It is automatically called by AddPage() and
should not be called directly by the application. The implementation in FPDF is empty, so
you have to subclass it and override the method if you want a specific processing.
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Header()
{
// Select Arial bold 15
$this-&gt;SetFont('Arial','B',15);
// Move to the right
$this-&gt;Cell(80);
// Framed title
$this-&gt;Cell(30,10,'Title',1,0,'C');
// Line break
$this-&gt;Ln(20);
}
}</code></pre>
</div>
<h2>See also</h2>
<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,99 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Image</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Image</h1>
<code>Image(<b>string</b> file [, <b>float</b> x [, <b>float</b> y [, <b>float</b> w [, <b>float</b> h [, <b>string</b> type [, <b>mixed</b> link]]]]]])</code>
<h2>Description</h2>
Puts an image. The size it will take on the page can be specified in different ways:
<ul>
<li>explicit width and height (expressed in user unit or dpi)</li>
<li>one explicit dimension, the other being calculated automatically in order to keep the original proportions</li>
<li>no explicit dimension, in which case the image is put at 96 dpi</li>
</ul>
Supported formats are JPEG, PNG and GIF. The GD extension is required for GIF.
<br>
<br>
For JPEGs, all flavors are allowed:
<ul>
<li>gray scales</li>
<li>true colors (24 bits)</li>
<li>CMYK (32 bits)</li>
</ul>
For PNGs, are allowed:
<ul>
<li>gray scales on at most 8 bits (256 levels)</li>
<li>indexed colors</li>
<li>true colors (24 bits)</li>
</ul>
For GIFs: in case of an animated GIF, only the first frame is displayed.<br>
<br>
Transparency is supported.<br>
<br>
The format can be specified explicitly or inferred from the file extension.<br>
<br>
It is possible to put a link on the image.<br>
<br>
Remark: if an image is used several times, only one copy is embedded in the file.
<h2>Parameters</h2>
<dl class="param">
<dt><code>file</code></dt>
<dd>
Path or URL of the image.
</dd>
<dt><code>x</code></dt>
<dd>
Abscissa of the upper-left corner. If not specified or equal to <code>null</code>, the current abscissa
is used.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of the upper-left corner. If not specified or equal to <code>null</code>, the current ordinate
is used; moreover, a page break is triggered first if necessary (in case automatic page breaking is enabled)
and, after the call, the current ordinate is moved to the bottom of the image.
</dd>
<dt><code>w</code></dt>
<dd>
Width of the image in the page. There are three cases:
<ul>
<li>If the value is positive, it represents the width in user unit</li>
<li>If the value is negative, the absolute value represents the horizontal resolution in dpi</li>
<li>If the value is not specified or equal to zero, it is automatically calculated</li>
</ul>
</dd>
<dt><code>h</code></dt>
<dd>
Height of the image in the page. There are three cases:
<ul>
<li>If the value is positive, it represents the height in user unit</li>
<li>If the value is negative, the absolute value represents the vertical resolution in dpi</li>
<li>If the value is not specified or equal to zero, it is automatically calculated</li>
</ul>
</dd>
<dt><code>type</code></dt>
<dd>
Image format. Possible values are (case insensitive): <code>JPG</code>, <code>JPEG</code>, <code>PNG</code> and <code>GIF</code>.
If not specified, the type is inferred from the file extension.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Insert a logo in the top-left corner at 300 dpi
$pdf-&gt;Image('logo.png',10,10,-300);
// Insert a dynamic image from a URL
$pdf-&gt;Image('http://chart.googleapis.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World',60,30,90,0,'PNG');</code></pre>
</div>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FPDF 1.81 Reference Manual</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>FPDF 1.81 Reference Manual</h1>
<a href="__construct.htm">__construct</a> - constructor<br>
<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic page break<br>
<a href="addfont.htm">AddFont</a> - add a new font<br>
<a href="addlink.htm">AddLink</a> - create an internal link<br>
<a href="addpage.htm">AddPage</a> - add a new page<br>
<a href="aliasnbpages.htm">AliasNbPages</a> - define an alias for number of pages<br>
<a href="cell.htm">Cell</a> - print a cell<br>
<a href="close.htm">Close</a> - terminate the document<br>
<a href="error.htm">Error</a> - fatal error<br>
<a href="footer.htm">Footer</a> - page footer<br>
<a href="getpageheight.htm">GetPageHeight</a> - get current page height<br>
<a href="getpagewidth.htm">GetPageWidth</a> - get current page width<br>
<a href="getstringwidth.htm">GetStringWidth</a> - compute string length<br>
<a href="getx.htm">GetX</a> - get current x position<br>
<a href="gety.htm">GetY</a> - get current y position<br>
<a href="header.htm">Header</a> - page header<br>
<a href="image.htm">Image</a> - output an image<br>
<a href="line.htm">Line</a> - draw a line<br>
<a href="link.htm">Link</a> - put a link<br>
<a href="ln.htm">Ln</a> - line break<br>
<a href="multicell.htm">MultiCell</a> - print text with line breaks<br>
<a href="output.htm">Output</a> - save or send the document<br>
<a href="pageno.htm">PageNo</a> - page number<br>
<a href="rect.htm">Rect</a> - draw a rectangle<br>
<a href="setauthor.htm">SetAuthor</a> - set the document author<br>
<a href="setautopagebreak.htm">SetAutoPageBreak</a> - set the automatic page breaking mode<br>
<a href="setcompression.htm">SetCompression</a> - turn compression on or off<br>
<a href="setcreator.htm">SetCreator</a> - set document creator<br>
<a href="setdisplaymode.htm">SetDisplayMode</a> - set display mode<br>
<a href="setdrawcolor.htm">SetDrawColor</a> - set drawing color<br>
<a href="setfillcolor.htm">SetFillColor</a> - set filling color<br>
<a href="setfont.htm">SetFont</a> - set font<br>
<a href="setfontsize.htm">SetFontSize</a> - set font size<br>
<a href="setkeywords.htm">SetKeywords</a> - associate keywords with document<br>
<a href="setleftmargin.htm">SetLeftMargin</a> - set left margin<br>
<a href="setlinewidth.htm">SetLineWidth</a> - set line width<br>
<a href="setlink.htm">SetLink</a> - set internal link destination<br>
<a href="setmargins.htm">SetMargins</a> - set margins<br>
<a href="setrightmargin.htm">SetRightMargin</a> - set right margin<br>
<a href="setsubject.htm">SetSubject</a> - set document subject<br>
<a href="settextcolor.htm">SetTextColor</a> - set text color<br>
<a href="settitle.htm">SetTitle</a> - set document title<br>
<a href="settopmargin.htm">SetTopMargin</a> - set top margin<br>
<a href="setx.htm">SetX</a> - set current x position<br>
<a href="setxy.htm">SetXY</a> - set current x and y positions<br>
<a href="sety.htm">SetY</a> - set current y position and optionally reset x<br>
<a href="text.htm">Text</a> - print a string<br>
<a href="write.htm">Write</a> - print flowing text<br>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Line</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Line</h1>
<code>Line(<b>float</b> x1, <b>float</b> y1, <b>float</b> x2, <b>float</b> y2)</code>
<h2>Description</h2>
Draws a line between two points.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x1</code></dt>
<dd>
Abscissa of first point.
</dd>
<dt><code>y1</code></dt>
<dd>
Ordinate of first point.
</dd>
<dt><code>x2</code></dt>
<dd>
Abscissa of second point.
</dd>
<dt><code>y2</code></dt>
<dd>
Ordinate of second point.
</dd>
</dl>
<h2>See also</h2>
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Link</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Link</h1>
<code>Link(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h, <b>mixed</b> link)</code>
<h2>Description</h2>
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(),
Write() or Image(), but this method can be useful for instance to define a clickable area inside
an image.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
Abscissa of the upper-left corner of the rectangle.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of the upper-left corner of the rectangle.
</dd>
<dt><code>w</code></dt>
<dd>
Width of the rectangle.
</dd>
<dt><code>h</code></dt>
<dd>
Height of the rectangle.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>,
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="image.htm">Image</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

28
share/pnp/application/vendor/fpdf/doc/ln.htm vendored Executable file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Ln</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Ln</h1>
<code>Ln([<b>float</b> h])</code>
<h2>Description</h2>
Performs a line break. The current abscissa goes back to the left margin and the ordinate
increases by the amount passed in parameter.
<h2>Parameters</h2>
<dl class="param">
<dt><code>h</code></dt>
<dd>
The height of the break.
<br>
By default, the value equals the height of the last printed cell.
</dd>
</dl>
<h2>See also</h2>
<a href="cell.htm">Cell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>MultiCell</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>MultiCell</h1>
<code>MultiCell(<b>float</b> w, <b>float</b> h, <b>string</b> txt [, <b>mixed</b> border [, <b>string</b> align [, <b>boolean</b> fill]]])</code>
<h2>Description</h2>
This method allows printing text with line breaks. They can be automatic (as soon as the
text reaches the right border of the cell) or explicit (via the \n character). As many cells
as necessary are output, one below the other.
<br>
Text can be aligned, centered or justified. The cell block can be framed and the background
painted.
<h2>Parameters</h2>
<dl class="param">
<dt><code>w</code></dt>
<dd>
Width of cells. If <code>0</code>, they extend up to the right margin of the page.
</dd>
<dt><code>h</code></dt>
<dd>
Height of cells.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
</dd>
<dt><code>border</code></dt>
<dd>
Indicates if borders must be drawn around the cell block. The value can be either a number:
<ul>
<li><code>0</code>: no border</li>
<li><code>1</code>: frame</li>
</ul>
or a string containing some or all of the following characters (in any order):
<ul>
<li><code>L</code>: left</li>
<li><code>T</code>: top</li>
<li><code>R</code>: right</li>
<li><code>B</code>: bottom</li>
</ul>
Default value: <code>0</code>.
</dd>
<dt><code>align</code></dt>
<dd>
Sets the text alignment. Possible values are:
<ul>
<li><code>L</code>: left alignment</li>
<li><code>C</code>: center</li>
<li><code>R</code>: right alignment</li>
<li><code>J</code>: justification (default value)</li>
</ul>
</dd>
<dt><code>fill</code></dt>
<dd>
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Output</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Output</h1>
<code><b>string</b> Output([<b>string</b> dest [, <b>string</b> name [, <b>boolean</b> isUTF8]]])</code>
<h2>Description</h2>
Send the document to a given destination: browser, file or string. In the case of a browser, the
PDF viewer may be used or a download may be forced.
<br>
The method first calls Close() if necessary to terminate the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>dest</code></dt>
<dd>
Destination where to send the document. It can be one of the following:
<ul>
<li><code>I</code>: send the file inline to the browser. The PDF viewer is used if available.</li>
<li><code>D</code>: send to the browser and force a file download with the name given by <code>name</code>.</li>
<li><code>F</code>: save to a local file with the name given by <code>name</code> (may include a path).</li>
<li><code>S</code>: return the document as a string.</li>
</ul>
The default value is <code>I</code>.
</dd>
<dt><code>name</code></dt>
<dd>
The name of the file. It is ignored in case of destination <code>S</code>.<br>
The default value is <code>doc.pdf</code>.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if <code>name</code> is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).
Only used for destinations <code>I</code> and <code>D</code>.<br>
The default value is <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="close.htm">Close</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>PageNo</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>PageNo</h1>
<code><b>int</b> PageNo()</code>
<h2>Description</h2>
Returns the current page number.
<h2>See also</h2>
<a href="aliasnbpages.htm">AliasNbPages</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Rect</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Rect</h1>
<code>Rect(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h [, <b>string</b> style])</code>
<h2>Description</h2>
Outputs a rectangle. It can be drawn (border only), filled (with no border) or both.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
Abscissa of upper-left corner.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of upper-left corner.
</dd>
<dt><code>w</code></dt>
<dd>
Width.
</dd>
<dt><code>h</code></dt>
<dd>
Height.
</dd>
<dt><code>style</code></dt>
<dd>
Style of rendering. Possible values are:
<ul>
<li><code>D</code> or empty string: draw. This is the default value.</li>
<li><code>F</code>: fill</li>
<li><code>DF</code> or <code>FD</code>: draw and fill</li>
</ul>
</dd>
</dl>
<h2>See also</h2>
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetAuthor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetAuthor</h1>
<code>SetAuthor(<b>string</b> author [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the author of the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>author</code></dt>
<dd>
The name of the author.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setcreator.htm">SetCreator</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetAutoPageBreak</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetAutoPageBreak</h1>
<code>SetAutoPageBreak(<b>boolean</b> auto [, <b>float</b> margin])</code>
<h2>Description</h2>
Enables or disables the automatic page breaking mode. When enabling, the second parameter is
the distance from the bottom of the page that defines the triggering limit. By default, the
mode is on and the margin is 2 cm.
<h2>Parameters</h2>
<dl class="param">
<dt><code>auto</code></dt>
<dd>
Boolean indicating if mode should be on or off.
</dd>
<dt><code>margin</code></dt>
<dd>
Distance from the bottom of the page.
</dd>
</dl>
<h2>See also</h2>
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="acceptpagebreak.htm">AcceptPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetCompression</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetCompression</h1>
<code>SetCompression(<b>boolean</b> compress)</code>
<h2>Description</h2>
Activates or deactivates page compression. When activated, the internal representation of
each page is compressed, which leads to a compression ratio of about 2 for the resulting
document.
<br>
Compression is on by default.
<br>
<br>
<strong>Note:</strong> the Zlib extension is required for this feature. If not present, compression
will be turned off.
<h2>Parameters</h2>
<dl class="param">
<dt><code>compress</code></dt>
<dd>
Boolean indicating if compression must be enabled.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetCreator</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetCreator</h1>
<code>SetCreator(<b>string</b> creator [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the creator of the document. This is typically the name of the application that
generates the PDF.
<h2>Parameters</h2>
<dl class="param">
<dt><code>creator</code></dt>
<dd>
The name of the creator.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetDisplayMode</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetDisplayMode</h1>
<code>SetDisplayMode(<b>mixed</b> zoom [, <b>string</b> layout])</code>
<h2>Description</h2>
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be
displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a
specific zooming factor or use viewer default (configured in the Preferences menu of Adobe Reader).
The page layout can be specified too: single at once, continuous display, two columns or viewer
default.
<h2>Parameters</h2>
<dl class="param">
<dt><code>zoom</code></dt>
<dd>
The zoom to use. It can be one of the following string values:
<ul>
<li><code>fullpage</code>: displays the entire page on screen</li>
<li><code>fullwidth</code>: uses maximum width of window</li>
<li><code>real</code>: uses real size (equivalent to 100% zoom)</li>
<li><code>default</code>: uses viewer default mode</li>
</ul>
or a number indicating the zooming factor to use.
</dd>
<dt><code>layout</code></dt>
<dd>
The page layout. Possible values are:
<ul>
<li><code>single</code>: displays one page at once</li>
<li><code>continuous</code>: displays pages continuously</li>
<li><code>two</code>: displays two pages on two columns</li>
<li><code>default</code>: uses viewer default mode</li>
</ul>
Default value is <code>default</code>.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetDrawColor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetDrawColor</h1>
<code>SetDrawColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
<h2>Description</h2>
Defines the color used for all drawing operations (lines, rectangles and cell borders). It
can be expressed in RGB components or gray scale. The method can be called before the first
page is created and the value is retained from page to page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>r</code></dt>
<dd>
If <code>g</code> et <code>b</code> are given, red component; if not, indicates the gray level.
Value between 0 and 255.
</dd>
<dt><code>g</code></dt>
<dd>
Green component (between 0 and 255).
</dd>
<dt><code>b</code></dt>
<dd>
Blue component (between 0 and 255).
</dd>
</dl>
<h2>See also</h2>
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="line.htm">Line</a>,
<a href="rect.htm">Rect</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFillColor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFillColor</h1>
<code>SetFillColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
<h2>Description</h2>
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
It can be expressed in RGB components or gray scale. The method can be called before the first
page is created and the value is retained from page to page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>r</code></dt>
<dd>
If <code>g</code> and <code>b</code> are given, red component; if not, indicates the gray level.
Value between 0 and 255.
</dd>
<dt><code>g</code></dt>
<dd>
Green component (between 0 and 255).
</dd>
<dt><code>b</code></dt>
<dd>
Blue component (between 0 and 255).
</dd>
</dl>
<h2>See also</h2>
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="rect.htm">Rect</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFont</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFont</h1>
<code>SetFont(<b>string</b> family [, <b>string</b> style [, <b>float</b> size]])</code>
<h2>Description</h2>
Sets the font used to print character strings. It is mandatory to call this method
at least once before printing text or the resulting document would not be valid.
<br>
The font can be either a standard one or a font added via the AddFont() method. Standard fonts
use the Windows encoding cp1252 (Western Europe).
<br>
The method can be called before the first page is created and the font is kept from page
to page.
<br>
If you just wish to change the current font size, it is simpler to call SetFontSize().
<br>
<br>
<strong>Note:</strong> the font definition files must be accessible. They are searched successively in:
<ul>
<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if this constant is defined)</li>
<li>The <code>font</code> directory located in the same directory as <code>fpdf.php</code> (if it exists)</li>
<li>The directories accessible through <code>include()</code></li>
</ul>
Example using <code>FPDF_FONTPATH</code>:
<div class="doc-source">
<pre><code>define('FPDF_FONTPATH','/home/www/font');
require('fpdf.php');</code></pre>
</div>
If the file corresponding to the requested font is not found, the error "Could not include font
definition file" is raised.
<h2>Parameters</h2>
<dl class="param">
<dt><code>family</code></dt>
<dd>
Family font. It can be either a name defined by AddFont() or one of the standard families (case
insensitive):
<ul>
<li><code>Courier</code> (fixed-width)</li>
<li><code>Helvetica</code> or <code>Arial</code> (synonymous; sans serif)</li>
<li><code>Times</code> (serif)</li>
<li><code>Symbol</code> (symbolic)</li>
<li><code>ZapfDingbats</code> (symbolic)</li>
</ul>
It is also possible to pass an empty string. In that case, the current family is kept.
</dd>
<dt><code>style</code></dt>
<dd>
Font style. Possible values are (case insensitive):
<ul>
<li>empty string: regular</li>
<li><code>B</code>: bold</li>
<li><code>I</code>: italic</li>
<li><code>U</code>: underline</li>
</ul>
or any combination. The default value is regular.
Bold and italic styles do not apply to <code>Symbol</code> and <code>ZapfDingbats</code>.
</dd>
<dt><code>size</code></dt>
<dd>
Font size in points.
<br>
The default value is the current size. If no size has been specified since the beginning of
the document, the value taken is 12.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Times regular 12
$pdf-&gt;SetFont('Times');
// Arial bold 14
$pdf-&gt;SetFont('Arial','B',14);
// Removes bold
$pdf-&gt;SetFont('');
// Times bold, italic and underlined 14
$pdf-&gt;SetFont('Times','BIU');</code></pre>
</div>
<h2>See also</h2>
<a href="addfont.htm">AddFont</a>,
<a href="setfontsize.htm">SetFontSize</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="write.htm">Write</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFontSize</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFontSize</h1>
<code>SetFontSize(<b>float</b> size)</code>
<h2>Description</h2>
Defines the size of the current font.
<h2>Parameters</h2>
<dl class="param">
<dt><code>size</code></dt>
<dd>
The size (in points).
</dd>
</dl>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetKeywords</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetKeywords</h1>
<code>SetKeywords(<b>string</b> keywords [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
<h2>Parameters</h2>
<dl class="param">
<dt><code>keywords</code></dt>
<dd>
The list of keywords.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setcreator.htm">SetCreator</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More