PHPackages                             randomhost/icinga - 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. randomhost/icinga

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

randomhost/icinga
=================

Provides Icinga check and notification commands.

1.0.0(10mo ago)02192BSD-3-ClausePHPPHP &gt;=8.2.0

Since Oct 2Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/randomhost/icinga)[ Packagist](https://packagist.org/packages/randomhost/icinga)[ Docs](https://github.random-host.tv)[ RSS](/packages/randomhost-icinga/feed)WikiDiscussions main Synced 3w ago

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

[![Build Status](https://github.com/randomhost/icinga/actions/workflows/php.yml/badge.svg)](https://github.com/randomhost/icinga/actions/workflows/php.yml)

randomhost/icinga
=================

[](#randomhosticinga)

- [1. Purpose](#1-purpose)
- [2. Usage](#2-usage)
    - [2.1. Base Class](#21-base-class)
    - [2.2. Check Plugins](#22-check-plugins)
        - [2.2.1. Check\\Base Class](#221-checkbase-class)
        - [2.2.2. Implementing Check Classes](#222-implementing-check-classes)
    - [2.3. Notification Plugins](#23-notification-plugins)
        - [2.3.1. Notification\\Base Class](#231-notificationbase-class)
        - [2.3.2. Implementing Notification Classes](#232-implementing-notification-classes)
- [3. License](#3-license)

1. Purpose
----------

[](#1-purpose)

This package provides check and notification commands for the Icinga monitoring system.

2. Usage
--------

[](#2-usage)

### 2.1. Base Class

[](#21-base-class)

The abstract `Base` class implements the following public methods which are available for both, check and notification classes.

- `Base::getShortOptions()`
    Returns available short options. The return value is supposed to be passed to PHP's built-in `getopt()` function as the first parameter and is used for setting up the command line arguments accepted by the check class.
- `Base::getLongOptions()`
    Returns available long options. The return value is supposed to be passed to PHP's built-in `getopt()` function as the second parameter and is used for setting up the command line arguments accepted by the check class.

    The `Base` class comes with the pre-defined long option `--help` which triggers the built-in help method `Base::displayHelp()`.
- `Base::getMessage()`
    Returns the plugin output. The return value is supposed to be echoed to stdout and defines the status message which will be passed to Icinga.
- `Base::getCode()`
    Returns the return code. The return value is supposed to be passed to PHP's built-in `exit()` function and defines the status code which will be passed to Icinga.
- `Base::setOptions($options)`
    This method accepts parsed command line arguments as returned by PHP's built-in `getopt()` function.

Check and notification classes should **NOT** extend this class directly. They should extend their corresponding base class `Check\Base` or `Notification\Base`accordingly.

### 2.2. Check Plugins

[](#22-check-plugins)

A basic approach at using a check plugin built with this package could look like this:

```
