Subject: | DS commands with negative min values are ignored. |
Hi,
I am using RRD::Editor and noted that negative values for min on a DS
line cause that DS command to be silently ignored! Subsequent update
commands also silently misbehave. The following fails and the dump
shows the ITEMP field is missing. However if I perform everything from
the command line, then the dump includes an ITEMP field as expected.
Here is bits from the perl script.
$cmd = qq($rrdtool create $rrdb --start 1274020300 --step $heartbeat );
$args = qq(DS:BATTV:GAUGE:) . $maxw . qq(:0:50 ) . #1 Current battery voltage in volts
qq(DS:BCHARGE:GAUGE:) . $maxw . qq(:0:100 ) . #2 Current battery capacity charge percentage
qq(DS:CUMONBATT:COUNTER:) . $maxw . qq(:U:U ) . #3 Cumulative seconds on battery since apcupsd startup
qq(DS:ITEMP:GAUGE:) . $maxw . qq(:-10:90 ) . #4 UPS internal temperature in degrees Celcius
qq(DS:LINEFREQ:GAUGE:) . $maxw . qq(:0:70 ) . #5 Current line frequency in Hertz
qq(DS:LINEV:GAUGE:) . $maxw . qq(:50:300 ) .#6 Current input line voltage
qq(DS:LOADPCT:GAUGE:) . $maxw . qq(:0:100 ) . #7 Percentage of UPS load capacity used as estimated by UPS
qq(DS:OUTPUTV:GAUGE:) . $maxw . qq(:0:300 ) . #8 UPS output voltage
....snipped
$rrd->create("--start 1274020300 --step $heartbeat " . $args);
However when I look at the dumped rrd db I see. There is no hint of the
ITEMP:GAUGE field.
<rrd>
<version>0003</version>
<step>4</step> <!-- Seconds -->
<lastupdate>1305482579</lastupdate> <!-- 2011-05-15 19:02:59 BST -->
<ds>
<name> BATTV </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>0.0000000000e+00</min>
<max>5.0000000000e+01</max>
<!-- PDP Status -->
<last_ds>27.1</last_ds>
<value>8.1300000000e+01</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> BCHARGE </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>0.0000000000e+00</min>
<max>1.0000000000e+02</max>
<!-- PDP Status -->
<last_ds>100.0</last_ds>
<value>3.0000000000e+02</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> CUMONBATT </name>
<type> COUNTER </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>NaN</min>
<max>NaN</max>
<!-- PDP Status -->
<last_ds>211</last_ds>
<value>0.0000000000e+00</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> LINEFREQ </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>0.0000000000e+00</min>
<max>7.0000000000e+01</max>
<!-- PDP Status -->
<last_ds>39.1</last_ds>
<value>1.1730000000e+02</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> LINEV </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>5.0000000000e+01</min>
<max>3.0000000000e+02</max>
<!-- PDP Status -->
<last_ds>50.0</last_ds>
<value>1.5000000000e+02</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> LOADPCT </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>0.0000000000e+00</min>
<max>1.0000000000e+02</max>
<!-- PDP Status -->
<last_ds>240.4</last_ds>
<value>NaN</value>
<unknown_sec> 3 </unknown_sec>
</ds>
<ds>
<name> OUTPUTV </name>
<type> GAUGE </type>
<minimal_heartbeat>8</minimal_heartbeat>
<min>0.0000000000e+00</min>
<max>3.0000000000e+02</max>
<!-- PDP Status -->
<last_ds>5.8</last_ds>
<value>1.7400000000e+01</value>
<unknown_sec> 0 </unknown_sec>
</ds>
<!-- Round Robin Archives -->
<rra>
Changing the min from -10 to 0 causes the ITEMP field to appear in the dump
when using RRD::Editor. If using the command line, the following equivalent
command works fine.
rrdtool create x.rrd --start 1274020300 --step 4 DS:BATTV:GAUGE:8:0:50 DS:BCHARGE:GAUGE:8:0:100 DS:CUMONBATT:COUNTER:8:U:U DS:ITEMP:GAUGE:8:-20:90 DS:LINEFREQ:GAUGE:8:0:70 DS:LINEV:GAUGE:8:50:300 DS:LOADPCT:GAUGE:8:0:100 DS:OUTPUTV:GAUGE:8:0:300 RRA:MIN:0.5:43:800 RRA:MIN:0.5:302:800 RRA:MIN:0.5:1296:800 RRA:MIN:0.5:7884:800 RRA:AVERAGE:0.5:43:800 RRA:AVERAGE:0.5:302:800 RRA:AVERAGE:0.5:1296:800 RRA:AVERAGE:0.5:7884:800 RRA:MAX:0.5:43:800 RRA:MAX:0.5:302:800 RRA:MAX:0.5:1296:800 RRA:MAX:0.5:7884:800
I am using:
cpan[5]> i RRD::Editor
Module id = RRD::Editor
DESCRIPTION Portable RRD editor (no need for RRDs.pm)
CPAN_USERID DOUGLEITH (Doug Leith <dougleith@cpan.org>)
CPAN_VERSION 0.16
CPAN_FILE D/DO/DOUGLEITH/RRD-Editor-0.16.tar.gz
UPLOAD_DATE 2013-01-28
DSLIP_STATUS bdphp (beta,developer,perl,hybrid,Standard-Perl)
MANPAGE RRD::Editor - Portable, standalone (no need for RRDs.pm) tool to create and edit RRD files.
INST_FILE /usr/local/lib/perl5/site_perl/5.18.0/RRD/Editor.pm
INST_VERSION 0.16
cpan[6]> quit
Lockfile removed.
root: rrdtool --version
RRDtool 1.4.8 Copyright 1997-2013 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Jun 16 2013 13:25:13
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport, flushcached
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
fergus: uname -a
Darwin macbookpro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
fergus: perl -v
This is perl 5, version 18, subversion 0 (v5.18.0) built for darwin-2level