Class ::rrd::DataSource (public)
::nx::Class ::rrd::DataSource
Defined in packages/rrd-tool/tcl/rrd-procs.tcl
- Testcases:
- No testcase defined.
Source code: :property name :property baseResolution :property rrdFile :property {type DERIVE} :method createRRDfile {} { set durations [[:info parent] cget -durations] foreach duration ${durations} { set d [clock scan $duration -timezone :UTC -base 0] set multiple($duration) [expr {$d / ${:baseResolution}}] if {$multiple($duration) * ${:baseResolution} != $d} { error "duration '$duration' is not a multiple of the base resolution ${:baseResolution} secs" } } set RRA {} foreach {res duration} ${durations} { set m [expr {$multiple($duration)/$multiple($res)}] if {$m * $multiple($res) != $multiple($duration)} { error "duration '$duration' is not a multiple of the resolution $res" } #ns_log notice "$multiple($res) [expr {$multiple($duration)/$multiple($res)}]" lappend RRA "RRA:AVERAGE:0.5:$multiple($res):$m" "RRA:MIN:0.5:$multiple($res):$m" "RRA:MAX:0.5:$multiple($res):$m" } ns_log notice "try to create: Rrd::create ${:rrdFile} --step ${:baseResolution} DS:42:DERIVE:10m:0:U {*}$RRA" Rrd::create ${:rrdFile} --step ${:baseResolution} "DS:42:${:type}:10m:0:U" {*}$RRA } :public method update {{-timestamp N} value} { ns_log notice "Rrd::update ${:rrdFile} ${timestamp}:$value" Rrd::update ${:rrdFile} ${timestamp}:$value } :public method lastupdate {} { return [Rrd::lastupdate ${:rrdFile}] } :public method requireRRD {} { if {![file exists ${:rrdFile}]} { :createRRDfile } } :public method deleteRRD {} { if {[file exists ${:rrdFile}]} { file delete ${:rrdFile} } } :method init {} { next if {![info exists :name]} { set :name [namespace tail [self]] } set :rrdFile [[:info parent] cget -rrdPath]_${:name}-d.rrd append ::log "rrdFile of [self] is ${:rrdFile}<br>\n" :requireRRD }XQL Not present: Generic, PostgreSQL, Oracle