Skip to content

Commit

Permalink
Add base rrdcached support for graph' and xport'
Browse files Browse the repository at this point in the history
  • Loading branch information
vbatoufflet committed Apr 12, 2014
1 parent c829864 commit f3b7823
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rrd.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ type Grapher struct {
imageFormat string
interlaced bool

daemon string

args []string
}

Expand Down Expand Up @@ -286,6 +288,10 @@ func (g *Grapher) SetWatermark(watermark string) {
g.watermark = watermark
}

func (g *Grapher) SetDaemon(daemon string) {
g.daemon = daemon
}

func (g *Grapher) push(cmd string, options []string) {
if len(options) > 0 {
cmd += ":" + strings.Join(options, ":")
Expand Down Expand Up @@ -405,6 +411,8 @@ func (r *FetchResult) ValueAt(dsIndex, rowIndex int) float64 {
type Exporter struct {
maxRows uint

daemon string

args []string
}

Expand Down Expand Up @@ -442,6 +450,10 @@ func (e *Exporter) Xport(start, end time.Time, step time.Duration) (XportResult,
return e.xport(start, end, step)
}

func (e *Exporter) SetDaemon(daemon string) {
e.daemon = daemon
}

type XportResult struct {
Start time.Time
End time.Time
Expand Down
8 changes: 8 additions & 0 deletions rrd_c.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ var (
oRightAxis = C.CString("--right-axis")
oRightAxisLabel = C.CString("--right-axis-label")

oDaemon = C.CString("--daemon")

oNoLegend = C.CString("-g")

oLazy = C.CString("-z")
Expand Down Expand Up @@ -240,6 +242,9 @@ func (g *Grapher) makeArgs(filename string, start, end time.Time) []*C.char {
if g.watermark != "" {
args = append(args, oWatermark, C.CString(g.watermark))
}
if g.daemon != "" {
args = append(args, oDaemon, C.CString(g.daemon))
}
return append(args, makeArgs(g.args)...)
}

Expand All @@ -253,6 +258,9 @@ func (e *Exporter) makeArgs(start, end time.Time, step time.Duration) []*C.char
if e.maxRows != 0 {
args = append(args, oMaxRows, utoc(e.maxRows))
}
if e.daemon != "" {
args = append(args, oDaemon, C.CString(e.daemon))
}
return append(args, makeArgs(e.args)...)
}

Expand Down

0 comments on commit f3b7823

Please sign in to comment.