in gearman, Open Source, PHP

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)

  1. Hi, I used your GearmanTelnet to monitor my gearmand, and it return something like thisnn20 ::1c00:0:8c51:9b00%157069104 – : reverse_stringnnI don’t know how to get Pear IP and Client ID from it, can you explain?nnThanks.

  2. Hi Patrick,nnI have been using your GearmanTelnet class for a while, and since I wrapped it with couple of more classes that make the usage very convenient for several uses (munin plugin, html monitoring page, and loads prevention checks), i have wanted to contribute my work back to the community.nnI created a fork from your github project, and updated the class. You can review it here: http://github.com/liorbk/php.nnBasically, I added GearmanClusterAdmin and GearmanHost classes. The first is an aggragator to the second. The second is an a wrapper to the telnet raw data., of the Status and Workers function.nnIf you wish, you can merge the work to the main branch.nnThanks,

Comments are closed.