NAME HealthCheck::Diagnostic::DBHCheck - Check a database handle to make sure you have read/write access VERSION version v1.0.0 SYNOPSIS my $health_check = HealthCheck->new( checks => [ HealthCheck::Diagnostic::DBHCheck->new( dbh => \&connect_to_read_write_db, db_access => "rw", tags => [qw< dbh_check_rw >] timeout => 10, # default ), 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 DESCRIPTION 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. ATTRIBUTES Those inherited from "ATTRIBUTES" in HealthCheck::Diagnostic plus: label Inherited from "label" in HealthCheck::Diagnostic, defaults to dbh_check. tags Inherited from "tags" in HealthCheck::Diagnostic, defaults to [ 'dbh_check' ]. dbh A coderef that returns a DBI DATABASE handle object or optionally the handle itself. Can be passed either to new or check. db_access A string indicating the type of access being tested. A value of ro indicates only read access shoud be tested. A value of rw indicates both read and write access should be tested. DEFAULT is rw. db_class The expected class for the database handle returned by the dbh coderef. Defaults to DBI::db. timeout Sets up an ALRM signal handler used to timeout the initial connection attempt after the number of seconds provided. Defaults to 10. DEPENDENCIES HealthCheck::Diagnostic CONFIGURATION AND ENVIRONMENT None AUTHOR Grant Street Group COPYRIGHT AND LICENSE This software is Copyright (c) 2019 - 2023 by Grant Street Group. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)