|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
No ordering information in info hashHello 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: Hermann.Lauer@... _______________________________________________ rrd-developers mailing list rrd-developers@... https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers |
|
|
Re: No ordering information in info hashHermann 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 rrd-developers@... https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers |
|
|
Re: No ordering information in info hashHi 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 tobi@... ++41 62 775 9902 / sb: -9900 _______________________________________________ rrd-developers mailing list rrd-developers@... https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |