From e29ef8f6afa51079cc4810439b0cd110198a36cd Mon Sep 17 00:00:00 2001 From: Chris Reeves Date: Thu, 13 Jun 2024 15:36:03 -0600 Subject: [PATCH] Use the old fetch call if daemon is not specified --- rrd_c.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rrd_c.go b/rrd_c.go index bd50268..f4bdaf3 100644 --- a/rrd_c.go +++ b/rrd_c.go @@ -462,7 +462,12 @@ func Fetch(filename, cf string, start, end time.Time, step time.Duration, daemon cDsNames **C.char cData *C.double ) - err := makeError(C.rrdDaemonFetch(&ret, cDaemon, fn, cCf, &cStart, &cEnd, &cStep, &cDsCnt, &cDsNames, &cData)) + var err error + if daemon != nil { + err = makeError(C.rrdDaemonFetch(&ret, cDaemon, fn, cCf, &cStart, &cEnd, &cStep, &cDsCnt, &cDsNames, &cData)) + } else { + err = makeError(C.rrdFetch(&ret, fn, cCf, &cStart, &cEnd, &cStep, &cDsCnt, &cDsNames, &cData)) + } if err != nil { return FetchResult{filename, cf, start, end, step, nil, 0, nil}, err }