How can we extract data from grafana dashboard? - python-3.x

Need to extract specific data from grafana dashboard. Grafana is connected to graphite in the backend. Seems there is no API to make calls to grafana directly.
Any help?
Ex: I need to extract AVG CPU value from graph of so and so server.

The only way I found in grafana 7.1 was to:
Open the dashboard and then inspect the panel
Open the query tab and click on refresh
Use the url and parameters on your own query to the api
note: First you need to create an API key in the UI with the proper role and add the bearer to the request headers

Related

How to pull Azure Cognitive Search Quota and usage?

I am trying to pull azure cognitive search current and quota .
Can anyone help me on:
" how can I get that information to csv using some service principle."
I found one link to pull this kind of data :
https://learn.microsoft.com/en-us/rest/api/searchservice/get-service-statistics
But I am not sure how to use this api to get above screenshot information.
The link you posted is the correct way to do it, it returns all the information you need.
It looks like this endpoint does not support OAuth2 & RBAC. So instead of using service principal, you need to provide the admin api-key in the request header.
You can check here how to access the api-key. If you'll be doing that from a powershell script, you can authenticate with your service principal and fetch the key using Get-AzSearchAdminKeyPair, then use this key to make a http request to get the statistics and finally convert them to CSV format.

Create auto policy in policy center via webservice

Guidewire Policy Center 10.2 self managed. I'd like to create and quote submission for auto policy line.
Is there a rest api for submission creation exposed via the policy center? Based on the documentation I've an impression it should be there but swagger ui doesn't show related api
I found only soap based web service. Now coming to submission api I see it's very generic, it looks policyPeriodData should be a raw xml that contains all the data about drivers, vehicles etc. How can I get such template in an easy way?
Edit:
Using gosu scratchpad I was able to generate sample xml for policy period
var pp = new gw.webservice.pc.pc1000.gxmodel.policyperiodmodel.PolicyPeriod(pd) print(pp.asUTFString())
it contains drivers data but I don't see any api how to pass vehicles data

Querying multiple application insights resources with REST API

I'm trying to query two different application insight instances (instance A and B) trough the REST API. I'm using postman to send a GET http request to the API and followed the answer in this post, which was aiming towards the same goal, join request data from different applications insights: https://stackoverflow.com/a/52248597/17161618
Just as it says in the above mentioned post I'm acessing the instance A and passed the authentication through the request header in the format keyA:appIdA,KeyB:appIdB.
I'm sending the following query:" union app("AppIdA").traces,app("AppIdB").traces " and receive the following error: enter image description here
Does anyone know how can I get access to read logs in resource B ?
I don't think you can run cross-component queries using API keys. You should use AAD (Azure Active Directory) auth. Give AAD app access to both resources. Then you should be able to run such queries.

How to Dynamically adding HTTP endpoint to load data into azure data lake by using Azure Data Factory and the REST api is cookie autheticated

I am trying to dynamically add/update linked service REST based on certain trigger/events to consume a RESP API to be authenticated using cookie which provides telemetry data. This telemetry data will be stored in Data Lake Gen2 and then will use Data Bricks to move to secondary data storage/SQL Server.
Have someone tried this? I am not able to find the cookie based Auth option while adding the linked service REST.
Also how to create data pipes dynamically or to have the parameters of the rest api to be dynamic ?
Currently, unfortunately this is not possible using Azure data factory native components/activities. For now at least, you cannot get access to the response cookies from a web request in data factory. Someone has put a feature request for this or something that might help, see here
It might be possible to do this via an Azure function to get/save the cookie and then send it as part of a following request. I had a similar problem but resorted to using Azure functions for all of it, but I guess you could just do the authentication part with a function! ;-)
EDIT: update
Actually, after I wrote this I went back to check if this was still the case and looks like things have changed. There now appears (never seen this before) in the web response output, a property called "ADFWebActivityResponseHeaders" and as you can see there is property for the "Set-Cookie"
See example below:-

Power BI Data Source with Refresh ability

I am trying to setup a data set in Power BI which can be refreshed on a need basis or scheduled to refresh.
I am uploading an excel workbook which has a power query.
the power query is connecting to Replicon Service to get data via service. the query looks as below:
Source = Web.Contents(
"https://na2.replicon.com/services/ClientService1.svc/GetActiveClients",
[
Headers=
[
#"Authorization"="Bearer *ValidToken*",
#"Accept"="application/json",
#"Content-Type"="application/json"
],
Content=Text.ToBinary("{}")
]
)
the request is a POST operation and hence Content field is used in Web.Contents Options argument. Authentication is via Bearer token.
Data source setting is Anonymous Credentials with privacy Level set to None.
This works fine and I am able to retrieve the results and even refresh form within workbook.
Once I upload this to PowerBI and attempt to refresh the newly created Dataset it says:
You cannot refresh yet because you need to provide valid credentials for your data sources in the dataset.
So I go to Manage Data sources. Click Edit Credentials. Select "Anonymous" Authentication method and click on Sign In and it says "Login Failed".
Why is that so? It appears that the Headers are lost when I upload the Excel workbook. How can I accomplish this? Is there any alternate ways of being able to set up a Data Set which can be refreshed - the source being a web service?
this is what i ended up doing finally.
my scenario first:
my requests are POST
Authentication is via bearer token which needed to be passed via Request Header. this was the requirement of the replicon service i am trying to invoke which i couldn't change
the dataset that is created in PowerBI needed to be refreshable.
Since i couldn't get it to work directly from inside PowerBI i introduced an intermediate layer. this would interpret GET requests from PowerBI. process the token from query string. accept the service and operation also as query string parameters. it would then create POST request to the Real Service (replicon services in my case). the service name and operation names were also picked up from request URL. the token was pushed as part of request header
so the request from PowerBI would look as PowerBI needed i.e.
Web.Contents("https://intermediatelayer.com?access_token="*validtoken*"&ServiceName="ClientService"&Operation="GetActiveClients"")
not an ideal solution but works.
Manage Data Sources is validating the Anonymous credentials with a GET request to the URL without the hardcoded headers, like you suggest. It's basically running
Web.Contents("https://na2.replicon.com/services/ClientService1.svc/GetActiveClients")
which fails with "(405): Method Not Allowed", and so Manage Data Sources thinks the credentials are wrong.
Short of making the service reply with a success response for the above M, I don't see any way to set up refresh on this mashup.

Resources