Norman Elton
2009-06-05 14:25:53 UTC
Multitarget graphs normally label each line using the datasource name,
ignoring any display_name. This meant that individual graphs used the
"friendly" name, while multitarget graphs were somewhat cryptic. We
assigned this to one of our ace undergraduate programming students,
who whipped up a patch to fix the problem. I'll attach below. Once
applied, multitarget graphs will use the display_name.
Enjoy!
Norman Elton
College of William & Mary
========
diff -Naur ./cricket-1.0.5/grapher.cgi ./cricket-1.0.5.work/grapher.cgi
--- cricket-1.0.5/grapher.cgi 2004-02-06 11:27:34.000000000 -0500
+++ cricket-1.0.5.work/grapher.cgi 2009-06-05 09:42:36.000000000 -0400
@@ -941,7 +941,11 @@
if ($rrd && $rrd->loadHeader()) {
if (($isMTargets) && (!$isMTargetsOps)) {
- print "Values at last update for $tname:<br>";
+ if(exists($targRef->{'display-name'})) {
+ print "Values at last update for
$targRef->{'display-name'}:<br>";
+ } else {
+ print "Values at last update for $tname:<br>";
+ }
} elsif (!$printOnce) {
print "Values at last update:<br>";
$printOnce = 1;
@@ -1509,7 +1513,11 @@
$legend = graphParam($gRef, 'legend', $ds);
if (($isMTarget) && (!$isMTargetsOps)) {
- $legend .= " ($thisTname)";
+ if(exists($targRef->{'display-name'})) {
+ $legend .= " ($targRef->{'display-name'})";
+ } else {
+ $legend .= " ($thisTname)";
+ }
}
$color = graphParam($gRef, 'color', nextColor($colorRef));
[
ignoring any display_name. This meant that individual graphs used the
"friendly" name, while multitarget graphs were somewhat cryptic. We
assigned this to one of our ace undergraduate programming students,
who whipped up a patch to fix the problem. I'll attach below. Once
applied, multitarget graphs will use the display_name.
Enjoy!
Norman Elton
College of William & Mary
========
diff -Naur ./cricket-1.0.5/grapher.cgi ./cricket-1.0.5.work/grapher.cgi
--- cricket-1.0.5/grapher.cgi 2004-02-06 11:27:34.000000000 -0500
+++ cricket-1.0.5.work/grapher.cgi 2009-06-05 09:42:36.000000000 -0400
@@ -941,7 +941,11 @@
if ($rrd && $rrd->loadHeader()) {
if (($isMTargets) && (!$isMTargetsOps)) {
- print "Values at last update for $tname:<br>";
+ if(exists($targRef->{'display-name'})) {
+ print "Values at last update for
$targRef->{'display-name'}:<br>";
+ } else {
+ print "Values at last update for $tname:<br>";
+ }
} elsif (!$printOnce) {
print "Values at last update:<br>";
$printOnce = 1;
@@ -1509,7 +1513,11 @@
$legend = graphParam($gRef, 'legend', $ds);
if (($isMTarget) && (!$isMTargetsOps)) {
- $legend .= " ($thisTname)";
+ if(exists($targRef->{'display-name'})) {
+ $legend .= " ($targRef->{'display-name'})";
+ } else {
+ $legend .= " ($thisTname)";
+ }
}
$color = graphParam($gRef, 'color', nextColor($colorRef));
[