NAME
Nagios::Config::Onject - Class for Nagios object configuration files
SYNOPSIS
use Nagios::Config ;
my $nc = new Nagios::Config("/usr/local/nagios/etc/nagios.cfg") ;
my @object_files = $nc->get_object_files() ;
foreach (@object_files){
my @hosts = $_->get_objects('host') ;
foreach my $h (@hosts){
print $h->get_attr('host_name') . "\n" ;
}
}
DESCRIPTION
Nagios::Config::ObjectFile is the class for all Nagios object configuration files. You should not need to create these yourself.
CONSTRUCTOR
METHODS
- get_objects ([TYPE])
-
Returns a list of all the objects of type
TYPEthat where found during the parse. Each of these objects will be blessed in the Nagios::Config::Object::TYPEpackage, which inherits from Nagios::Config::Object.Ex: my @hosts = $of->get_objects('host') ;
- get_object_hash ([TYPE], [KEY])
-
Returns a hash of all the objects of type
TYPEthat where found during the parse, using attributeKEYas the hash key. Make sure that the value ofKEYis unique for each object, or else you will not get all the objects in the hash. Each of these objects will be blessed in the Nagios::Config::Object::TYPEpackage, which inherits from Nagios::Config::Object.Ex: my %hosts = $of->get_object_hash('host', 'host_name') ;
- find_objects ([TYPE], [ATTR], [QUERY], [SPLIT])
-
Returns a list of all the objects of type
TYPEthat where found during the parse, whereATTR"matches"QUERY.QUERYcan be a regular expression (i.e. qr/.../) or a scalar. IfSPLITis true, the values will be split on /\s*,\s*/ and each of the resulting values will be compared separately. Also, if the value of theATTRis '*', the object is returned regardless of the value ofQUERY. Each of these objects will be blessed in the Nagios::Config::Object::TYPEpackage, which inherits from Nagios::Config::Object.Ex: my %services = $of->get_object_hash('service', 'host_name', 'my_host', 1) ;
AUTHOR
Patrick LeBoutillier, patl@cpan.org
SEE ALSO
Nagios::Config, Nagios::Config::Object, Nagios::Config::File