Azure - monitoring resources using REST APIs - azure

I am new to Azure and have been going through various tutorials.
I am looking specifically at Azure Monitoring using REST APIs.
What I am trying to do is get the status of various resources like Virtual Networks, AD, Load Balancers etc on a custom dashboard using REST APIs.
I have found some list of REST APIs that allow monitoring here(https://learn.microsoft.com/en-us/rest/api/monitor/)
But do they provide Resource health and Status.Also, do i have a create a new Service API Managament Resource(which is a paid resource) in the Azure Account for these APIs to run?.
Please let me know if you have any insights or reference materials on this

I don't think rest API is good for monitoring. I will suggest use Azure Monitor service under that you can use Azure resource metrics, Activity logs and service health. based on these metrics and logs you can set alert and show live data on the dashboard.
We are using Microsoft OMS for live monitoring (visualization of data) and Email/SMS for notification.
List item
Audit and receive notifications about important actions in your Azure subscription

Related

Is there a way for me to offload an App Service Plan to Log Analytics?

I wan to see logs of the nodes of my app service plan in Log Analytics. I DONT want to do it with app service. I need to query data of my nodes with KQL
Unfortunately, it's impossible as of now. Please vote up for this user voice: Request to manage diagnostic settings for App Service Plan from Azure portal.
I also tried from both azure portal and rest api:
From azure portal, there is no the option of Diagnostic settings for app service plan.
From api Diagnostic Settings - Create Or Update: It throws an error says that app service plan is not in the whitelist which means that it's not supported currently.
Hope Microsoft can implement this feature for service plan asap:).

is there a way to differentiate Azure activity logs generated by "Microsoft" services versus users and roles in Azure Cloud?

If I look at the Azure activity logs in Azure Portal some of the logs are initiated by Microsoft internal services like "Microsoft Azure Policy Insights". In my application we are getting the Azure activity logs using the Rest API for Activity logs. Is there a way to filter out internally generated logs (initiated by Microsoft Services) from the ones generated by actual users or applications configured in the account? I thought of using caller as a way to differentiate. For users caller has an email address assigned. But the problem with this approach is this approach will filter out any logs for applications as well. Let me if there is any other way to achieve this.
Unfortunately I don't believe there is a way to achieve this scenario.

How to get the usage metrics data for the Web Application Service?

I am trying to execute the REST API to get the usage metrics data from Web Application deployed on Azure.
Hi,
I am trying to execute the REST API to get the usage metrics data from Web Application deployed on Azure.
https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Web/sites//metrics?$filter=startTime%20eq%202016-04-12T06:05:42.907Z%20and%20endTime%20eq%202016-04-12T06:10:42.907Z&api-version=2014-04-01
But I am getting constantly 500 Internal Server Error.
Also, I tried to find out the given URL in Resource Explorer under the Mincrosoft.Web But in that I can see the metricsDefinitions but metrics is not available for this.
Can someone please let me know what how can I get the usage metrics data for the Web Application Services?
You can retrieve resource metrics via the Azure Insights API.By using the Azure Insights API it is possible to programmatically retrieve the available default metric definitions (the type of metric such as CPU Time, Requests, etc.), granularity, and metric values.
https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}/metrics?api-version=2014-04-01&$filter={filter}
It seems the REST API URI you are using is right, but before that the first step is to authenticate the Azure Insights API request. The easiest way to set up authentication is by creating an Azure AD service principal and retrieve the authentication token.
A very detailed walkthrough at https://blogs.msdn.microsoft.com/cloud_solution_architect/2016/02/23/retrieving-resource-metrics-via-the-azure-insights-api/.

Azure App Service API

Looking in the Azure portal, I can see monitoring charts for API apps and Web apps that return information on metrics such as number of requests, cpu time, data i/o, etc.
Is there an API that I can query that will return information on Azure app services?
If you just want to see the list of web apps within a resource group, this can simply be achieved using the Azure Resource Manager API, which is the default API used by the new portal.
We now even have a cool tool to explore these APIs, check https://azure.microsoft.com/en-in/blog/azure-resource-explorer-a-new-tool-to-discover-the-azure-api/
The API Reference itself is at https://msdn.microsoft.com/en-in/library/azure/dn790568.aspx
I think what you search is named : "Azure Monitoring Services API".
You can get/set metrics.
You can access to the API by a Nuget package :
PM> Install-Package Microsoft.WindowsAzure.Management.Monitoring
Yes, you can.
Please refer to Azure Insights REST API Reference.

Azure application status page

I have an application running on the Azure cloud.
Currently this is deployed as an Azure web app.
Is there any way to monitor the website status and build a page like this or this?
As you can see in those examples both have:
a service global status
An historical status which is grouped in hour/day/months period
Does azure has an API that I can use to monitor my services?
Application Insights and the Azure portal will give you a rich monitoring and diagnostics experience for your web app. It is in preview at this time.
You can get very granular data points or high-level graphs and trends. The historical data can go back as far as 13 months for aggregated data points. You can read more about the data retention policy here.
The Azure portal (the new one at portal.azure.com) gives you a rich UI to interact with the telemetry data from your app. And if you want to customize a blade to view specific data for your app you can do that too.
Azure Web Apps also has built-in monitoring support that you can use. It won't give you the depth that Application Insights does but you should look at this too to see if it will give you the data you need. And of course, you can customize the monitoring blades in the Azure portal to suit your needs.
Azure does offer a robust RESTFul API for managing and monitoring your services. Essentially anything you can do through the Azure Management Portal is accessible via an API, including analytics. The portal itself often uses this same API.
https://msdn.microsoft.com/en-us/library/azure/ee460799.aspx
You can also use MSFT authored .NET assemblies to create your own monitoring applications in Visual Studio. I find the monitoring and analytics features more robust via this model. These are available on GitHub:
http://azure.microsoft.com/en-us/updates/management-libraries-for-net-release-announcement/

Resources