This repository has been archived by the owner on Apr 16, 2019. It is now read-only.
forked from pfischermx/foca-perl
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0332377
commit 6055b5b
Showing
4 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
commands_dirs: | ||
- /some/path/over/there/bin | ||
|
||
commands: | ||
df_path: | ||
cmd: '/bin/df {%foca_args%} | tail -n1' | ||
uptime: | ||
cmd: '/usr/bin/uptime' | ||
'true': | ||
cmd: '/bin/true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/local/bin/perl | ||
# | ||
# foca-client | ||
# | ||
# Author(s): Pablo Fischer (pablo@pablo.com.mx) | ||
# Created: 08/01/2012 12:43:34 AM UTC 12:43:34 AM | ||
|
||
use strict; | ||
use warnings; | ||
use Data::Dumper; | ||
use FindBin; | ||
use lib "$FindBin::RealBin/../lib/"; | ||
use App::Foca::Client; | ||
|
||
my $command = shift @ARGV || 'true'; | ||
my $port = 6666; | ||
my $debug = 1; | ||
|
||
my $client = App::Foca::Client->new( | ||
port => $port, | ||
debug => $debug); | ||
|
||
my @hosts = qw(localhost); | ||
my @result = $client->run(\@hosts, $command); | ||
|
||
die "Not able to collect any data" unless @result; | ||
|
||
foreach my $host (@result) { | ||
my $status = $host->{'ok'} ? 'OK' : 'ERROR'; | ||
print "$status: $host->{'hostname'}: $host->{'output'}\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/local/bin/perl | ||
# | ||
# foca-server | ||
# | ||
# Author(s): Pablo Fischer (pablo@pablo.com.mx) | ||
# Created: 08/01/2012 12:43:34 AM UTC 12:43:34 AM | ||
|
||
use strict; | ||
use warnings; | ||
use Data::Dumper; | ||
use FindBin; | ||
use lib "$FindBin::RealBin/../lib/"; | ||
use App::Foca::Server; | ||
|
||
my $port = 6666; | ||
my $timeout = 60; | ||
my $commands = "$FindBin::RealBin/example_commands.yaml"; | ||
my $debug = 1; | ||
|
||
my $server = App::Foca::Server->new( | ||
port => $port, | ||
commands_file => $commands, | ||
commands_timeout => $timeout, | ||
debug => $debug); | ||
$server->run_server(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters