HP-UX Workload Manager User's Guide

Advanced WLM usage: Using performance metrics
Supplying data to WLM
Appendix H502
NOTE This function is not thread-safe: Multiple threads cannot call the
function at the same time.
The syntax is:
int wlm_mon_attach(char *metric);
where
metric
Is the name of the metric being passed on this
connection. This string must exactly match the metric
string used in the configuration file, in the specification
of the goal.
For convenience, when the WLM daemon starts the
data collector executable, it places the name of the
metric it is expecting from the collector in the
WLM_METRIC_NAME environment variable. Using this, a
collector that is capable of providing multiple metrics
can determine which metric the daemon is expecting.
The exit status values for wlm_mon_attach() are:
>= 0 Success. Identifies the communication channel for
passing data for the metric specified in the metric
argument.
Use this handle in subsequent calls to the API.
-1 Failure
Example:
handle_id = wlm_mon_attach(getenv(“WLM_METRIC_NAME”));
if (handle_id == -1) {
fprintf(output, “wlm_mon_attach failed: %s\n”, strerror(errno));
exit(1);
}
Sending data with wlm_mon_write() The data collector uses the
wlm_mon_write() function to write messages to the communication
channel specified by the supplied handle_id parameter.
To use this function, you must reference the following include file: