| 1 | package App::MadEye::Plugin::Agent::WriteDisk; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use App::MadEye::Plugin::Agent::Base; | ||
| 5 | |||
| 6 | use Net::SSH qw/ssh_cmd/; | ||
| 7 | |||
| 8 | sub is_dead { | ||
| 9 | my ($self, $host) = @_; | ||
| 10 | |||
| 11 | my $conf = $self->config->{config}; | ||
| 12 | my $fname = $conf->{filename} or die "missing filename"; | ||
| 13 | |||
| 14 | my @result = split /\n/, ssh_cmd($host, "/bin/touch $fname && /bin/rm $fname"); | ||
| 15 | |||
| 16 | if (scalar(@result) == 0) { | ||
| 17 | return; # ok | ||
| 18 | } else { | ||
| 19 | return join("\n", @result); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; | ||
| 24 | __END__ |