[solved] Legend draws from wrong data source
Moderators: Developers, Moderators
[solved] Legend draws from wrong data source
Hi all,
We use 0.8.7b. I have modified a template found in another post to create a graph that gets data from 7 different devices (data sources) and shows them as an area and a set of curves (this is to monitor the latency of a leased line from Cambridge to Shanghai).
Whilst the graph shows all data correctly, the legend underneath has a problem, because the GPRINTs for the legend items draw on the wrong data sources (in bold below).
Output of the graph debug clearly shows the problem:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="The route to Shanghai" \
--base=1000 \
--height=300 \
--width=800 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/router_shanghai_ping_299.rrd":ping:AVERAGE \
DEF:b="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:MAX \
DEF:c="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:AVERAGE \
DEF:d="/var/lib/cacti/rra/singtel_second_last_router_ping_334.rrd":ping:AVERAGE \
DEF:e="/var/lib/cacti/rra/singtel_hkgcw-cr3_ping_331.rrd":ping:AVERAGE \
DEF:f="/var/lib/cacti/rra/singtel_san_jose_ping_333.rrd":ping:AVERAGE \
DEF:g="/var/lib/cacti/rra/singtel_san_jose_ping_333.rrd":ping:MAX \
DEF:h="/var/lib/cacti/rra/tiscali_-_singtel_gw_ping_335.rrd":ping:AVERAGE \
DEF:i="/var/lib/cacti/rra/tiscali_-_singtel_gw_ping_335.rrd":ping:MAX \
DEF:j="/var/lib/cacti/rra/tiscali_london_ping_336.rrd":ping:AVERAGE \
DEF:ba="/var/lib/cacti/rra/tiscali_london_ping_336.rrd":ping:MAX \
AREA:a#FAFD9EFF:"Amino Shanghai\: 202.83.208.106" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:c#FFC73BFF:"Singtel Shanghai\: 202.83.208.105" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:d#FFAB00FF:"Singtel Router\: 203.208.192.30" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:e#FF7D00FF:"Singtel Hongkong\: 203.208.152.125" \
GPRINT:c:LAST:"Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:f#FF5700FF:"Singtel San Jose\: 203.208.149.2" \
GPRINT:f:LAST:" Current\:%8.2lf%s" \
GPRINT:g:MAX:"Maximum\:%8.2lf%s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf%s\n" \
LINE2:h#FF4105FF:"Tiscali San Jose\: 77.67.79.2" \
GPRINT:h:LAST:" Current\:%8.2lf%s" \
GPRINT:i:MAX:"Maximum\:%8.2lf%s" \
GPRINT:h:AVERAGE:"Average\:%8.2lf%s\n" \
LINE2:j#FF0000FF:"Tiscali London\: 146.188.112.6" \
GPRINT:j:LAST:" Current\:%8.2lf%s" \
GPRINT:ba:MAX:"Maximum\:%8.2lf%s" \
GPRINT:j:AVERAGE:"Average\:%8.2lf%s\n"
In fact, because all 7 legend lines are made up of 3 GRPINTS for average, maximum and current, there are DEFs missing for some of them.
The strange thing is that it's only wrong for the first 4 legend rows, the final three rows are fine. What am I doing wrong and how can I correct this?
We use 0.8.7b. I have modified a template found in another post to create a graph that gets data from 7 different devices (data sources) and shows them as an area and a set of curves (this is to monitor the latency of a leased line from Cambridge to Shanghai).
Whilst the graph shows all data correctly, the legend underneath has a problem, because the GPRINTs for the legend items draw on the wrong data sources (in bold below).
Output of the graph debug clearly shows the problem:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="The route to Shanghai" \
--base=1000 \
--height=300 \
--width=800 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/router_shanghai_ping_299.rrd":ping:AVERAGE \
DEF:b="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:MAX \
DEF:c="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:AVERAGE \
DEF:d="/var/lib/cacti/rra/singtel_second_last_router_ping_334.rrd":ping:AVERAGE \
DEF:e="/var/lib/cacti/rra/singtel_hkgcw-cr3_ping_331.rrd":ping:AVERAGE \
DEF:f="/var/lib/cacti/rra/singtel_san_jose_ping_333.rrd":ping:AVERAGE \
DEF:g="/var/lib/cacti/rra/singtel_san_jose_ping_333.rrd":ping:MAX \
DEF:h="/var/lib/cacti/rra/tiscali_-_singtel_gw_ping_335.rrd":ping:AVERAGE \
DEF:i="/var/lib/cacti/rra/tiscali_-_singtel_gw_ping_335.rrd":ping:MAX \
DEF:j="/var/lib/cacti/rra/tiscali_london_ping_336.rrd":ping:AVERAGE \
DEF:ba="/var/lib/cacti/rra/tiscali_london_ping_336.rrd":ping:MAX \
AREA:a#FAFD9EFF:"Amino Shanghai\: 202.83.208.106" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:c#FFC73BFF:"Singtel Shanghai\: 202.83.208.105" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:d#FFAB00FF:"Singtel Router\: 203.208.192.30" \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:e#FF7D00FF:"Singtel Hongkong\: 203.208.152.125" \
GPRINT:c:LAST:"Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE2:f#FF5700FF:"Singtel San Jose\: 203.208.149.2" \
GPRINT:f:LAST:" Current\:%8.2lf%s" \
GPRINT:g:MAX:"Maximum\:%8.2lf%s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf%s\n" \
LINE2:h#FF4105FF:"Tiscali San Jose\: 77.67.79.2" \
GPRINT:h:LAST:" Current\:%8.2lf%s" \
GPRINT:i:MAX:"Maximum\:%8.2lf%s" \
GPRINT:h:AVERAGE:"Average\:%8.2lf%s\n" \
LINE2:j#FF0000FF:"Tiscali London\: 146.188.112.6" \
GPRINT:j:LAST:" Current\:%8.2lf%s" \
GPRINT:ba:MAX:"Maximum\:%8.2lf%s" \
GPRINT:j:AVERAGE:"Average\:%8.2lf%s\n"
In fact, because all 7 legend lines are made up of 3 GRPINTS for average, maximum and current, there are DEFs missing for some of them.
The strange thing is that it's only wrong for the first 4 legend rows, the final three rows are fine. What am I doing wrong and how can I correct this?
I've had that issue before. I'm not sure if this will make any sense, but here goes:
Go to your graph template (first image), and jot down the Item numbers associated to the data source you are needing to work with.
Next, go to the data source, and verify that the check-boxes for the associated item numbers, and ONLY those check-boxes are checked. Refer to images 2 and 3.
Ok, in my example, I used the "Alpha PS Stats" graph template.
I wanted to verify that "Battery Voltage 1" was being properly graphed. I note that Items numbered 16-20 are associated to "Battery Voltage 1". I then go in to the graph item input for "Data Source [bat_voltage1]" and make sure the proper check-boxes are checked, and no others are checked. Once that is done, it should all be working again.
Go to your graph template (first image), and jot down the Item numbers associated to the data source you are needing to work with.
Next, go to the data source, and verify that the check-boxes for the associated item numbers, and ONLY those check-boxes are checked. Refer to images 2 and 3.
Ok, in my example, I used the "Alpha PS Stats" graph template.
I wanted to verify that "Battery Voltage 1" was being properly graphed. I note that Items numbered 16-20 are associated to "Battery Voltage 1". I then go in to the graph item input for "Data Source [bat_voltage1]" and make sure the proper check-boxes are checked, and no others are checked. Once that is done, it should all be working again.
- Attachments
-
- image3.png (54.77 KiB) Viewed 1699 times
-
- image2.png (94.51 KiB) Viewed 1699 times
-
- image1.png (70.34 KiB) Viewed 1699 times
I used to think so, but it usually is something overlooked. That's why rebuilding those fixes it. When you rebuild it, you are doing it with a fresh set of eyes. Some times it's just faster to fix something than try to figure out what went wrong. I do have issues with Cacti, but not there. 10 times out of 10, it's something I did wrong.
Possibly, especially since you're using an old version of cacti -- 0.8.7e is the latest with g to be released soon.wszachau wrote:Is there no way this can be fixed? Surely this is a bug in the code?
anyways the reasons the legends are different from the lines is due to the source in the rrd file and MAX vs AVERAGE. Example:
Code: Select all
DEF:b="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:MAX \
DEF:c="/var/lib/cacti/rra/singtel_last_router_ping_332.rrd":ping:AVERAGE \
GPRINT:c:LAST:" Current\:%8.2lf%s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n" \
LINE2:c#FFC73BFF:"Singtel Shanghai\: 202.83.208.105" \
GPRINT:b means to use singtel_last_router_ping_332.rrd":ping:MAX.
Once that all gets corrected, you'll be set.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
I did get it sorted, but only by completely deleting the graph template and rebuilding it from scratch, and in the right sequence. It looks like the internal are getting their knickers in a twist as soon as the data sources are added to early and then edited later on.
TBH, right now I really don't have the time to find out exactly where in the code the bug is and whether or not it has been fixed in a later version. Sorry guys, I have work to do.
TBH, right now I really don't have the time to find out exactly where in the code the bug is and whether or not it has been fixed in a later version. Sorry guys, I have work to do.
Who is online
Users browsing this forum: No registered users and 1 guest