devophp/nagios

Execute nagios checks and parse the output with PHP classes

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

dev-master 2014-06-10 09:26 UTC

README

This library lets you run Nagios checks and parse the output from your PHP application.

Example:

$nagioschecker = new \Devophp\Component\Nagios\Checker();
$nagioschecker->autoDetectPluginPath();

$response = $nagioschecker->check('users', '-w 3 -c 5');

echo "Statuscode: " . $response->getStatusCode() . ' (' . $response->getStatusText() . ')' . "\n";
echo "ServiceOutput: " . $response->getServiceOutput() . "\n";
echo "ServicePerfData: " . $response->getServicePerfData() . "\n";

Included console tool

This library comes with a simple command line tool that you can use to run tests through this library.

Some example commands:

bin/console nagios:check users --arguments="-w 3 -c 5"

This will output:

Running check 'users' with arguments: '-w 3 -c 5'
Pluginpath: /usr/local/Cellar/nagios-plugins/2.0/sbin/
Statuscode: 0 (OK)
ServiceOutput: USERS OK - 2 users currently logged in
ServicePerfData: users=2;3;5;0