Subversion Repositories sysadmin_scripts

Rev

Rev 91 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
89 rodolico 1
#! /usr/bin/env perl
2
use warnings;
3
use strict;
4
use YAML::Tiny;
5
 
6
# basically, if you're not that good with YAML, like me, this will
7
# let you create the config as a hashref, then run the script
8
# which will give you a file (config.yaml) that is the YAML equivilent.
9
#
10
# rename the created file to monitorNetwork.yaml and it is now your
11
# config file
12
#
13
# rename this file to makeConfig, edit it, then save and run. 
14
# It will not be overwritten by svn updates
15
 
16
my $config = {
17
   'defaults' => { # defaults if not specified in site
18
      'timeout' => 60, # the default timeout, in seconds
19
      'failure count' => 0, # the number of successive failures before a report
20
      'report to' => 'something',
21
      'report type' => 'mail',
22
      'type' => 'ping'
23
   },
24
   'sites to check' => { # all sites to check
25
      'name of site' => { # this is for display purposes only
26
         'url' => 'http://example.com', # the actual URL to use
27
         'type' => 'lwp' # type of test to run
28
      },
29
      'name of another site' => {
30
         'url' => '192.168.1.50',
31
         'type' => 'ping',
32
         'timeout' => 20 # 20 second timeout
33
      },
34
   }
35
};
36
 
37
# types of tests are listed in the code, and each test can take.
38
# different parameters. Read the comments at the top of the file
39
 
40
my $yaml = YAML::Tiny->new( $config );
41
$yaml->write( 'config.yaml' );
42