HealthCheck::Diagnostic::SSH - Verify SSH connectivity to specified host.
version v0.1.0
Checks and verifies connection to SSH. Can optionally run commands through the connection.
my $health_check = HealthCheck->new( checks => [
HealthCheck::Diagnostic::SSH->new(
host => 'somehost.com',
user => 'some_user,
)
]);
my $health_check = HealthCheck->new( checks => [
HealthCheck::Diagnostic::SSH->new(
host => 'somehost.com',
user => 'some_user,
ssh_args => {
identity_files => [ '~/user/somepath/privatefile' ]
},
command => 'echo "Hello World!"',
return_output => 1,
)
]);
Determines if a SSH connection to a host is achievable. Sets the
status to "OK" if the connection is successful and we can run the optional
command parameter. The status is set to "UNKNOWN" if required parameters
are missing. Otherwise, the status is set to "CRITICAL".
The server name to connect to for the test. This is required.
A descriptive name for the connection test.
This gets populated in the resulting info tag.
Optional argument that can get passed into login method of Net::SSH::Perl.
Represents the authentication user credential for the host.
For more information, see "login" in Net::SSH::Perl.
Optional argument that can get passed into login method of Net::SSH::Perl.
identity_files in ssh_args can be used to authenticate by default.
Represents the authentication password credential for the host.
Optional argument that can get passed into the Net::SSH::Perl constructor.
Additional SSH connection parameters.
Only default parameter is the protocol set as 2.
identity_files can be set in here to authenticate using the files by default.
For more information on the possible arguments, refer to Net::SSH::Perl.
Optional argument that can get passed into cmd method of Net::SSH::Perl.
If provided, runs command and prints output into data depending on the
value of "display" input. An error output from running the command would
result in a non-zero value of data-exit_code> which is always provided.
If display is enabled, output of the command is shown in data-stdout>
and an error message, if any, is stored in data-stderr>.
Optional argument that can get passed into cmd method of Net::SSH::Perl.
If provided, it's supplied to the command on standard input.
Optional argument that determines whether output of Net::SSH::Perl->cmd
should be displayed. If provided a truthy value, (preferrably 1 for clarity)
the data field of the output will be populated with stdout and stderr.
If ommitted, only the exit_code will show by default as noted in "command".
Used internally to run an ssh cmd and assemble the result into
a data structure to be used as as part of the Result.
Used internally to instantiate a Net::SSH::Perl instance
Grant Street Group developers@grantstreet.com
This software is Copyright (c) 2021 - 2023 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)