User Tools

Site Tools



Since PNP 0.4.12 the contrib directory contains a perl script (verify_pnp_config) which enables you to check the configuration settings as well as performance data of hosts or services. It can be used prior and during runtime of PNP.

* Note *: The information applies to verify_pnp_config v0.1.17 which is available in the current developer version (starting with SVN Rev. 644) downloadable via Older versions may have fewer options so in the descriptions of the various options you will find hints to the PNP versions.
* Note *: The “long” options always start with two “-” which isn't clearly visible in the text.

PNP-Version 0.4.12 contains verify_pnp_config 0.1.2
PNP-Version 0.4.13 contains verify_pnp_config 0.1.9
PNP-Version 0.4.14 contains verify_pnp_config 0.1.12

* Attention * 0.1.9 contains a bug which leads to an error message while checking the template definition in bulk and NPCD mode. The last parameter will be flagged as erroneous even if it is correct. Please add the statement $val .= “\\t”; prior to line 632 so that the lines look like this:

629	if ($val !~ /([A-Z]+?::[A-Z\$]+?.?)+/) {
630		info ("invTemplate");
631	}
632	$val .= "\\t";
633	while ($val =~ s/([A-Z]+?)::(.+?)([^A-Z\$].)//) {

* Attention * 0.1.12 contains bugs when checking performance data. If you need this feature then please use the current SVN version (starting with Rev. 633).
0.1.12 contains another bug which leads to an error message while checking the template definition in bulk and NPCD mode. SERVICEOUTPUT and HOSTOUTPUT resp. are reported missing but they don't belong to the template definition of PNP. They are in the default config file of Nagios instead (fixed in Rev. 639).

Checking the configuration can be done executing

./verify_pnp_config -m <mode>

replacing <mode> by default, bulk or NPCD.

Specifying the option -h or –-help respectively shows the following lines:

-h, --help        print these lines
-b, --basedir=s   Nagios Base directory (default: /usr/local/nagios)
-B, --binary=s    Nagios binary (default: nagios)
-c, --config=s    Nagios main config file (default: /usr/local/nagios/etc/nagios.cfg)
-m, --mode=s      PNP mode ("default", "bulk", "NPCD")
-l, --logfile=s   check configure log file
-N, --npcdcfg=s   PNP config file for NPCD mode (default: /usr/local/nagios/etc/pnp/npcd.cfg)
-P, --ppcfg=s     process_perfdata config file (default: /usr/local/nagios/etc/pnp/process_perfdata.cfg)
-p, --precheck    use config files instead of objects cache
-r, --rrdtool=s   specify the location of the RRDtool binary
-R, --RRDpath=s   specify the perfdata directory (default: /usr/local/nagios/share/perfdata) or "no" for no check
-U, --resource=s  location of the resource config file (default: /usr/local/nagios/etc/resource.cfg)
-M, --monitor=s   specify the monitoring product (default: nagios)
-L, --layout=s    specify a layout (Nagios2, Nagios3, SuSE, Fedora)
-T, --template=s  specify the path to the templates directory (default /usr/local/nagios/share/pnp/templates.dist)
-u, --user=s      user of the perfdata directory
-g, --group=s     group of the perfdata directory 	
-q, --quiet       quiet mode, non-zero return code will indicate errors
-o, --object=s    Nagios object (host name, service description)
-n, --native      show messages in native language (so far "es" or "de")
-e, --english     show english messages/links
-d, --debug       some debugging output

The Nagios program and access to the main configuration file are always necessary. If you have non-standard paths because you installed a Nagios package you can try to use one of the predefined layouts. “suse” and “fedora” should work on the appropriate distributions while “nagios2” and “nagios3” should work on other depending on the Nagios version you installed. If none of these methods work you can use three options (-b, -B and -c) to specify the nagios base directory, the name of the binary and the place of the main config file. If the program name starts with a “/” then this value is taken as an absolute path which isn't modified anymore. If it doesn't start with a “/” then the path is composed of the basedir, the string “bin” and the binary. Using -U you can specify the location on the resource config file. (-b / -c starting with PNP 0.4.12; -B starting with Rev. 612; -U starting with Rev. 635)

Without specifying any options the help page will be shown so you'll have to specify either the mode or an object.

Using the option -m (–mode) you specify one of the PNP modes whose settings will be checked. The option -l <filename> (–logfile=<filename>) allows to check the config during installation of PNP. You have to execute ./configure (with additional options if necessary) first which creates the file config.log. This name has to be passed as parameter value. The script checks if software requirements are met and if several settings have been specified correctly. That includes a call of the RRDtool binary so you may use the option -r <location> (–rrdtool <location>) if the binary can not be found at /usr/bin/rrdtool. (-m / -l starting with PNP 0.4.12, -r starting with PNP 0.4.13)

The script checks if owner and group of the directories and files below the perfdata folder correspond to the values given in nagios.cfg. Additionally the xml files are checked for non-zero return codes of RRDtool. Using the option -R (–RRDpath) you can specify the directory where the RRD files are located if its place is non-standard. If you don't wish these checks to be performed please specify “no” as directory name. Using the options -u (–user) and -g (–group) you can specify user and/or group of the perfdata directory if they don't match the values of the nagios user. (-R starting with PNP 0.4.14 / SVN Rev. 598; -u / -g starting with Rev. 635).

After the installation the changes in nagios.cfg can be checked using the option -p (–precheck) before restarting nagios. This way you can correct any errors without restarting every time.

Together with the option -o <object> (–object=<object>) you specify a string which is compared to hostnames and/or service descriptions in the objects cache file. The string should be enclosed in quotes to escape blanks and several special characters. If the string matches the name and any performance data will be shown. If no or invalid performance data is present appropriate messages will be given.

Appending a semicolon to the string will result in comparing only hostnames, prepending a semicolon only inspects service descriptions. A semicolon within the string separates hostname and service description.

  • hostname/service description ⇒ string matches hostname or service description
  • hostname; ⇒ string only matches against hostnames
  • ;service description ⇒ string only matches against service descriptions
  • hostname;service description ⇒ hostname and service description have to match

(-o starting with PNP 0.4.12, semicolon starting with PNP 0.4.13)

When using the NPCD mode you can use -N <config file> (–npcdcfg=<config file>) to specify the location of the config file if its name or location differs from the default (NAGIOS_BASE/etc/pnp/npcd.cfg) (-N starting with PNP 0.4.13).

Using the option -P <config file> (–ppcfg=<config file>) you can specify the name of the config file for if name or location differs from the default (NAGIOS_BASE/etc/pnp/process_perfdata.cfg) (-P starting with PNP 0.4.13).

Using the option -M (–monitor) enables you to specify the product which delivers the data to PNP. The default is “nagios” but “icinga” is supported now as well. Additionally you may have to use the options -b, -B and -c as well. (-M starting with Rev. 640)

Sometimes changes in template files result in error which are hard to find in the web GUI. Using the option -T the template files are checked for errors. Specify the path to the templates diretory as a parameter. (-T starting with Rev. 655)

Using -n (–native) you can specify “es” or “de” to see spanish or german messages, respectively. (-e starting with Rev. 664, PNP 0.4.15)

The option -e (–english) enables you to force the use of english messages if the script detects german language settings (-e starting with PNP 0.4.13).

The option -d (–debug) will output additional lines which may help during trouble shooting whereas -q (–quiet) suppresses all output. Errors will result in a non-zero return code. (-d starting with PNP 0.4.12, -q starting with PNP 0.4.13)

Each output line will start with a letter indicating the type of information:

[I] informational message about settings, things to be done, …
[A] actions to be taken
[W] warning message
[E] error message: PNP will not work without resolving the problem(s)
[H] hint: it might be worth reading the appropriate documentation
[D] debugging message, hopefully showing the source of your problem
(one letter types starting with PNP 0.4.13).

pnp-0.4/verify_pnp_config.txt · Last modified: 2022/01/21 14:37 by