Monitoring Gearman over Telnet port 4730

So, the only way to monitor the Gearman daemon is via telnet to port 4730.

The current monitoring supported commands are really fairly basic.

I could not locate any documentation on the support commands so had to, “literally look at the code to figure out the supported commands” (the below command documentation is copied from the comments in code).

Note: There are plans to include more set of commands in the next release.

Command: STATUS

The output format of this function is tab separated columns as follows, followed by a line consisting of a full stop and a newline (”.n”) to indicate the end of output, below are the columns shown:

– Function name : A string denoting the name of the function of the job
– Number in queue : A positive integer indicating the total number of jobs for this function in the queue. This includes currently running ones as well (next column)
– Number of jobs running : A positive integer showing how many jobs of this function are currently running
– Number of capable workers : A positive integer denoting the maximum possible count of workers that could be doing this job. Though they may not all be working on it due to other tasks holding them busy.

Notification    1    0    1
GroupNews    2    1    1

Command : WORKERS

This command show the details of various clients registered with the “gearmand” server. For each worker it shows the following info:

– Peer IP: Client remote host
 Client ID: Unique ID assigned to client
– Functions: List of functions this client has registered for.

12 :: – : Notification
11 :: – : GroupNews

Any other command text throws a error “ERR unknown_command Unknown+server+command”

Here is a simple PHP class, to get the output of the two currently supported monitoring commands:

GearmanTelnet.php (GitHub)