Rex::Group::Lookup::Nagios - read hostnames and groups from a Nagios config
With this module you can define hostgroups out of an Nagios configuration. The module requires Nagios::Config to work.
use Rex::Group::Lookup::Nagios; groups_nagios (path => '/etc/nagios3')
Reads the given Nagios configfiles and adds hostgroups and hosts defined there to Rex.
Valid options are:
Path to nagios config, default = '/etc/nagios3'
Name of the base config file, default 'nagios.cfg'
Create a group "all_hosts".
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 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:
Unknown directive: =CAVEATS
Unknown directive: =AUTHOR
To install Rex::Group::Lookup::Nagios, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex::Group::Lookup::Nagios
CPAN shell
perl -MCPAN -e shell install Rex::Group::Lookup::Nagios
For more information on module installation, please visit the detailed CPAN module installation guide.