Skip to content

Tool RrdManip

Andreas Drollinger edited this page Jun 3, 2017 · 2 revisions

THC RRD database manipulation utility

RrdManip.tcl allows manipulating Rrd databases used by THC. It requires that Tcl 8.5 or above is installed as well as the Rrd tools.

RrdManip.tcl is stored inside the modules/thc_Rrd directory. It needs to have execution privileges to run it.

Syntax

 RrdManip.tcl list   <RrdDatabaseFile>
 RrdManip.tcl add    <RrdDatabaseFile> <Device1> <Device2> ...
 RrdManip.tcl rename <RrdDatabaseFile> <Device1OldName> <Device1NewName> \
                                       <Device2OldName> <Device2NewName> ...
 RrdManip.tcl remove <RrdDatabaseFile> <Device1> <Device2> ...
 RrdManip.tcl modif <RrdDatabaseFile> <Device> <Expression>
                    [-from <FromTime>] [-to <ToTime>]
 (the expression has to refer the original value with '$Value')
 RrdManip.tcl range <RrdDatabaseFile> <Device> <LowLimit> <HighLimit>
                    [-from <FromTime>] [-to <ToTime>]

Description

RrdManip.tcl can list, add, rename or remove devices from/to an existing THC RRD database, as well as modify stored device values. The provided device names are converted into RRD conform names (e.g. device names truncated to 19 characters, ',' replaced by '_').

If the -from and/or -to option is provided the device value modification is performed only in a certain time range. The FromTime and ToTime arguments have to correspond to valid Tcl time expressions.

Examples

 chmod 777 /opt/thc/modules/thc_Rrd/RrdManip.tcl

 /opt/thc/modules/thc_Rrd/RrdManip.tcl list   /var/thc/thc.rrd
 /opt/thc/modules/thc_Rrd/RrdManip.tcl add    /var/thc/thc.rrd Light,Living Light,Cellar
 /opt/thc/modules/thc_Rrd/RrdManip.tcl rename /var/thc/thc.rrd Light,Cellar Light,Basement
 /opt/thc/modules/thc_Rrd/RrdManip.tcl remove /var/thc/thc.rrd Light,Living Light,Basement
 /opt/thc/modules/thc_Rrd/RrdManip.tcl modif  /var/thc/thc.rrd Temp,Living '$Value+0.3' \
                                              -from {Jun 27 06:01:00 CEST 2016}
 /opt/thc/modules/thc_Rrd/RrdManip.tcl range  /var/thc/thc.rrd Temp,Living 10 35 \
                                              -from "2016-06-27 06:01:00 CEST" \
                                              -to "2016-06-27 07:00:00 CEST"

Clone this wiki locally