Library for getting status and statistic data of a Gearman Jobserver
- php >=5.3.0
$ composer require t3sec/gearman-status
use T3sec\GearmanStatus\GearmanMetrics;
use T3sec\GearmanStatus\GearmanServer;
$server = new GearmanServer();
$gearmanMetrics = new GearmanMetrics($server);
var_dump($gearmanMetrics->getRawData());
Uses default configuration of a Gearman Jobserver and returns raw metrics as array.
$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.
- \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