SUPERMON

PROGRAMMING INTERFACE

Although the s-expression library provided with Supermon makes accessing and manipulating sample data very easy from languages like C, C++ and Ruby, there may be users who wish to simply get raw data and avoid the tedium of walking the raw parse trees. The ProgrammingInterface is provided for them. This API addresses the following user needs:

  • Accessing a description of the data provided by the DataProtocol.
  • Requesting a subset of the data provided as part of a sample.
  • Hiding the actual data source, allowing clients to operate on trace or live data transparently.
  • Accessing a description of the system providing the data.

The following assumes the reader is familiar with the Supermon DataProtocol.

Accessing descriptive information

Two types of descriptive information are of use to clients: that of the data itself, and the machine providing the data. The data description provides information regarding the sources. For example, a cluster may provide multiple categories such as hardware sensors and network. Within a category, there are variables. In sensors, one may encounter health data related to fans speeds and temperatures. Each variable may have differing numbers of sources - 4 fans and 6 thermal sensors for example.

typedef struct supermon_variable_source {
char name[256];
double lo, hi;
struct supermon_variable_source *next;
} smon_varsrc_t;
typedef struct supermon_category {
char name[256]; int bitmask;
int isBounded;
int numvars;
smon_datatype_t *vartypes;
char **varnames;
smon_varsrc_t **var_sources;
struct supermon_category *next;
} smon_category_t;
typedef struct supermon_desc {
int numnodes;
smon_category_t *categories;
} smon_desc_t;

Accessing data

smon_sample_t *get_sample_data(smon_connection_t *conn,
char *category, char *variable);
smon_sample_t *get_sample_data_slice(smon_connection_t *conn,
char *category, char *variable,
int index);
smon_datatype_t determine_string_type(char *str);

Sampling

smon_connection_t *init_socket_sampler(char *hostname, int port);
smon_connection_t *initialize_sampler(int fd, smon_conntype_t conntype);
void close_sampler(smon_connection_t *conn);
void condition_sampler(smon_connection_t *conn);
void destroy_sampler(smon_connection_t *conn);
void set_smon_mask(smon_connection_t *conn, int mask);
void set_smon_catmask(smon_connection_t *conn, char *category);
sample_sched_t *build_sample_schedule(char *conf_fname,
smon_connection_t *conn);
sample_stat_t get_smon_sample(smon_connection_t *conn);


 

Updated 08-13-2008