Rev 91 | Rev 93 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /usr/bin/env perl
use warnings;
use strict;
use YAML::Tiny;
# basically, if you're not that good with YAML, like me, this will
# let you create the config as a hashref, then run the script
# which will give you a file (config.yaml) that is the YAML equivilent.
#
# rename the created file to monitorNetwork.yaml and it is now your
# config file
#
# rename this file to makeConfig, edit it, then save and run.
# It will not be overwritten by svn updates
my $config = {
'defaults' => { # defaults if not specified in site
'timeout' => 60, # the default timeout, in seconds
'failure count' => 0, # the number of successive failures before a report
'report to' => 'me@example.com',
'report type' => 'mail',
'report from' => 'root@localhost',
'type' => 'ping'
},
'sites to check' => { # all sites to check
'some web site' => { # this is for display purposes only
'url' => 'http://example.com', # the actual URL to use
'type' => 'lwp' # type of test to run
},
'something that responds to icmp' => {
'url' => '192.168.1.50',
'type' => 'ping',
'timeout' => 20 # 20 second timeout
},
'site with netcat server running' => {
'url' => '192.168.1.51',
'type' => 'netcat',
'port' => 45654,
'timeout' => 3 # 20 second timeout
},
}
};
# types of tests are listed in the code, and each test can take.
# different parameters. Read the comments at the top of the file
my $yaml = YAML::Tiny->new( $config );
$yaml->write( 'config.yaml' );