Monitoring::Generator::TestConfig - generate monitoring configurations (nagios/icinga/shinken)
use Monitoring::Generator::TestConfig; my $ngt = Monitoring::Generator::TestConfig->new( 'output_dir' => '/tmp/test_monitoring' ); $ngt->create();
This modul generates test configurations for your monitoring. This can be useful if you want for doing load tests or testing addons and plugins.
Creates an Monitoring::Generator::TestConfig object. new takes at least the output_dir. Arguments are in key-value pairs.
Monitoring::Generator::TestConfig
new
verbose verbose mode output_dir export directory overwrite_dir overwrite contents of an existing directory. Default: false layout which config should be generated, valid options are "nagios", "icinga", "shinken" and "omd" user user, defaults to the current user group group, defaults to the current users group prefix prefix to all hosts / services binary path to your nagios/icinga bin hostcount amount of hosts to export, Default 10 hostcheckcmd use custom hostcheck command line servicecheckcmd use custom servicecheck command line routercount amount of router to export, Default 5 ( exported as host and used as parent ) 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 main_cfg overwrite/add settings from the nagios.cfg/icinga.cfg hostfailrate chance of a host to fail, Default 2% servicefailrate chance of a service to fail, Default 5% host_types key/value settings for percentage of hosttypes, possible keys are up,down,flap,random,block router_types key/value settings for percentage of hosttypes for router service_types key/value settings for percentage of servicetypes, possible keys are ok,warning,critical,unknown,flap,random,block skip_dependencys no service dependencys will be exported
create() generates and writes the configuration Returns true on success or undef on errors.
Using OMD makes generating test configs really easy:
#> create site test #> su - test OMD[test]:~$ cpan ... Would you like me to configure as much as possible automatically? [yes] <enter> ... cpan[1]> install Monitoring::Generator::TestConfig ... cpan[2]> exit OMD[test]:~$ ./local/lib/perl5/bin/create_monitoring_test_config.pl
After the first installation, configuration can be adjusted in the recreate.pl in your SITE directory.
Create a sample config with manually overriden host/service settings:
use Monitoring::Generator::TestConfig; my $mgt = Monitoring::Generator::TestConfig->new( 'output_dir' => '/tmp/test-conf', 'verbose' => 1, 'overwrite_dir' => 1, 'user' => 'testuser', 'group' => 'users', 'hostcount' => 50, 'services_per_host' => 20, 'main_cfg' => { 'debug_level' => 1, 'debug_verbosity' => 1, }, 'hostfailrate' => 2, # percentage (only for the random ones) 'servicefailrate' => 5, # percentage (only for the random ones) 'host_settings' => { 'normal_check_interval' => 10, 'retry_check_interval' => 1, }, 'service_settings' => { 'normal_check_interval' => 10, 'retry_check_interval' => 2, }, 'host_types' => { 'down' => 5, # percentage 'up' => 50, 'flap' => 5, 'pending' => 5, 'random' => 30, 'block' => 5, }, 'service_types' => { 'ok' => 50, # percentage 'warning' => 5, 'unknown' => 5, 'critical' => 5, 'pending' => 5, 'flap' => 5, 'random' => 20, 'block' => 5, }, ); $mgt->create();
Sven Nierlein, <nierlein@cpan.org>
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.
To install Monitoring::Generator::TestConfig, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Monitoring::Generator::TestConfig
CPAN shell
perl -MCPAN -e shell install Monitoring::Generator::TestConfig
For more information on module installation, please visit the detailed CPAN module installation guide.