effecti/php-prometheus-healthcheck

A simple PHP library to check the integrity of external dependencies with Prometheus output format

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.1 2021-01-25 10:09 UTC

This package is auto-updated.

Last update: 2023-12-25 19:14:32 UTC


README

effecti

A simple PHP library to check the integrity of external dependencies with Prometheus output format

Installing

composer require effecti/php-prometheus-healthcheck

Configuring

In healthcheck.php include this code

<?php

use Effecti\HealthCheck\HealthCheckRunner;
use Effecti\HealthCheck\HealthCheck;

$runner = new HealthCheckRunner();

$runner->register('pgsql-db', new HealthCheckPDO("pgsql:dbname=<dbname>; user=<user>; password=<password>; host=<host>; port=<port>"));
$runner->register('memcache', new HealthCheckMemCache(<host>, <port>));
$runner->register('rest-api', new HealthCheckHTTP(<url>));
$runner->run();

Output

health_check_status{system="pgsql-db",} 1.0
health_check_status{system="memcache",} 1.0
health_check_status{system="rest-api",} 1.0

Customize connector

If you need a custom connector just extend HealthCheck class and implements check method

Tests

composer test