title: Azure Application Insights custom response metric
body: <p>I need some help to find a good pattern for a custom application insights metric.</p>
  
  <p><strong>Environment</strong></p>
  
  <p>I have a custom Windows Service running on multiple Azure VMs.
  I can successfull add Events to my Monitoring instance on Azure.</p>
  
  <p><strong>Goal</strong></p>
  
  <p>I want to create a custom metric that allows me to monitor if my windows services are running and responding per instance. It would be perfect if it acts like the respond timeout in website metric.
  Each service instance has a custom maschine related identifier, like:</p>
  
  <pre><code>TelemetryClient telemetry = new TelemetryClient();
  telemetry.Context.Device.Id = FingerPrint.Instance;
  </code></pre>
  
  <p>Now I wnat to create a alert if one of my Service instances (<code>Context.Device.Id</code>) is not running or responding.</p>
  
  <p><a href="https://i.stack.imgur.com/59FEu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/59FEu.png" alt="enter image description here"></a></p>
  
  <p><strong>Question</strong></p>
  
  <p>How to achive this?
  Is it even possible or usefull to Monitor multiple instance of one service type onside on application insight? Or must I open one single application insight per instance?
  Can anybody help me?</p>
  
  <p><em><strong>Response to Paul's answere</strong></em></p>
  
  <blockquote>
    <p>Track Metric Use TrackMetric to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.</p>
  </blockquote>
  
  <p>If I do so, whats happens if my server made a restart (update or somethink) and my service don't start up. Now the service did't send a <code>TrackMetric</code> to the application insight and no alert is raised because the value don't drop below 1, but the Service is still not running.</p>
  
  <p>Regards Steffen</p>