[rtg] Targetmaker creating lots of entries in options_table
Quigley, Mark R
QuigleM at inhs.org
Tue Sep 8 16:46:08 EDT 2009
Good afternoon,
I recently found an oddity that I am hard pressed to explain. I have
been porting the targetmaker.php found on Google Code to use the new
rtgplot executable ($newrtgplot = 1). To my surprise, I got a hundred or
so graphs for the same data. A little further investigation showed the
options_table seems to have multiple entries for the same graph options:
mysql> select * from options_table where class="cpu";
+-------------------+---------------------------------------+-------+
| graphname | options | class |
+-------------------+---------------------------------------+-------+
| Bluecoat-cpu | scaley=on gauge=on units=% | cpu |
| CISCOSNMP-cpu | gauge=on units=% | cpu |
| CPQSNMP-cpu | gauge=on units=% scaley=on borderb=90 | cpu |
| ExtremeSNMP-cpu | scaley=on gauge=on units=CPU% | cpu |
| HOSTRESOURCES-cpu | gauge=on units=% scaley=on | cpu |
| NetApp-cpu | gauge=on units=CPU% | cpu |
| NetSNMP-cpu | scaley=on gauge=on units=CPU% | cpu |
| SNMPInformant-cpu | gauge=on units=% scaley=on borderb=90 | cpu |
| Bluecoat-cpu | scaley=on gauge=on units=% | cpu |
| CISCOSNMP-cpu | gauge=on units=% | cpu |
| CPQSNMP-cpu | gauge=on units=% scaley=on borderb=90 | cpu |
| ExtremeSNMP-cpu | scaley=on gauge=on units=CPU% | cpu |
| HOSTRESOURCES-cpu | gauge=on units=% scaley=on | cpu |
| NetApp-cpu | gauge=on units=CPU% | cpu |
| NetSNMP-cpu | scaley=on gauge=on units=CPU% | cpu |
| SNMPInformant-cpu | gauge=on units=% scaley=on borderb=90 | cpu |
...
A closer look at targetmaker shows:
unless ( $#row == 0 ) {
$sql = "INSERT INTO options_table VALUES
('$graph','@{$table_options{$graph}}','$table_class{$graph}')";
&sql_insert($sql);
}
else {
if($row[1] ne join(@{$table_options{$graph}}) || $row[2] ne
$table_class{$graph}) {
$sql = "UPDATE options_table SET options='".join("
",@{$table_options{$graph}})."',class='$table_class{$graph}' WHERE
graphname='$graph'";
&sql_insert($sql);
}
}
Shouldn't that "unless" be an "if"? If so, I'm left with the challenge
that my table_options has many, many duplicate entries (one for each
targetmaker run). Cleanup is my next challenge.
Anyone else care to comment?
Thanks,
Mark
Mark Quigley
Network Planning Analyst, IRM Data Communications
(509) 252-6728 desk
(509) 768-5845 cell
http://www.inhs.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.grdata.com/pipermail/rtg/attachments/20090908/bf7730d0/attachment-0001.html>
More information about the RTG
mailing list