Read nagios plugin .ini style config files
# Read given nagios plugin config file $Config = Nagios::Plugin::Config->read( '/etc/nagios/plugins.ini' ); # Search for and read default nagios plugin config file $Config = Nagios::Plugin::Config->read(); # Access sections and properties (returns scalars or arrayrefs) $rootproperty = $Config->{_}->{rootproperty}; $one = $Config->{section}->{one}; $Foo = $Config->{section}->{Foo};
Nagios::Plugin::Config is a subclass of the excellent Config::Tiny, with the following changes:
Repeated keys are allowed within sections, returning lists instead of scalars
Write functionality has been removed i.e. access is read only
Nagios::Plugin::Config searches for a default nagios plugins file if no explicit filename is given to \*(C`read()\*(C'. The current standard locations checked are:
To use a custom location, set a \*(C`NAGIOS_CONFIG_PATH\*(C' environment variable to the set of directories that should be checked. The first \*(C`plugins.ini\*(C' or \*(C`nagios-plugins.ini\*(C' file found will be used.
Config::Tiny, Nagios::Plugin
This code is maintained by the Nagios Plugin Development Team: <http://nagiosplug.sourceforge.net>.
Copyright (C) 2006-2007 by Nagios Plugin Development Team
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.