App::MadEye::Plugin::Agent::WriteDisk - is this disk writable?


App-MadEye documentation Contained in the App-MadEye distribution.

Index


Code Index:

NAME

Top

App::MadEye::Plugin::Agent::WriteDisk - is this disk writable?

SCHEMA

Top

    type: map
    mapping:
        target:
            type: seq
            required: yes
            sequence:
                - type: str
        filename:
            required: yes
            type: str

AUTHORS

Top

Tokuhiro Matsuno

SEE ALSO

Top

pgrep, App::MadEye


App-MadEye documentation Contained in the App-MadEye distribution.

package App::MadEye::Plugin::Agent::WriteDisk;
use strict;
use warnings;
use App::MadEye::Plugin::Agent::Base;

use Net::SSH qw/ssh_cmd/;

sub is_dead {
    my ($self, $host) = @_;

    my $conf = $self->config->{config};
    my $fname = $conf->{filename} or die "missing filename";

    my @result = split /\n/, ssh_cmd($host, "/bin/touch $fname && /bin/rm $fname");

    if (scalar(@result) == 0) {
        return; # ok
    } else {
        return join("\n", @result);
    }
}
  
1;
__END__