Skip to content

Instantly share code, notes, and snippets.

@jasonhancock
Last active December 14, 2017 14:45
Show Gist options
  • Save jasonhancock/3d29dce6fe1e67dacca3c6dfb10a773b to your computer and use it in GitHub Desktop.
Save jasonhancock/3d29dce6fe1e67dacca3c6dfb10a773b to your computer and use it in GitHub Desktop.
jenkins to statsd

A cheap way to get build events from jenkins into graphite via statsd:

/usr/local/bin/buildstats

#!/bin/bash
. /etc/default/buildstats
echo "$BUILD_PREFIX.$JOB_NAME:1|c" | nc -w 1 -u $STATSD_SERVER $STATSD_PORT

/etc/default/buildstats:

#!/bin/bash

ROOT_PREFIX='jenkins'
BUILD_PREFIX="$ROOT_PREFIX.builds"

STATSD_SERVER=metrics.example.com
STATSD_PORT=8125

Then just add this command to your job:

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