Friday, August 07, 2009

Monitoring Gearman over telnet port 4730

So the only way to monitor Gearman is via doing a telnet to port 4730. The current monitoring supported commands are 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). 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.

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.

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



sudhirv@sudhirv:~$ telnet localhost 4730
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

STATUS
.
WORKERS
11 127.0.0.1 - :
.
status
.
workers
11 127.0.0.1 - :
.
some crap
ERR unknown_command Unknown+server+command

#### will add more samples in action when I have this thing up and running ####

1 comment:

  1. Anonymous12:36 PM

    You can find additional commands in the documentation:
    http://gearman.org/index.php?id=protocol
    in the Administrative Protocol section.
    Additional commands are:
    maxqueue

    This sets the maximum queue size for a function. If no size is
    given, the default is used. If the size is negative, then the queue
    is set to be unlimited. This sends back a single line with "OK".

    Arguments:
    - Function name.
    - Optional maximum queue size.

    shutdown

    Shutdown the server. If the optional "graceful" argument is used,
    close the listening socket and let all existing connections
    complete.

    Arguments:
    - Optional "graceful" mode.

    version

    Send back the version of the server.

    Arguments:
    - None.

    ReplyDelete