The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Nagios::Object::Config

DESCRIPTION

This is a module for parsing and processing Nagios object configuration files into perl objects.

METHODS

new()

Create a new configuration object.

 my $objects = Nagios::Object::Config->new();
parse()

Parse a nagios object configuration file into memory. Although Nagios::Objects will be created, they are not really usable until the register() method is called.

 $parser->parse( "myfile.cfg" );
find_object()

Search through the list of objects' names and return the first match. The second argument is optional. Always using it can considerably reduce the size of the list to be searched, so it is recommended.

 my $object = $parser->find_object( "localhost" );
 my $object = $parser->find_object( "oracle", "Nagios::Service" );
find_attribute()

Search through the objects parsed thus far, looking for a particular textual name. When found, return that object. If called with two arguments, it will search through all objects currently loaded until a match is found. When called with three arguments, the third argument is used to determine the type of object to search for, so the search can narrow down faster.

 my $object = $parser->find_attribute( "command_name", "check_host_alive" );
 my $object = $parser->find_attribute( "command_name", "check_host_alive", $host );
resolve()

Resolve the template for the specified object. Templates will not work until this has been done.

 $parser->resolve( $object );
register()

Examine all attributes of an object and link all of it's references to other Nagios objects to their respective perl objects. If this isn't called, some methods will return the textual name instead of a perl object.

 $parser->register( $host_object );
 my $timeperiod_object = $host_object->notification_period;
resolve_objects()

Resolve all objects currently loaded into memory. This can be called any number of times without corruption.

 $parser->resolve_objects();
register_objects()

Same deal as resolve_objects(), but as you'd guess, it registers all objects currently loaded into memory.

 $parser->register_objects();
list_hosts(), list_hostgroups(), etc.

Returns an array/arrayref of objects of the given type.

 ->list_hosts;
 ->list_hostroups;
 ->list_services;
 ->list_timeperiods;
 ->list_commands;
 ->list_contacts;
 ->list_contactgroups;
 ->list_hostdependencies;
 ->list_servicedependencies;
 ->list_hostescalation;
 ->list_hostgroupescalation;
 ->list_serviceescalation;

1 POD Error

The following errors were encountered while parsing the POD:

Around line 41:

=over without closing =back