Name

lcb_server_stats — get server statistics

Synopsis

cc [ flag … ] file… -lcouchbase [ library … ]

#include <libcouchbase/couchbase.h>
lcb_error_t lcb_server_stats(lcb_t instance,
                             const void *command_cookie,
                             lcb_size_t num,
                             const lcb_server_stats_cmd_t *const *commands);

DESCRIPTION

lcb_server_stats() is used to get statistics from the servers in the cluster. Note that stats may be divided into different groups, which may be retrieved with a string argument. The default set of stats takes no string argument. See the Couchbase Server documentation for more information on stats arguments.

If the library instance is using asynchronous mode (the default) this operation will return immediately and schedule the operations to be executed by the event loop, otherwise it will block until all commands are executed. command_cookie is is an opaque field that will be provided to the callback function. num is the number of entries in the commands array.

lcb_server_stats_cmd_t is a structure defined in <libcouchbase/arguments.h>:

typedef struct lcb_server_stats_cmd_t {
    int version;              /* The enty in "v" to use */
    union {
        struct {
            /** The name of the stats group to get */
            const void *name;
            /** The number of bytes in name */
            lcb_size_t nname;
        } v0;
    } v;
};

Upon completion the stats callback as set by lcb_set_stat_callback(3couchbase) is called. The callback is called multiple times. See lcb_set_stat_callback(3couchbase) for more information about version callbacks.

RETURN VALUES

lcb_version() returns the LCB_SUCCESS on success, or a specific error code upon failure. See lcb_strerror(3couchbase) for more information.

EXAMPLES #include <libcouchbase/couchbase.h>

...
lcb_t instance;
...
lcb_server_stats_cmd_t *stats = calloc(1, sizeof(*version));
stats->version = 0;
stats->v.v0.name = "tap";
stats->v.v0.nname = 3;
lcb_server_stats_cmd_t* commands[] = { stats };
lcb_server_stats(instance, NULL, 1, commands);
...

ATTRIBUTES

See lcb_attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability

Committed

MT-Level

MT-Safe

COPYRIGHT

Copyright 2010-2013 Couchbase, Inc.

SEE ALSO

Learn more at http://www.couchbase.com/communities/c.

libcouchbase(3lib), lcb_get_stat_callback(3couchbase), lcb_set_stat_callback(3couchbase), lcb_attributes(5)