【Application Insights】使用Powershell命令向Application Insgihts发送测试数据
问题描述
在昨天的文章中,介绍了 “【Application Insights】使用CURL命令向Application Insgihts发送测试数据”,今天则继续实验通过PowerShell命令来发送测试数据到Application Insights
问题解答
从参考文档中复制出 Powershell脚本,然后只需要修改 Application Insights的Connection String即可。
# Info: Provide either the connection string or ikey for your Application Insights resource
$ConnectionString = ""
$InstrumentationKey = ""
function ParseConnectionString {
param ([string]$ConnectionString)
$Map = @{}
foreach ($Part in $ConnectionString.Split(";")) {
$KeyValue = $Part.Split("=")
$Map.Add($KeyValue[0], $KeyValue[1])
}
return $Map
}
# If ikey is the only parameter supplied, we'll send telemetry to the global ingestion endpoint instead of regional endpoint found in connection strings
If (($InstrumentationKey) -and ("" -eq $ConnectionString)) {
$ConnectionString = "InstrumentationKey=$InstrumentationKey;IngestionEndpoint=https://dc.services.visualstudio.com/"
}
$map = ParseConnectionString($ConnectionString)
$url = $map["IngestionEndpoint"] + "v2/track"
$ikey = $map["InstrumentationKey"]
$lmUrl = $map["LiveEndpoint"]
$time = (Get-Date).ToUniversalTime().ToString("o")
$availabilityData = @"
{
"data": {
"baseData": {
"ver": 2,
"id": "SampleRunId",
"name": "Microsoft Support Sample Webtest Result",
"duration": "00.00:00:10",
"success": true,
"runLocation": "Region Name",
"message": "Sample Webtest Result",
"properties": {
"Sample Property": "Sample Value"
}
},
"baseType": "AvailabilityData"
},
"ver": 1,
"name": "Microsoft.ApplicationInsights.Metric",
"time": "$time",
"sampleRate": 100,
"iKey": "$ikey",
"flags": 0
}
"@
# Uncomment one or more of the following lines to test client TLS/SSL protocols other than the machine default option
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::SSL3
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS11
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS12
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS13
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri $url -Method POST -Body $availabilityData -UseBasicParsing
执行效果图:
参考资料
用于发送可用性测试结果的 PowerShell 脚本:https://learn.microsoft.com/zh-cn/troubleshoot/azure/azure-monitor/app-insights/investigate-missing-telemetry#powershell-script-send-availability-test-result
使用curl命令向Application Insights发送测试数据:https://www.cnblogs.com/lulight/p/17953251
【end】
【Application Insights】使用Powershell命令向Application Insgihts发送测试数据的更多相关文章
- 【应用程序见解 Application Insights】使用Azure Monitor Application Insights Agent获取Azure VM中监控数据及IIS请求指标等信息
问题情形 为了使用Application Insights也可以监控Azure VM中的相关性能数据,如CPU, Memory,IIS Reuqest等信息,可以在VM中开始一个一个扩展插件: Azu ...
- 【应用程序见解 Application Insights】Application Insights 使用 Application Maps 构建请求链路视图
Applicaotn Insigths 使用 Application Maps 构建请求链路视图 构建系统时,请求的逻辑操作大多数情况下都需要在不同的服务,或接口中完成整个请求链路.一个请求可以经历 ...
- Azure Monitor(一)Application Insights
一,引言 Azure Monitor 是 Azure 中的一项完整堆栈监视服务,是一种收集和分析遥测数据的服务.它提供了一组完整的功能来监视 Azure 资源以及其他云中和本地的资源.Azure Mo ...
- 【Azure 应用程序见解】Application Insights Java Agent 3.1.0的使用实验,通过修改单个URL的采样率来减少请求及依赖项的数据采集
问题描述 近日好消息,如果是一个Java Spring Cloud的项目,想使用Azure Applicaiton Insights来收集日志及一些应用程序见解.但是有不愿意集成SDK来修改代码或者配 ...
- 使用Application Insights 做分析
Application Insights on Windows Desktop apps, services and worker roles : https://azure.microsoft.co ...
- 关于Application Insights遥测功能使用【遇到问题】
简介:Application Insights是微软发布的一个在线服务,可以监测自己的网站应用,进行性能管理以及使用分析. Application Insights功能一开始是出现在Visualstu ...
- [整理]Visual Studio 的Application Insights
简单介绍 Application Insights(预览版) Visual Studio 的Application Insights插件简介 Application Insights for Visu ...
- (编译)使用 AppCenter 持续输出导出到 Application Insights
原文地址:https://blog.xamarin.com/appcenter-continuous-export-application-insights/ 五星手机应用有一个特殊的特点:他们不会放 ...
- Azure Application Insights REST API使用教程
本文是Azure Application Insights REST API的简单介绍,并会包含一个通过Python消费API的示例/小工具. 新加入的team中的一项工作是制作日常的运维报表,制作方 ...
- 【应用程序见解 Application Insights】在Application Insights中通过自定义查询结果定义指标并显示在Dashboard中
问题情形 通过Application Insights收集到指标数据后,如Request,Trace,Exception.但是默认的Insights图表不能满足业务的需求,需要自定义相应的类SQL语句 ...
随机推荐
- 【JS 逆向百例】某公共资源交易网,公告 URL 参数逆向分析
声明 本文章中所有内容仅供学习交流,抓包内容.敏感网址.数据接口均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关,若有侵权,请联系我立即删除! 逆向目标 目标:某地公共资 ...
- RabbitMQ集成系统文章02---webForm发布 ABP VNext订阅
一.webForm项目中发布 1.引用RabbitMQ.Client 2.在你想要发布的地方调用如下的方法 public void PublishRabbitMQ() { var data = new ...
- 临上线项目使用ILRuntime热更
前言 我们有一个用Unity引擎开发了二十个月的mmo arpg手游项目,在安卓已经测试三轮了,出于IOS的热的考虑且结合我们的情况:全部代码都是纯C#开发非Lua,所以计划使用ILRuntime热更 ...
- 设计模式学习-使用go实现迭代器模式
迭代器模式 定义 优点 缺点 适用范围 代码实现 参考 迭代器模式 定义 迭代器模式(Iterator Design Pattern),也叫作游标模式(Cursor Design Pattern). ...
- Flask 之SocketIO库实现绘图表
Flask 默认提供了针对WebSocket的支持插件from flask_socketio import SocketIO 直接通过pip命令安装即可导入使用,前端也需要引入socketIO库文件, ...
- C# 字符与字符串操作
在C#中,字符和字符串是两个重要的数据类型,有许多内置的方法可以处理字符和字符串.这些方法是非常有用的,可以帮助开发人员更方便.更高效地处理文本数据. 格式化字符串: using System; us ...
- Python 原生Socket实现端口扫描
端口扫描,就是逐个对一段端口或指定的端口进行扫描.通过扫描结果可以知道一台计算机上都提供了哪些服务,Python中使用Socket即可实现对特定端口的探测,以及对C段的扫描. 扫描目标主机Banner ...
- Java21 + SpringBoot3集成七牛云对象存储OSS,实现文件上传
目录 前言 实现步骤 引入maven依赖 修改配置文件 创建七牛云配置类 创建文件操作服务类 创建文件操作控制器 前端实现 运行效果 总结 前言 近日心血来潮想做一个开源项目,目标是做一款可以适配多端 ...
- Resharper 和 Rider 的奇淫技巧,你知道多少?
Resharper 和 Rider 的奇淫技巧,你知道多少? .NET 开发中最令人印象深刻的生产力工具之一是ReSharper.每次发布时,我都对它的功能感到震惊.不要误会我的意思,我喜欢 Visu ...
- Pandas处理股票数据
import tushare as ts import pandas as pd # 下载茅台所有股票交易数据 # df = ts.get_k_data(code="600519" ...