NAME

Rex::Group::Lookup::Nagios - read hostnames and groups from a Nagios config

DESCRIPTION

With this module you can define hostgroups out of an Nagios configuration. The module requires Nagios::Config to work.

SYNOPSIS

 use Rex::Group::Lookup::Nagios;
 groups_nagios (path => '/etc/nagios3')

EXPORTED FUNCTIONS

groups_nagios (%options)

Reads the given Nagios configfiles and adds hostgroups and hosts defined there to Rex.

Valid options are:

path

Path to nagios config, default = '/etc/nagios3'

cfg

Name of the base config file, default 'nagios.cfg'

create_all_group

Create a group "all_hosts".

filter => sub {}

You can modify the host names added to Rex by defining a filter sub. The sub will be called with two parameters: ( host_name, address ). The returned value is used as host name added to Rex. If you return undef, this host will be skipped.

Example:

 groups_nagios( filter => sub { my ($host_name, $address) =@_; return  $host_name . '.my.domain';} );

This module hasn't been tested on Windows platforms.

Rolf Schaufelberger, <rolfschau@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2015 Rolf Schaufelberger

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 115:

Unknown directive: =CAVEATS

Around line 119:

Unknown directive: =AUTHOR