Commit f35befaa authored by Leigh B. Stoller's avatar Leigh B. Stoller

Save latest data to /usr/testbed/log for plabstats.

parent f8f55fd7
......@@ -33,7 +33,7 @@ my $now = time();
#
# Only real root can call this.
#
if (0 && $UID != 0) {
if ($UID != 0) {
print STDERR "You must be root to run this script!\n";
exit(-1);
}
......@@ -64,6 +64,7 @@ use libtestbed;
# Locals
my $tempfile = "/tmp/plabxml.$$";
my $agedfile = "$TB/log/plabxml.txt";
my %nodemap = ();
my $LOADMETRIC;
my $MAXLOAD;
......@@ -184,7 +185,7 @@ my $query_result =
"left join node_types as nt on n.type=nt.type ".
"left join interfaces as i on i.node_id=n.node_id ".
"where nt.isremotenode=1 and nt.isvirtnode=0 ".
"and nt.type like 'pcplab%'");
"and nt.class='pcplabphys'");
while (my ($nodeid,$IP) = $query_result->fetchrow_array()) {
$nodemap{$IP} = $nodeid;
......@@ -215,6 +216,13 @@ foreach my $arg (keys(%nodemap)) {
}
}
#
# If the data came from the web server, copy to the aged file.
# Only if root though
#
system("cp -f $tempfile $agedfile")
if (!defined($xmlfile) && !$UID);
unlink($tempfile)
if (-e $tempfile);
exit(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment