Documentation
¶
Overview ¶
Simple wrapper for rrdtool C library
Index ¶
- func Info(filename string) (map[string]interface{}, error)
- type Creator
- type Error
- type Exporter
- func (e *Exporter) CDef(vname, rpn string)
- func (e *Exporter) Def(vname, rrdfile, dsname, cf string, options ...string)
- func (e *Exporter) SetDaemon(daemon string)
- func (e *Exporter) SetMaxRows(maxRows uint)
- func (e *Exporter) Xport(start, end time.Time, step time.Duration) (XportResult, error)
- func (e *Exporter) XportDef(vname, label string)
- type FetchResult
- type GraphInfo
- type Grapher
- func (g *Grapher) AddOptions(options ...string)
- func (g *Grapher) Area(value, color string, options ...string)
- func (g *Grapher) CDef(vname, rpn string)
- func (g *Grapher) Comment(s string)
- func (g *Grapher) Def(vname, rrdfile, dsname, cf string, options ...string)
- func (g *Grapher) GPrint(vname, format string)
- func (g *Grapher) GPrintT(vname, format string)
- func (g *Grapher) Graph(start, end time.Time) (GraphInfo, []byte, error)
- func (g *Grapher) HRule(value, color string, options ...string)
- func (g *Grapher) Line(width float32, value, color string, options ...string)
- func (g *Grapher) Print(vname, format string)
- func (g *Grapher) PrintT(vname, format string)
- func (g *Grapher) SaveGraph(filename string, start, end time.Time) (GraphInfo, error)
- func (g *Grapher) SetAltAutoscale()
- func (g *Grapher) SetAltAutoscaleMax()
- func (g *Grapher) SetAltAutoscaleMin()
- func (g *Grapher) SetBase(base uint)
- func (g *Grapher) SetBorder(width uint)
- func (g *Grapher) SetColor(colortag, color string)
- func (g *Grapher) SetDaemon(daemon string)
- func (g *Grapher) SetImageFormat(format string)
- func (g *Grapher) SetInterlaced()
- func (g *Grapher) SetLazy()
- func (g *Grapher) SetLogarithmic()
- func (g *Grapher) SetLowerLimit(limit float64)
- func (g *Grapher) SetNoGridFit()
- func (g *Grapher) SetNoLegend()
- func (g *Grapher) SetRightAxis(scale, shift float64)
- func (g *Grapher) SetRightAxisLabel(label string)
- func (g *Grapher) SetRigid()
- func (g *Grapher) SetSize(width, height uint)
- func (g *Grapher) SetSlopeMode()
- func (g *Grapher) SetTitle(title string)
- func (g *Grapher) SetUnitsExponent(e int)
- func (g *Grapher) SetUnitsLength(l uint)
- func (g *Grapher) SetUpperLimit(limit float64)
- func (g *Grapher) SetVLabel(vlabel string)
- func (g *Grapher) SetWatermark(watermark string)
- func (g *Grapher) Shift(vname string, offset interface{})
- func (g *Grapher) TextAlign(align string)
- func (g *Grapher) Tick(vname, color string, options ...string)
- func (g *Grapher) VDef(vname, rpn string)
- func (g *Grapher) VRule(t interface{}, color string, options ...string)
- type Updater
- type XportResult
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Creator ¶
type Creator struct {
// contains filtered or unexported fields
}
func NewCreator ¶
NewCreator returns new Creator object. You need to call Create to really create database file.
filename - name of database file start - don't accept any data timed before or at time specified step - base interval in seconds with which data will be fed into RRD
func (*Creator) Create ¶
Create creates new database file. If overwrite is true it overwrites database file if exists. If overwrite is false it returns error if file exists (you can use os.IsExist function to check this case).
func (*Creator) DS ¶
DS formats a DS argument and appends it to the list of arguments to be passed to rrdcreate(). Each element of args is formatted with fmt.Sprint(). Please see the rrdcreate(1) manual page for in-depth documentation.
Example ¶
c := &Creator{} // Add a normal data source, i.e. one of GAUGE, COUNTER, DERIVE and ABSOLUTE: c.DS("regular_ds", "DERIVE", 900, /* heartbeat */ 0, /* min */ "U" /* max */) // Add a computed c.DS("computed_ds", "COMPUTE", "regular_ds,8,*" /* RPN expression */)
Output:
func (*Creator) RRA ¶
RRA formats an RRA argument and appends it to the list of arguments to be passed to rrdcreate(). Each element of args is formatted with fmt.Sprint(). Please see the rrdcreate(1) manual page for in-depth documentation.
Example ¶
c := &Creator{} // Add a normal consolidation function, i.e. one of MIN, MAX, AVERAGE and LAST: c.RRA("AVERAGE", 0.3, /* xff */ 5, /* steps */ 1200 /* rows */) // Add aberrant behavior detection: c.RRA("HWPREDICT", 1200, /* rows */ 0.4, /* alpha */ 0.5, /* beta */ 288 /* seasonal period */)
Output:
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
func NewExporter ¶
func NewExporter() *Exporter
func (*Exporter) SetMaxRows ¶
type FetchResult ¶
type FetchResult struct { Filename string Cf string Start time.Time End time.Time Step time.Duration DsNames []string RowCnt int // contains filtered or unexported fields }
func (*FetchResult) FreeValues ¶
func (r *FetchResult) FreeValues()
FreeValues free values memory allocated by C.
func (*FetchResult) ValueAt ¶
func (r *FetchResult) ValueAt(dsIndex, rowIndex int) float64
func (*FetchResult) Values ¶
func (r *FetchResult) Values() []float64
Values returns copy of internal array of values.
type Grapher ¶
type Grapher struct {
// contains filtered or unexported fields
}
func NewGrapher ¶
func NewGrapher() *Grapher
func (*Grapher) AddOptions ¶
func (*Grapher) SetAltAutoscale ¶
func (g *Grapher) SetAltAutoscale()
func (*Grapher) SetAltAutoscaleMax ¶
func (g *Grapher) SetAltAutoscaleMax()
func (*Grapher) SetAltAutoscaleMin ¶
func (g *Grapher) SetAltAutoscaleMin()
func (*Grapher) SetImageFormat ¶
func (*Grapher) SetInterlaced ¶
func (g *Grapher) SetInterlaced()
func (*Grapher) SetLogarithmic ¶
func (g *Grapher) SetLogarithmic()
func (*Grapher) SetLowerLimit ¶
func (*Grapher) SetNoGridFit ¶
func (g *Grapher) SetNoGridFit()
func (*Grapher) SetNoLegend ¶
func (g *Grapher) SetNoLegend()
func (*Grapher) SetRightAxis ¶
func (*Grapher) SetRightAxisLabel ¶
func (*Grapher) SetSlopeMode ¶
func (g *Grapher) SetSlopeMode()
func (*Grapher) SetUnitsExponent ¶
func (*Grapher) SetUnitsLength ¶
func (*Grapher) SetUpperLimit ¶
func (*Grapher) SetWatermark ¶
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
func NewUpdater ¶
func (*Updater) Cache ¶
func (u *Updater) Cache(args ...interface{})
Cache chaches data for later save using Update(). Use it to avoid open/read/write/close for every update.
func (*Updater) SetTemplate ¶
type XportResult ¶
type XportResult struct { Start time.Time End time.Time Step time.Duration Legends []string RowCnt int // contains filtered or unexported fields }
func (*XportResult) FreeValues ¶
func (r *XportResult) FreeValues()
FreeValues free values memory allocated by C.
func (*XportResult) ValueAt ¶
func (r *XportResult) ValueAt(legendIndex, rowIndex int) float64