Subversion Repositories sysadmin_scripts

Rev

Rev 91 | 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' => 'something',
      'report type' => 'mail',
      'type' => 'ping'
   },
   'sites to check' => { # all sites to check
      'name of site' => { # this is for display purposes only
         'url' => 'http://example.com', # the actual URL to use
         'type' => 'lwp' # type of test to run
      },
      'name of another site' => {
         'url' => '192.168.1.50',
         'type' => 'ping',
         'timeout' => 20 # 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' );