Skip to content

Instantly share code, notes, and snippets.

@kashyapp
Created January 8, 2013 13:21
Show Gist options
  • Save kashyapp/4483775 to your computer and use it in GitHub Desktop.
Save kashyapp/4483775 to your computer and use it in GitHub Desktop.
Scrape nsca.log and generate carbon formatted strings
#!/usr/bin/perl -w
use Sys::Hostname;
use Date::Parse;
# extract date string and time
# convert date string to epoch
# format string for carbon
# publish
m/\[(.*)\]:.*: (.*)s ;.*/;
$host = hostname;
$time = str2time($1);
print "sys.hostmetrics.$host.mysql.lag.per_min $2 $time\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment