PHPackages                             liip/monitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. liip/monitor

Abandoned → [zendframework/zenddiagnostics](/?search=zendframework%2Fzenddiagnostics)Library[Logging &amp; Monitoring](/categories/logging)

liip/monitor
============

Liip Monitor library

1.0.2(12y ago)611.1M↓41.7%16[3 issues](https://github.com/liip/LiipMonitor/issues)2MITPHPPHP &gt;=5.3.3

Since Feb 7Pushed 12y ago7 watchersCompare

[ Source](https://github.com/liip/LiipMonitor)[ Packagist](https://packagist.org/packages/liip/monitor)[ RSS](/packages/liip-monitor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (2)

Liip Monitor
============

[](#liip-monitor)

This library provides shareable and reusable health checks. It ha been deprecated in favor of [zendframework/ZendDiagnostics](https://github.com/zendframework/ZendDiagnostics).

For integration into Symfony2 see the [Liip Monitor Bundle](https://github.com/liip/LiipMonitorBundle).

The idea is that you fork this project and add your own health checks that you think they can useful for someone else project. This library provides a set of interfaces and a runner class to execute the health checks. On top of that it also provides a set of health check implementations (see the list below).

Installation
------------

[](#installation)

To get the source of this library simply use git:

```
# get source
git clone git://github.com/liip/LiipMonitor.git
cd LiipMonitor

```

To add this library to an existing project it is recommended to use the composer installer. Add the following to your projects `composer.json`:

```
"require": {
    ..
    "liip/monitor": "dev-master"
},

```

Get the composer installer if its not yet installed on your system and run `update`

```
# install dependencies
curl -s http://getcomposer.org/installer | php
php composer.phar update liip/monitor

```

Check groups
------------

[](#check-groups)

Checks can be grouped by implementing the `getGroup` method of the `CheckInterface`. By grouping checks it's possible to implement end-user status pages which provide feedback but hide implementation details, similar to [status.github.com](http://status.github.com).

Available Health Checks
-----------------------

[](#available-health-checks)

### DiscUsageCheck

[](#discusagecheck)

Checks if the maximum disc usage in percentage is reached.

### DoctrineDbalCheck

[](#doctrinedbalcheck)

Checks if a doctrine dbal server is running.

### HttpServiceCheck

[](#httpservicecheck)

Checks if an http server is running on the host, port and path specified in the service configuration, returning the expected status code and content.

### MemcacheCheck

[](#memcachecheck)

Checks if a memcache server is running on the host and port specified in the service configuration.

### RedisCheck

[](#redischeck)

Checks if a redis server is running on the host and port specified in the service configuration.

### PhpExtensionsCheck

[](#phpextensionscheck)

Checks if the extensions specified in the service configuration are enabled in your PHP installation.

### ProcessActiveCheck

[](#processactivecheck)

Checks if a process containing a phrase specified in the service configuration is running on the machine.

### SecurityAdvisoryCheck

[](#securityadvisorycheck)

Checks any composer dependency has an open security advisory.

### WritableDirectoryCheck

[](#writabledirectorycheck)

Checks if the user executing the script is able to write in the given directory.

### RabbitMQCheck

[](#rabbitmqcheck)

Checks if a rabbitmq server is running on the host and port specified in the service configuration, for declared user/password/vhost.

Writing Health Checks
---------------------

[](#writing-health-checks)

Let's see an example on how to implement a health check class. In this case we are going to test for the availability of PHP Extensions:

```
namespace Acme\Hello\Check;

use Liip\Monitor\Check\Check;
use Liip\Monitor\Exception\CheckFailedException;
use Liip\Monitor\Result\CheckResult;

class PhpExtensionsCheck extends Check
{
    protected $extensions;

    public function __construct($extensions)
    {
        $this->extensions = $extensions;
    }

    public function check()
    {
        try {
            foreach ($this->extensions as $extension) {
                if (!extension_loaded($extension)) {
                    throw new CheckFailedException(sprintf('Extension %s not loaded', $extension));
                }
            }
            return $this->buildResult('OK', CheckResult::OK);
        } catch (\Exception $e) {
            return $this->buildResult(sprintf('KO - %s', $e->getMessage()), CheckResult::CRITICAL);
        }
    }

    public function getName()
    {
        return "PHP Extensions Health Check";
    }
}

```

Once you implemented the class then it's time to register the check service with your runner:

```
$checkChain = new \Liip\Monitor\Check\CheckChain();
$runner = new \Liip\Monitor\Check\Runner($checkChain);

$phpExtensionCheck = new \Acme\Hello\Check\PhpExtensionsCheck(array('apc', 'memcached'));
$checkChain->addCheck('php_extension_check', $phpExtensionCheck);

```

Finally to run health checks use:

```
$runner->runAllChecks() // runs all checks
$runner->runCheckById('php_extension_check'); // runs an individual check by id

```

To get a list of available checks use:

```
$chain->getAvailableChecks();

```

### CheckResult values

[](#checkresult-values)

These values has been taken from the [nagios documentation](http://nagiosplug.sourceforge.net/developer-guidelines.html#RETURNCODES) :

- `CheckResult::OK` - The plugin was able to check the service and it appeared to be functioning properly
- `CheckResult::WARNING` - The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
- `CheckResult::CRITICAL` - The plugin detected that either the service was not running or it was above some "critical" threshold
- `CheckResult::UNKNOWN` - Invalid command line arguments were supplied to the plugin or low-level failures internal to the plugin (such as unable to fork, or open a tcp socket) that prevent it from performing the specified operation. Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states.

As you can see our constructor will take an array with the names of the extensions our application requires. Then on the `check` method it will iterate over that array to test for each of the extensions. If there are no problems then the check will return a `CheckResult` object with a message (`OK` in our case) and the result status (`CheckResult::SUCCESS` in our case). As you can see this is as easy as it gets.

Contributions
=============

[](#contributions)

Fork this project, add a health check and then open a pull request.

Note to contributors
====================

[](#note-to-contributors)

BY CONTRIBUTING TO THE LiipMonitor SOURCE CODE REPOSITORY YOU AGREE TO LICENSE YOUR CONTRIBUTION UNDER THE TERMS OF THE MIT LICENSE AS SPECIFIED IN THE 'LICENSE' FILE IN THIS DIRECTORY.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~181 days

Total

3

Last Release

4485d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20873?v=4)[Luke Smith](/maintainers/lsmith)[@lsmith](https://github.com/lsmith)

---

Top Contributors

[![lsmith77](https://avatars.githubusercontent.com/u/300279?v=4)](https://github.com/lsmith77 "lsmith77 (24 commits)")[![videlalvaro](https://avatars.githubusercontent.com/u/30834?v=4)](https://github.com/videlalvaro "videlalvaro (17 commits)")[![defrag](https://avatars.githubusercontent.com/u/15900?v=4)](https://github.com/defrag "defrag (7 commits)")[![dmecke](https://avatars.githubusercontent.com/u/1172148?v=4)](https://github.com/dmecke "dmecke (5 commits)")[![Ph3nol](https://avatars.githubusercontent.com/u/183984?v=4)](https://github.com/Ph3nol "Ph3nol (4 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![shieldo](https://avatars.githubusercontent.com/u/97280?v=4)](https://github.com/shieldo "shieldo (1 commits)")[![tborealis](https://avatars.githubusercontent.com/u/1591228?v=4)](https://github.com/tborealis "tborealis (1 commits)")[![roderik](https://avatars.githubusercontent.com/u/16780?v=4)](https://github.com/roderik "roderik (1 commits)")[![pulse00](https://avatars.githubusercontent.com/u/185278?v=4)](https://github.com/pulse00 "pulse00 (1 commits)")

---

Tags

monitoringcheckhealthmonitor

### Embed Badge

![Health badge](/badges/liip-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/liip-monitor/health.svg)](https://phpackages.com/packages/liip-monitor)
```

###  Alternatives

[liip/monitor-bundle

Liip Monitor Bundle

4728.7M16](/packages/liip-monitor-bundle)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19024.6M15](/packages/datadog-php-datadogstatsd)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[sarfraznawaz2005/servermonitor

Laravel package to periodically monitor the health of your server and website.

19513.2k1](/packages/sarfraznawaz2005-servermonitor)[ohdearapp/health-check-results

Create application health check results for Oh Dear

10175.9k8](/packages/ohdearapp-health-check-results)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
