3

I have a public web app on which I can set up an availability test from Azure. I also have a private web app on which the availability test fails.

I want to track the availability of my internal web app. In C#, I have found until now:

TelemetryConfiguration.Active.InstrumentationKey = "application insights key";
var telemetryClient = new TelemetryClient();
var avail = new Microsoft.ApplicationInsights.DataContracts.AvailabilityTelemetry();
telemetryClient.TrackAvailability(avail);

However this code is unfinished. I'm not sure how I would specify my internal url and where I would see the results.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
Iason
  • 209
  • 3
  • 11
  • 38
  • For monitor an internal url, you should read this [Can I monitor an intranet web server](https://learn.microsoft.com/en-us/azure/azure-monitor/app/troubleshoot-faq#can-i-monitor-an-intranet-web-server) first. – Ivan Glasenberg Mar 22 '19 at 05:54
  • @IvanYang Just to be sure, does that article also include a web app that is on Azure but has a private url (on which the basic availability test fails)? – Iason Mar 22 '19 at 08:15
  • As far as I know, there is no. But you can raise an issue for that in that article -> Feedback section. – Ivan Glasenberg Mar 22 '19 at 08:21
  • @IvanYang Then I'm sorry I wasn't clear, my private web app is in Azure, and that's where I want to do an availability test. – Iason Mar 22 '19 at 08:22
  • can you just use the code your have in the private web app, then check the telemetry in portal? – Ivan Glasenberg Mar 22 '19 at 08:37
  • @IvanYang Yes, it worked after around 5 minutes. – Iason Mar 22 '19 at 09:10

1 Answers1

3

For the internal web, first of all, you should make sure "allow traffic to our services by either firewall exceptions or proxy redirects.", detail is here.

Then just a simple line of code, just define some specific properties or name for your internal url in AvailabilityTelemetry.

            var client = new TelemetryClient();
            TelemetryConfiguration.Active.InstrumentationKey = "xxxxx";
            AvailabilityTelemetry a = new AvailabilityTelemetry();
            a.Name = "this is your_web_site_name or other unique value";

            //or some properties like below
            //a.Properties.Add("p1", "my internal web");

            client.TrackAvailability(a);

Then after execution, you can check if the availability telemetry is in azure portal -> your application insights service:

enter image description here

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60
  • Sorry, unfortunately it doesn't work after all with putting the website url for a.Name. a.Name is just the name of the test...If I put a.Name = "Test" it will show up "Test" in application insights after 5 minutes. Should have seen it earlier. – Iason Mar 29 '19 at 15:36
  • There are always some delay for messages being shown in application insights. The telemetry data will be batched first, then sent to application insights. – Ivan Glasenberg Apr 01 '19 at 09:20
  • No but I mean that it doesn't actually monitor the website url, it will just show up in the portal whatever value you give for a.Name in your code. If you give a.Name = "dgaagd" then it will show 100% availability on "dgaagd", to give an example. – Iason Apr 02 '19 at 06:57
  • Another issue that I found here is if the function app is down/stopped, this 'availability test' will not work. – Major Sep 14 '20 at 20:00