NAME

Juno::Check::RawCommand - A raw command check for Juno

VERSION

version 0.010

DESCRIPTION

Allows you to run a raw command. The command will be run in a separate fork using System::Command so you can get full access to everything in the command (stdout, stderr, exit code, etc.).

ATTRIBUTES

cmd

The command to run. This allows a very simple template that allows you to use %h as the host.

hosts

An arrayref of hosts to check, overriding the default given to Juno.pm.

my $juno = Juno->new(
    checks => {
        RawCommand => {
            hosts      => ['Jeff'],
            cmd        => 'grep %h %h.log', # %h will be the host
            on_success => sub {
                my ( $check, $host, $cmd ) = @_;

                print "Found $host in $host.log\n"
                    . $cmd->{'stdout'};
            },

            on_fail    => sub {
                my ( $check, $host, $cmd, $msg ) = @_;

                $msg and print "Deserialization failed, odd error: $msg\n";

                print "Failed to find $host in log.txt:\n"
                    . $cmd->{'stderr'};
            },
        },
    },
);

This attribute derives from Juno::Role::Check.

interval

An integer of seconds between each check (nor per-host).

This attribute derives from Juno::Role::Check.

on_success

A coderef to run when making a successful result, which is zero by default.

This attribute derives from Juno::Role::Check.

on_fail

A coderef to run when making an unsuccessful request, which isn't zero by default.

This attribute derives from Juno::Role::Check.

on_result

A coderef to run on the result. This is what you use in case you want more control over what's going on.

This attribute derives from Juno::Role::Check.

on_before

A coderef to run before running the command.

watcher

Holds the watcher for the command check timer.

This attribute derives from Juno::Role::Check.

METHODS

check

Juno will call this method for you. You should not call it yourself.

run

Juno will call this method for you. You should not call it yourself.

AUTHORS

  • Sawyer X <xsawyerx@cpan.org>

  • Adam Balali <adamba@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Sawyer X.

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