NAME

App::OverWatch - Watch over your infrastructure

VERSION

version 0.1

SYNOPSIS

use App::OverWatch;
my $OverWatch = App::OverWatch->new();
$OverWatch->load_config();

my $ServiceLock = $OverWatch->ServiceLock();

DESCRIPTION

Designed to provide a simple framework to give some oversight to applications running in a distributed environment. Applications can quickly register/release simple locks, register and send notifications, and log events to a database using a very simple interface.

CONFIGURATION

Database configuration is loaded from a config file by load_config() and looks as follows:

db_type = postgres
user = test
password = test
dsn = DBI:Pg:database=test

Valid db_types are mysql, postgres, sqlite.

METHODS

new

Create an App::OverWatch object.

my $OverWatch = App::OverWatch->new();

servicelock

Return a App::OverWatch::ServiceLock object.

notify

Return a App::OverWatch::Notify object.

eventlog

Return a App::OverWatch::EventLog object.

check_options

Checks Getopt::Long options for command line scripts. Checks that only one of a list of commands 'valid_commands' is provided, and that all required options 'required_options' have been passed.

Dies on any missing requirements. Returns the command.

load_config

$OverWatch->load_config();

$OverWatch->load_config($filename);

Loads OverWatch DB connection configuration from a text file, by default it will try ~/.overwatch.conf and then /etc/overwatch.conf.

If a filename is provided, it will only try to load that file.

load_config_string

$OverWatch->load_config_string('
# A comment
db_type = sqlite
user =
password =
dsn = DBI::SQLite:dbname=:memory:
');

Loads a configuration from a string.

AUTHOR

Chris Hughes <chrisjh@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Chris Hughes.

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