Skip to content

Instantly share code, notes, and snippets.

@alq666
Created April 19, 2012 18:53
Show Gist options
  • Save alq666/2422980 to your computer and use it in GitHub Desktop.
Save alq666/2422980 to your computer and use it in GitHub Desktop.
Using rrdtool & datadog
rrdtool fetch localhost_load_1min_5.rrd AVERAGE --start -15min

             load_1min           load_5min          load_15min

1334860500: 6.0133333333e-02 1.3013333333e-01 1.2003333333e-01
1334860800: 1.0983333333e-01 1.0010000000e-01 9.0100000000e-02
1334861100: 7.0133333333e-02 1.0000000000e-01 9.0000000000e-02
1334861400: -nan -nan -nan

Extract time stamp & first column

> rrdtool fetch localhost_load_1min_5.rrd AVERAGE --start -15min | gawk '/^[0-9]+:/ && !/nan/ {print substr($1,1,  length($1)-1), $2}'
1334860500 6.0133333333e-02
1334860800 1.0983333333e-01
1334861100 7.0133333333e-02

The curl it following the JSON format in here or use one of our client libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment