Reputation: 27
i have this code to create the graph file
#!/bin/sh
rrdtool graph /var/www/temp_graph.png \
-w 1024 -h 400 -a PNG --slope-mode \
--start -1d --end now \
--vertical-label "temperature (C)" \
DEF:out=/opt/templog/data/templog.rrd:internal:AVERAGE \
DEF:in=/opt/templog/data/templog.rrd:external:AVERAGE \
LINE2:in#00ff00:"inside" \
LINE2:out#000ff:"outside"
And this file to create the rrd file:
#!/bin/sh
rrdtool create /opt/templog/data/templog.rrd --step 300 \
DS:internal:GAUGE:600:-55:125 \
DS:external:GAUGE:600:-55:125 \
RRA:AVERAGE:0.5:1:576 \
RRA:AVERAGE:0.5:3:1344 \
RRA:AVERAGE:0.5:12:1488 \
RRA:AVERAGE:0.5:72:1984 \
RRA:MIN:0.5:72:1984 \
RRA:MAX:0.5:72:1984
But when i create the graph, the temperature curve shows only positive temperature and not negative temperature.
When the temperature is going under 0 C, the curve is blank then become visible when temperature is positive.
How can i resolve this problem?
Upvotes: 0
Views: 1268
Reputation: 4072
There are two possibilities here:
In the first case, this could well be because the Lower Bound of the DS is incorrectly set to 0. Although the rrdtool create
command you specify above does give a negative lower bound, you should look at the actual RRD file you are using with rrdtool info
to verify that it does actually have the expected lower bound on the DS. It may be that things are not configured as you expect. If the lower bound is zero, then negative values will be discarded before being stored in the database. You can also use rrdtool dump
to check the values present in the RRA to verify that they are actually being stored.
The second case is more complex as it depends on the graphing parameters. Assuming that you are not using a CDEF to modify or restrict the range of the source data, the problem would be down to the graph Y-axis. In general, the Y-axis should expand to fit the data being graphed, unless you make it rigid with the --rigid
option. The -u
and -l
Upper- and lower- limits can be set to control this - maybe try -l -10
which should make the graph lower-limit at -10 or less depending on the data. Again, if you have graphed using exactly the command given above, you should not be getting this problem.
In summary, I would guess that your RRD file is set to have a lower limit of 0 for the DS, even though you think you created it with the command above. Verify the actual file using rrdtool info
.
Upvotes: 1