Sending stats to Graphite from within SQL Server
I am playing with Graphite and StatsD with all the different possibilities to record and transmit metrics lately.
My recent addition to the “graphite-client” project is a TSQL CLR procedure for sending stats to Graphite directly from within SQL server: https://github.com/peschuster/graphite-client/tree/master/source/Graphite.TSql.
It is just a simple one-liner in SQL:
exec sp_graphitesend '192.168.0.1', 2003, 'stats.events.myserver.test', 1
Installation of the stored procedure is “described” here: https://github.com/peschuster/graphite-client/blob/master/source/Graphite.TSql/sp_graphitesend.sql
Only restriction is that it requires a “TRUSTWORTHY” database, clr code execution enabled and import of a custom DLL (Graphite.TSql.dll).
A typical scenario for sending stats directly from within SQL Server is e.g. logging of backup or maintenance tasks for being able to put it in correlation with other metrics like cache-hit-ratio or memory usage.