HealthCheck::Diagnostic::SFTP - Check for SFTP access and operations in a HealthCheck
version v1.5.0
use HealthCheck::Diagnostic::SFTP;
# Just check that we can connect to a host.
HealthCheck::Diagnostic::SFTP->check(
host => 'sftp.example.com',
user => 'auser',
timeout => 10, # default
);
# Check that the './history' file exists on the host.
HealthCheck::Diagnostic::SFTP->check(
host => 'sftp.example.com',
callback => sub {
my ($sftp) = @_;
my ($directory) = @{ $sftp->ls('history') || [] };
return {
info => 'Looking for "history" file.',
status => $directory ? 'OK' : 'CRITCAL',
};
},
);
This diagnostic allows a process to test SFTP connectivity to a server. You can specify the host and additional parameters and the rest is handled by the diagnostic. Additionally, you can send in a callback to run after connecting for more checks.
A descriptive name for the connection test.
This gets populated in the resulting info
tag.
The server name to connect to for the test. This is required.
An anonymous sub that can get run after a conneciton is made to the host. This sub receives one argument, the Net::SFTP instance that was recently created.
Optional argument that can get passed into the Net::SFTP constructor. Represents the authentication user credential for the host.
Optional argument that can get passed into the Net::SFTP constructor. Represents the authentication password credential for the host.
Optional argument that can get passed into the Net::SFTP constructor. Represents whether to print debug information or not.
Optional argument that can get passed into the Net::SFTP constructor. An anonymous sub that gets called when warnings are generated.
Optional argument that can get passed into the Net::SFTP constructor. Additional SSH connection arguments.
Sets up an ALRM
signal handler used to timeout the initial connection attempt
after the number of seconds provided.
Defaults to 10.
Net::SFTP HealthCheck::Diagnostic
None
Grant Street Group developers@grantstreet.com
This software is Copyright (c) 2018 - 2022 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)