No ordering information in info hash

5 messages Options
Embed this post
Permalink
Hermann Lauer

No ordering information in info hash

Reply Threaded More More options
Print post
Permalink
Hello all,

I noticed that in the python bindings of rrdtool-1.3.99909060808
the rrdtool.info() function the datasources in the flat hash dict returned
are partly indexed with the datasource name and partly indexed with numbers
(see example below). Besides beeing somehow inconsistent a problem arises:

How to find out the ordering of datasources to
find the datasource name for the rra[].cdp_prep[] values (or for
using rrdtool.update('N:...:...:...')) without knowing the order
of the datasources.

How is this handled in other bindings (e.g. perl) ?

Please tell me if I missed something obvious,
  greetings
   Hermann

 
>>> import rrdtool
>>> rrdtool.__version__
'$Revision: 1.14 $'
>>> rrdtool.create('/tmp/test.rrd','--step','20','DS:ds2:GAUGE:300:0:100','DS:x1:GAUGE:300:0:100','DS:ds0:GAUGE:300:-5:100','RRA:AVERAGE:0.5:3:2')
>>> rrdtool.info('/tmp/test.rrd')
{'rra[0].cdp_prep[0].value': None, 'ds[ds2].min': 0.0, 'ds[ds0].min': -5.0, 'rra[0].cdp_prep[1].unknown_datapoints': 1L, 'ds[ds2].value': 0.0, 'ds[ds2].last_ds': 'U', 'ds[x1].max': 100.0, 'ds[ds2].unknown_sec': 5L, 'ds[ds0].value': 0.0, 'ds[ds0].unknown_sec': 5L, 'ds[ds0].max': 100.0, 'ds[ds2].max': 100.0, 'rrd_version': '0003', 'filename': '/tmp/test.rrd', 'last_update': 1256646805L, 'rra[0].cf': 'AVERAGE', 'ds[x1].type': 'GAUGE', 'rra[0].pdp_per_row': 3L, 'rra[0].cur_row': 1L, 'header_size': 1172L, 'ds[ds0].last_ds': 'U', 'step': 20L, 'rra[0].cdp_prep[0].unknown_datapoints': 1L, 'ds[ds0].type': 'GAUGE', 'rra[0].cdp_prep[2].value': None, 'ds[x1].last_ds': 'U', 'ds[ds2].minimal_heartbeat': 300L, 'rra[0].rows': 2L, 'ds[x1].min': 0.0, 'ds[ds0].minimal_heartbeat': 300L, 'ds[x1].unknown_sec': 5L, 'rra[0].xff': 0.5, 'rra[0].cdp_prep[2].unknown_datapoints': 1L, 'ds[ds2].type': 'GAUGE', 'rra[0].cdp_prep[1].value': None, 'ds[x1].value': 0.0, 'ds[x1].minimal_heartbeat': 300L}
 
--
Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres
Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg
IWR; INF 368; 69120 Heidelberg; Tel: (06221)54-8236 Fax: -5224
Email: [hidden email]

_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
Duncan McGreggor-2

Re: No ordering information in info hash

Reply Threaded More More options
Print post
Permalink
Hermann Lauer wrote:

> Hello all,
>
> I noticed that in the python bindings of rrdtool-1.3.99909060808
> the rrdtool.info() function the datasources in the flat hash dict returned
> are partly indexed with the datasource name and partly indexed with numbers
> (see example below). Besides beeing somehow inconsistent a problem arises:
>
> How to find out the ordering of datasources to
> find the datasource name for the rra[].cdp_prep[] values (or for
> using rrdtool.update('N:...:...:...')) without knowing the order
> of the datasources.
>
> How is this handled in other bindings (e.g. perl) ?
>
> Please tell me if I missed something obvious,
>   greetings
>    Hermann
>
>  
>>>> import rrdtool
>>>> rrdtool.__version__
> '$Revision: 1.14 $'
>>>> rrdtool.create('/tmp/test.rrd','--step','20','DS:ds2:GAUGE:300:0:100','DS:x1:GAUGE:300:0:100','DS:ds0:GAUGE:300:-5:100','RRA:AVERAGE:0.5:3:2')
>>>> rrdtool.info('/tmp/test.rrd')
> {'rra[0].cdp_prep[0].value': None, 'ds[ds2].min': 0.0, 'ds[ds0].min': -5.0, 'rra[0].cdp_prep[1].unknown_datapoints': 1L, 'ds[ds2].value': 0.0, 'ds[ds2].last_ds': 'U', 'ds[x1].max': 100.0, 'ds[ds2].unknown_sec': 5L, 'ds[ds0].value': 0.0, 'ds[ds0].unknown_sec': 5L, 'ds[ds0].max': 100.0, 'ds[ds2].max': 100.0, 'rrd_version': '0003', 'filename': '/tmp/test.rrd', 'last_update': 1256646805L, 'rra[0].cf': 'AVERAGE', 'ds[x1].type': 'GAUGE', 'rra[0].pdp_per_row': 3L, 'rra[0].cur_row': 1L, 'header_size': 1172L, 'ds[ds0].last_ds': 'U', 'step': 20L, 'rra[0].cdp_prep[0].unknown_datapoints': 1L, 'ds[ds0].type': 'GAUGE', 'rra[0].cdp_prep[2].value': None, 'ds[x1].last_ds': 'U', 'ds[ds2].minimal_heartbeat': 300L, 'rra[0].rows': 2L, 'ds[x1].min': 0.0, 'ds[ds0].minimal_heartbeat': 300L, 'ds[x1].unknown_sec': 5L, 'rra[0].xff': 0.5, 'rra[0].cdp_prep[2].unknown_datapoints': 1L, 'ds[ds2].type': 'GAUGE', 'rra[0].cdp_prep[1].value': None, 'ds[x1].value': 0.0, 'ds[x1].minimal_heartbeat': 300L}
>  

Hey Herman,

It's important to note that both the keys and the values in that data
tructure are strings -- don't let the form trick you :-) As such, you
can simply sort them like this:
  sorted(d.items())

And that will give you a list of (key, value) tuples that you can
iterate through and check. Since these are string values, you have to do
stringy things...

PyRRD does provide non-string keys in its data structures, so you have
more flexibility. If you want to email the PyRRD list, we can talk about
the type of data access you'd like to have... adding features like this
to PyRRD is probably much easier than doing so to the RRDTool Python
bindings.

Thanks,

d

_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
oetiker

Re: No ordering information in info hash

Reply Threaded More More options
Print post
Permalink
In reply to this post by Hermann Lauer
Hi Hermann,

there was an extension recently added a ds[x].index entry which
will help you resolve this problem ...

make sure you use a current snapshot of the archive ...

cheers
tobi


 Today Hermann Lauer wrote:

> Hello all,
>
> I noticed that in the python bindings of rrdtool-1.3.99909060808
> the rrdtool.info() function the datasources in the flat hash dict returned
> are partly indexed with the datasource name and partly indexed with numbers
> (see example below). Besides beeing somehow inconsistent a problem arises:
>
> How to find out the ordering of datasources to
> find the datasource name for the rra[].cdp_prep[] values (or for
> using rrdtool.update('N:...:...:...')) without knowing the order
> of the datasources.
>
> How is this handled in other bindings (e.g. perl) ?
>
> Please tell me if I missed something obvious,
>   greetings
>    Hermann
>
>
> >>> import rrdtool
> >>> rrdtool.__version__
> '$Revision: 1.14 $'
> >>> rrdtool.create('/tmp/test.rrd','--step','20','DS:ds2:GAUGE:300:0:100','DS:x1:GAUGE:300:0:100','DS:ds0:GAUGE:300:-5:100','RRA:AVERAGE:0.5:3:2')
> >>> rrdtool.info('/tmp/test.rrd')
> {'rra[0].cdp_prep[0].value': None, 'ds[ds2].min': 0.0, 'ds[ds0].min': -5.0, 'rra[0].cdp_prep[1].unknown_datapoints': 1L, 'ds[ds2].value': 0.0, 'ds[ds2].last_ds': 'U', 'ds[x1].max': 100.0, 'ds[ds2].unknown_sec': 5L, 'ds[ds0].value': 0.0, 'ds[ds0].unknown_sec': 5L, 'ds[ds0].max': 100.0, 'ds[ds2].max': 100.0, 'rrd_version': '0003', 'filename': '/tmp/test.rrd', 'last_update': 1256646805L, 'rra[0].cf': 'AVERAGE', 'ds[x1].type': 'GAUGE', 'rra[0].pdp_per_row': 3L, 'rra[0].cur_row': 1L, 'header_size': 1172L, 'ds[ds0].last_ds': 'U', 'step': 20L, 'rra[0].cdp_prep[0].unknown_datapoints': 1L, 'ds[ds0].type': 'GAUGE', 'rra[0].cdp_prep[2].value': None, 'ds[x1].last_ds': 'U', 'ds[ds2].minimal_heartbeat': 300L, 'rra[0].rows': 2L, 'ds[x1].min': 0.0, 'ds[ds0].minimal_heartbeat': 300L, 'ds[x1].unknown_sec': 5L, 'rra[0].xff': 0.5, 'rra[0].cdp_prep[2].unknown_datapoints': 1L, 'ds[ds2].type': 'GAUGE', 'rra[0].cdp_prep[1].value': None, 'ds[x1].value': 0.0, 'ds[x1].minimal_heartbeat': 300L}
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [hidden email] ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
Hermann Lauer

Re: No ordering information in info hash

Reply Threaded More More options
Print post
Permalink
[attachment removed]
_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
oetiker

Re: No ordering information in info hash

Reply Threaded More More options
Print post
Permalink
Hi Hermann,

try rrdtool-1.4.0.tar.gz ... which I just uploaded ... will
announce tomorrow.

cheers
tobi

Yesterday Hermann Lauer wrote:

> Hello Tobi,
>
> On Tue, Oct 27, 2009 at 09:43:40PM +0100, Tobias Oetiker wrote:
> > Hi Hermann,
> >
> > there was an extension recently added a ds[x].index entry which
> > will help you resolve this problem ...
>
> Great. Sounds exactly like what I missed.
>
> > make sure you use a current snapshot of the archive ...
>
> Just downloaded rrdtool-trunk-svn-snap.tar.gz, which unpacked to
> rrdtool-1.3.99909102700. "configure" and "make" ends with:
>
>   CC     rrd_restore.lo
> rrd_restore.c: In function ??rrd_restore??:
> rrd_restore.c:1260: warning: implicit declaration of function ??setlocale??
> rrd_restore.c:1260: warning: nested extern declaration of ??setlocale??
> rrd_restore.c:1260: error: ??LC_NUMERIC?? undeclared (first use in this function)
> rrd_restore.c:1260: error: (Each undeclared identifier is reported only once
> rrd_restore.c:1260: error: for each function it appears in.)
> rrd_restore.c:1260: warning: assignment makes pointer from integer without a cast
> make[2]: *** [rrd_restore.lo] Error 1
> make[2]: Leaving directory `/tmp/rrd/rrdtool-1.3.99909102700/src'
>
> This is on a current debian lenny. Probably I should wait for the next
> snapshot.
>
> But anyway, thanks for your help.
>  Greetings
>   Hermann
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [hidden email] ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers