HP-UX Workload Manager User's Guide

Advanced WLM usage: Using performance metrics
Supplying data to WLM
Appendix H 515
/opt/wlm/bin/wlmsend job_time $value
sleep 60
done
In a perl program, the loop might look like one of the following:
while (1) {
$value = &get_value;
system “/opt/wlm/bin/wlmsend job_time $value”;
sleep(60);
}
Using a print statement instead of a system statement:
open(WLM, “| /opt/wlm/bin/wlmsend $metric”);
# make the new file descriptor unbuffered
select ((select(WLM), $|=1)[0]);
while (1) {
$value = &get_value;
print WLM “$value\n”;
sleep(60);
}
Handling signals in data collectors
When a data collector is spawned, it inherits the signal handling actions
that the WLM daemon inherits. (Ordinarily, these would be the default
actions described in signal(5).) Additionally, when the data collector
process begins execution, its inherited signal mask should be 0, so that
no signals are currently being blocked.
Currently, SIGTERM is the only signal that is delivered by WLM to the
spawned data collectors.
WLM uses the signal SIGTERM to terminate a spawned data collector
when it is no longer required. A well-behaved data collector will install a
handler function for SIGTERM, so that wlm_mon_detach() can be called
(if attached) as part of its cleanup. This is the recommended approach,
though it is not required to explicitly detach. In any case, SIGTERM should
not be ignored (that is, set to SIG_IGN).