NAME

Nagios::Generator::TestConfig - Perl extension for generating test nagios configurations

SYNOPSIS

use Nagios::Generator::TestConfig;
my $ngt = Nagios::Generator::TestConfig->new( 'output_dir' => '/tmp/test_nagios' );
$ngt->create();

DESCRIPTION

This modul generates test configurations for nagios. This can be useful if you want for doing load tests or testing nagios addons and plugins.

CONSTRUCTOR

new ( [ARGS] )

Creates an Nagios::Generator-TestConfig object. new takes at least the output_dir. Arguments are in key-value pairs.

verbose                     verbose mode
output_dir                  export directory
overwrite_dir               overwrite contents of an existing directory. Default: false
hostcount                   amount of hosts of export, Default 10
services_per_host           amount of services per host, Default 10
host_settings               key/value settings for use in the define host
service_settings            key/value settings for use in the define service
nagios_cfg                  overwrite/add settings from the nagios.cfg
hostfailrate                chance of a host to fail, Default 2%
servicefailrate             chance of a service to fail, Default 5%

METHODS

create
create()

generates and writes the configuration
Returns true on success or undef on errors.

EXAMPLE

Create a sample config with manually overriden host/service settings and add a broker module:

use Nagios::Generator::TestConfig;
my $ngt = Nagios::Generator::TestConfig->new(
                    'output_dir'        => '/tmp/nagios-test-conf',
                    'host_settings'     => { 'normal_check_interval' => 1 },
                    'service_settings'  => { 'normal_check_interval' => 1 },
                    'nagios_cfg'        => { 'broker_module' => '/tmp/mk-livestatus-1.1.0beta13/livestatus.o /tmp/live.sock' },
);
$ngt->create();

AUTHOR

Sven Nierlein, <nierlein@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Sven Nierlein

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