Git Product home page Git Product logo

go-rrdcached's Introduction

Go (golang) Bindings for rrdcached

This package implements Go (golang) bindings for the rrdcached daemon.

Install

go get github.com/dreadpirateshawn/rrdcached

Requirements

rrdcached was developed against RRDCacheD 1.5.0-rc2 and expects CREATE support. Technically the pre-1.5 methods work with older libraries -- UPDATE, FLUSH, etc -- but the test suite leverages CREATE, so it's easiest to use out-of-the-box with the newer library.

RRDTool / RRDCacheD can be found here: https://github.com/oetiker/rrdtool-1.x

Basic RRDCacheD test

Unit tests

go test -v ./...

The go-rrdcached test suite starts and stops rrdcached daemon instances of its own, so you don't need to leave rrdcached running during development.

Integration tests

rrdcached -p /tmp/go-rrdached-test.pid -B -b /tmp -l /tmp/go-rrdcached-test.sock -l 0.0.0.0:50081
go test -v ./... -tags=integration

Manual validation

Verify socket connection using nc:

$ echo "STATS" | sudo nc -U /tmp/go-rrdcached-test.sock
9 Statistics follow
QueueLength: 0
UpdatesReceived: 0
... etc ...

Verify TCP connection using telnet:

$ telnet 0.0.0.0 50081
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'.
STATS
9 Statistics follow
QueueLength: 0
UpdatesReceived: 0
... etc ...
^]
telnet> quit
Connection closed.

Btw: Telnet doesn't work for unix:socket.

Troubleshooting

If you encounter permission problems accessing the socket from your Go program, here's what I've done to work around this. (TODO: Shouldn't this library be usable without doing this?)

  • Change the default socket location. Add OPTS="-l unix:/socks/rrdcached.sock" to /etc/default/rrdcached
  • Start the rrdcached daemon. sudo /etc/init.d/rrdcached start
  • Ensure permissions. sudo chmod -R 777 /socks/
  • View syslogs. tail /var/log/syslog

Open Questions

  • RRD requires timestamp to increase by at least one second for each update value... does this library do enough to bubble up this error when it happens?

  • What if filenames with spaces are used?

  • What if Update is called with empty values? no-op or panic?

  • Tests cover one RRD with multiple dimensions, should they also cover multiple RRDs with one dimension each? https://kb.op5.com/display/HOWTOs/Use+RRD+in+MULTIPLE+mode+for+separate+check+commands

go-rrdcached's People

Contributors

dreadpirateshawn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.