IBM-LoadLeveler
view release on metacpan or search on metacpan
examples/xmlrss-llq view on Meta::CPAN
# Hotlink for more detailed LoadLeveler Information page off webserver
my $link = "http://$host.$domain/LoadL.html";
while(TRUE) {
$jobs_idle = 0;
$jobs_run = 0;
$jobs_held = 0;
$jobs_preempt = 0;
$jobs_not_queued = 0;
#
# Query Job Status information
#
$query = ll_query(JOBS);
$return=ll_set_request($query,QUERY_ALL,undef,ALL_DATA);
if ($return != 0 )
{
print STDERR "ll_set_request failed Return = $return\n";
}
#
# Query the scheduler for information
#
$job=ll_get_objs($query,LL_CM,NULL,$number,$err);
while($job)
{
#
# Get the status for the first step of that Job
#
$step=ll_get_data($job,LL_JobGetFirstStep);
while($step)
{
$holdtype=ll_get_data($step,LL_StepHoldType);
$state=ll_get_data($step,LL_StepState);
$st=$StepState[$state];
$jobs_run++ if ($st == "R");
$jobs_idle++ if ($st == "I");
$jobs_held++ if ($holdtype > 0 );
$jobs_preempt++ if ($st == "E");
$jobs_nqueued++ if ($st == "NQ");
$step=ll_get_data($job,LL_JobGetNextStep);
}
$job=ll_next_obj($query);
}
#
# Free up space allocated by LoadLeveler
#
ll_free_objs($job);
ll_deallocate($query);
$title_string = "Jobs: R=$jobs_run, I=$jobs_idle, H=$jobs_held, NQ=$jobs_not_queued E=$jobs_preempt";
$nodes_busy = 0;
$nodes_idle = 0;
$nodes_running = 0;
$nodes_down = 0;
#
# Query Job Status information
#
$query = ll_query(MACHINES);
$return=ll_set_request($query,QUERY_ALL,undef,ALL_DATA);
if ($return != 0 )
{
print STDERR "ll_set_request failed Return = $return\n";
}
#
# Query the scheduler for information
# $number will contain the number of objects returned
#
$machine=ll_get_objs($query,LL_CM,NULL,$number,$err);
while($machine)
{
#
# Get the startd status for each machine
#
$sts=ll_get_data($machine,LL_MachineStartdState);
$nodes_busy++ if ($sts =~ /^Busy/);
$nodes_idle++ if ($sts =~ /^Idle/);
$nodes_running++ if ($sts =~ /^Running/);
$nodes_down++ if ($sts =~ /^Down/);
$machine=ll_next_obj($query);
}
#
# Free up space allocated by LoadLeveler
#
ll_free_objs($machine);
ll_deallocate($query);
# Generate the RSS feed file
$rss_file = "/web/htdocs/LoadL.rdf";
$title_string .= ". Nodes: B=$nodes_busy, R=$nodes_running, I=$nodes_idle, D=$nodes_down";
$rss = XML::RSS->new(version=>'0.99');
$rss->channel(
title => "LoadLeveler Status",
link => "http://www.somecluster/",
description => "LoadLeveler Status.");
$rss->add_item( title => $title_string, link => $link);
$rss->save($rss_file);
# sleep for a while
sleep($seconds);
}
( run in 1.139 second using v1.01-cache-2.11-cpan-39bf76dae61 )