peschuster

Technology, .NET and Web

  • Info

Monitoring

Reporting Exceptions from ELMAH to Graphite and StatsD

October 25, 2012 by peter

On one project we use Graphite and StatsD to monitor some webserver and performance parameters of the site and ELMAH to catch all unhandled exceptions. Wouldn’t it be cool to also see the occurrence of exceptions captured by ELMAH in our Graphite graphs?

For this purpose I extended my library of Graphite “tools” by a Graphite.Elmah project.

ELMAH is designed to support only on backend for logging errors. This is usually configured to be some kind of database backend to store exception details for later access. Therefore Graphite.Elmah hooks into ELMAH using a custom error filter, to report exceptions to Graphite or StatsD.

You can configure ELMAH in your project to use this error filter with the following configuration snipped:

<errorFilter>
  <test
      xmlns:my="http://schemas.microsoft.com/clr/nsassem/Graphite/Graphite.Elmah">
    <my:log />
  </test>
</errorFilter>

Graphite.Elmah itself needs to be configured with the following settings:

<graphite.elmah
    key="elmah_errors"
    type="counter"
    target="statsd" />

You can set a metric key, a metric type and a target for the metrics (either “statsd” or “graphite”). The complete configuration for your web.config file is also included in the respective readme for reference: Graphite.Elmah web.config

Graphite.Elmah was build upon the Graphite base library. Therefore some configuration for the Graphite backend(s) is required as well:

<configSections>
  <section name="graphite" type="Graphite.Configuration.GraphiteConfiguration, Graphite" />
</configSections>
<graphite xmlns="http://github.com/peschuster/Graphite/Configuration">
  <!--<graphite address="127.0.0.1" port="2003" transport="Tcp" />-->
  <statsd address="127.0.0.1" port="8125" prefixKey="test" />
</graphite>

When using the NuGet package Graphite.Elmah all required settings are added to your project automatically during installation:

Install-Package Graphite.Elmah
Posted in: .NET, ASP.NET, Monitoring Tagged: ELMAH, Graphite, StatsD

Sending stats to Graphite from within SQL Server

July 9, 2012 by peter

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.

Posted in: .NET, Monitoring Tagged: Graphite, sql server

Syndication

  • RSS 2.0

Recent Posts

  • Ubiquiti EdgeRouter™ X SFP – Teardown
  • Force HttpWebRequest to IPv4
  • Blackmagic Design ATEM GPI and Tally Interface Teardown
  • WinForms ListView DoubleClick Event for Empty Lists
  • Planning Center Online – Custom Plan Reports in Landscape Orientation

Tags

.NET AntiXssEncoder ASP.NET Build c# Configuration crawler Debugging EF ELMAH Expression tree Graphite Interop IssuerNameRegistry iTunes Linq ListView MVC pco pdf Security SecurityKey SecurityToken simulatebe sql server StatsD STS teardown TYPO3 UAC UI UserSettings Visual Studio WIF WIF in depth WinForms WndProc
profile for Peter at Stack Overflow, Q&A for professional and enthusiast programmers Peter Schuster

Copyright © 2023 peschuster.

Alpha WordPress Theme by themehall.com