Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grantstreetgroup/p5-healthcheck-diagnostic-dbhcheck
Perl HealthCheck Diagnostic for verifying database contents - https://grantstreetgroup.github.io/HealthCheck.html
https://github.com/grantstreetgroup/p5-healthcheck-diagnostic-dbhcheck
Last synced: about 1 month ago
JSON representation
Perl HealthCheck Diagnostic for verifying database contents - https://grantstreetgroup.github.io/HealthCheck.html
- Host: GitHub
- URL: https://github.com/grantstreetgroup/p5-healthcheck-diagnostic-dbhcheck
- Owner: GrantStreetGroup
- License: other
- Created: 2020-04-28T15:35:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-04T19:36:57.000Z (about 1 year ago)
- Last Synced: 2023-12-05T19:54:51.976Z (about 1 year ago)
- Language: Perl
- Size: 43 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# NAME
HealthCheck::Diagnostic::DBHCheck - Check a database handle to make sure you have read/write access
# VERSION
version v1.0.1
# 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](https://metacpan.org/pod/HealthCheck%3A%3ADiagnostic#ATTRIBUTES) plus:
## label
Inherited from ["label" in HealthCheck::Diagnostic](https://metacpan.org/pod/HealthCheck%3A%3ADiagnostic#label1),
defaults to `dbh_check`.## tags
Inherited from ["tags" in HealthCheck::Diagnostic](https://metacpan.org/pod/HealthCheck%3A%3ADiagnostic#tags1),
defaults to `[ 'dbh_check' ]`.## dbh
A coderef that returns a
[DBI DATABASE handle object](https://metacpan.org/pod/DBI#DBI-DATABASE-HANDLE-OBJECTS)
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](https://metacpan.org/pod/HealthCheck%3A%3ADiagnostic)
# 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)