HealthCheck::Diagnostic::DBHCheck - Check a database handle to make sure you have read/write access
version v0.500.3
my $health_check = HealthCheck->new( checks => [ HealthCheck::Diagnostic::DBHCheck->new( dbh => \&connect_to_read_write_db, db_access => "rw", tags => [qw< dbh_check_rw >] ), HealthCheck::Diagnostic::DBHCheck->new( dbh => \&connect_to_read_only_db, db_access => "ro", tags => [qw< dbh_check_ro >] ), ] ); my $result = $health_check->check; $result->{status}; # OK on a successful check or CRITICAL otherwise
Determines if the database can be used for read and write access, or read only access.
For read access, a simple SELECT statement is used.
For write access, a temporary table is created, and used for testing.
Those inherited from "ATTRIBUTES" in HealthCheck::Diagnostic plus:
Inherited from "label1" in HealthCheck::Diagnostic, defaults to dbh_check.
dbh_check
Inherited from "tags1" in HealthCheck::Diagnostic, defaults to [ 'dbh_check' ].
[ 'dbh_check' ]
A coderef that returns a DBI DATABASE handle object or optionally the handle itself.
Can be passed either to new or check.
new
check
A string indicating the type of access being tested.
A value of ro indicates only read access shoud be tested.
ro
A value of rw indicates both read and write access should be tested.
rw
DEFAULT is rw.
The expected class for the database handle returned by the dbh coderef.
dbh
Defaults to DBI::db.
DBI::db
HealthCheck::Diagnostic
None
Grant Street Group <developers@grantstreet.com>
This software is Copyright (c) 2019 - 2020 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install HealthCheck::Diagnostic::DBHCheck, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HealthCheck::Diagnostic::DBHCheck
CPAN shell
perl -MCPAN -e shell install HealthCheck::Diagnostic::DBHCheck
For more information on module installation, please visit the detailed CPAN module installation guide.