verify_pnp_config

In case of problems there is a script called verify_pnp_config.pl located in the scripts directory. It 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.24 which is available in the current stable version downloadable via http://www.pnp4nagios.org/pnp/dwnld. Older versions may have fewer options so in the descriptions of the various options you will find hints to the PNP versions.

* Note *: In PNP 0.6.4 one line is missing in the script which results in an error so please add this line before executing it:

     $CPcfg{'$conf[\'max_age\']'} = 'n;^\(?[\d\* ]+\)?$';
     $CPcfg{'$conf[\'temp\']'} = 'd;;';
     $CPcfg{'$conf[\'base_url\']'} = "S;.+;";   # <-- add this line
     $CPcfg{'$conf[\'nagios_base\']'} = "S;.+;";
     $CPcfg{'$conf[\'allowed_for_service_links\']'} = 'S;[\S,]+;';

* Note *: The “long” options always start with two ”-” which isn't clearly visible in the text.

Checking the configuration can be done executing

./verify_pnp_config.pl -m <mode>

replacing <mode> by sync, 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 ("sync", "bulk", "NPCD")
-l, --logfile=s   check configure log file
-D, --pnpdir=s    PNP root dir (PNP version >= 0.6)
-N, --npcdcfg=s   PNP config file for NPCD mode (default: /usr/local/pnp4nagios/etc/pnp/npcd.cfg)
-P, --ppcfg=s     process_perfdata config file (default: /usr/local/pnp4nagios/etc/pnp/process_perfdata.cfg)
-C, --cpcfg=s     PNP config file (config.php)
-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/pnp4nagios/var/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; may be "icinga")
-L, --layout=s    specify a layout (Nagios2, Nagios3, SuSE, Fedora)
-T, --template=s  specify the path to the templates directory (default /usr/local/pnp4nagios/share/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)
-t, --time        show warnings if RRDfiles are too old
-s, --skip        skip check of installed packages
-n, --native      show messages in native language (so far "es" or "de")
-e, --english     show english messages/links
-d, --debug       some debugging output
-I, --info        show information about compile time variable settings

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 via the -L option. “suse” and “fedora” should work on the appropriate distributions while “nagios2” and “nagios3” should work on others 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.

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.

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.

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.

Starting with PNP version 0.6 the directory layout has changed so all files are below a separate directory which can be specified using ”-D” (–pnpdir) if it differs from /usr/local/pnp4nagios. This also affects the options ”-N”, ”-P” and ”-C”, respectively, so you may not have to specify separate values for these options.

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 (/usr/local/pnp4nagios/etc/npcd.cfg).

Using the option -P <config file> (–ppcfg=<config file>) you can specify the name of the config file for process_perfdata.pl if name or location differs from the default (/usr/local/pnp4nagios/etc/process_perfdata.cfg).

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.

Sometimes changes in template files result in errors 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.

Per default the script checks if certain packages are installed. If you experience difficulties with these checks (or when you're sure the required packages are installed) you can use the option -s (–skip) to skip these checks.

Using -n (–native) you can specify “es” or “de” to see spanish or german messages, respectively.

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

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.

The option -I (–info) shows the settings of variables like prefix, datadir and other things you might have changed during './configure'. In some cases we need to know these values and using this option is easier than searching different files. The option is available starting with PNP 0.6.7.

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

back to contents | web frontend