Skip to content

Library for getting status and statistic data of a Gearman Jobserver

License

Notifications You must be signed in to change notification settings

t3sec/php-library-gearman-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php-gearman-status

Library for getting status and statistic data of a Gearman Jobserver

Requirements

  • php >=5.3.0

Installation

$ composer require t3sec/gearman-status

Usage

Namespacing

use T3sec\GearmanStatus\GearmanMetrics;
use T3sec\GearmanStatus\GearmanServer;

Basic Example

$server = new GearmanServer();
$gearmanMetrics = new GearmanMetrics($server);

var_dump($gearmanMetrics->getRawData());

Uses default configuration of a Gearman Jobserver and returns raw metrics as array.

Advanced Example

$server = new GearmanServer('192.1.1.10', 4444);
$gearmanMetrics = new GearmanMetrics($server);

$numWorkers = $gearmanMetrics->getNumberOfWorkersByFunction('ReverseIpLookup');
$unfinishedTasks = $gearmanMetrics->getUnfinishedTasksByFunction('ReverseIpLookup');

Retrieves metrics of a Gearman jobserver at IP 192.1.1.10 listening at port 4444. Number of connected workers and unfinished tasks are returned.

Exception handling

  • \InvalidArgumentException is thrown if a GermanServer is configured with invalid settings
  • T3sec\GearmanStatus\Exception\GearmanStatusException is thrown if the connection to the Gearman jobserver cannot be established

About

Library for getting status and statistic data of a Gearman Jobserver

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages