aashley / nagios-livestatus-client
An OO client to talk to MK Livestatus
Installs: 26 347
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 3
Forks: 9
Open Issues: 2
Requires
- php: >=5.3.1
- ext-json: *
- ext-sockets: *
Requires (Dev)
- phpunit/phpunit: @stable
This package is auto-updated.
Last update: 2024-04-17 15:38:17 UTC
README
This package implements a PHP OO client for talking to the MK Livestatus Nagios Event Broker.
This implementation is based on Lars Michelsen's LivestatusSlave.
Requirements
- PHP 5.3.1+
- Sockets enabled
- JSON enabled
Usage
<?php use Nagios\Livestatus\Client; $options = array( 'socketType' => 'tcp', 'socketAddress' => '10.253.14.22', 'socketPort' => '6557', ); $client = new Client($options); $response = $client ->get('hosts') ->column('host_name') ->column('state') ->execute(); foreach ($response as $host) { print $host[0] . ": " . $host[1] . "\n"; } $response = $client ->get('hosts') ->column('host_name') ->column('state') ->executeAssoc(); foreach ($response as $host) { print $host['host_name'] . ": " . $host['state'] . "\n"; } $client->command( array( 'ACKNOWLEDGE_SVC_PROBLEM', 'example.com', 'some service', 2, 0, 1, 'username', 'Example comment' ) );
Installation
In composer add a dependancy on aashley/nagios-livestatus-client
composer require aashley/nagios-livestatus-client