-
Hahn Axel (hahn) authoredHahn Axel (hahn) authored
pdoconnect.php 4.22 KiB
<?php
/**
* ____________________________________________________________________________
*
* _____ _____ __ _____ _ _
* | | | | ___ ___ ___| |___ ___|_| |_ ___ ___
* |- -| | | | |__ | .'| . | . | | | | . | | | _| . | _|
* |_____|_|_|_|_____| |__,| _| _|_|_|_|___|_|_|_|_| |___|_|
* |_| |_|
* _ _ _
* ___| |_|___ ___| |_
* | _| | | -_| | _|
* |___|_|_|___|_|_|_|
*
* ____________________________________________________________________________
*
* CHECK DATABASE CONNECTION USING PDO
* ____________________________________________________________________________
*
* 2021-10-27 <axel.hahn@iml.unibe.ch>
* 2024-07-23 <axel.hahn@unibe.ch> php 8 only: use typed variables
* 2025-03-19 <axel.hahn@unibe.ch> add validation rules and parameter description
*/
class checkPdoConnect extends appmonitorcheck
{
/**
* Self documentation and validation rules
* @var array
*/
protected array $_aDoc = [
'name' => 'Plugin PdoConnect',
'description' => 'Verify a database connection with PDO connect',
'parameters' => [
'connect' => [
'type' => 'string',
'required' => true,
'description' => 'PDO conect string. See http://php.net/manual/en/pdo.drivers.php',
// doc
'default' => null,
'example' => 'mysql:host=$aDb[server];port=3306;dbname=$aDb[database]',
],
'user' => [
'type' => 'string',
'required' => false,
'description' => 'Database user to connect with',
'default' => null,
'example' => 'dbuser',
],
'password' => [
'type' => 'string',
'required' => false,
'description' => 'Password of the database user to authenticate',
'default' => null,
'example' => 'mySecretDatabasePassword',
],
'timeout' => [
'type' => 'float',
'required' => false,
'description' => 'Timeout in sec',
'default' => 5,
'example' => '3',
],
],
];
/**
* Get default group of this check
* @return string