问题描述

在昨天的文章中,介绍了 “【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发送测试数据的更多相关文章

  1. 【应用程序见解 Application Insights】使用Azure Monitor Application Insights Agent获取Azure VM中监控数据及IIS请求指标等信息

    问题情形 为了使用Application Insights也可以监控Azure VM中的相关性能数据,如CPU, Memory,IIS Reuqest等信息,可以在VM中开始一个一个扩展插件: Azu ...

  2. 【应用程序见解 Application Insights】Application Insights 使用 Application Maps 构建请求链路视图

    Applicaotn  Insigths 使用 Application Maps 构建请求链路视图 构建系统时,请求的逻辑操作大多数情况下都需要在不同的服务,或接口中完成整个请求链路.一个请求可以经历 ...

  3. Azure Monitor(一)Application Insights

    一,引言 Azure Monitor 是 Azure 中的一项完整堆栈监视服务,是一种收集和分析遥测数据的服务.它提供了一组完整的功能来监视 Azure 资源以及其他云中和本地的资源.Azure Mo ...

  4. 【Azure 应用程序见解】Application Insights Java Agent 3.1.0的使用实验,通过修改单个URL的采样率来减少请求及依赖项的数据采集

    问题描述 近日好消息,如果是一个Java Spring Cloud的项目,想使用Azure Applicaiton Insights来收集日志及一些应用程序见解.但是有不愿意集成SDK来修改代码或者配 ...

  5. 使用Application Insights 做分析

    Application Insights on Windows Desktop apps, services and worker roles : https://azure.microsoft.co ...

  6. 关于Application Insights遥测功能使用【遇到问题】

    简介:Application Insights是微软发布的一个在线服务,可以监测自己的网站应用,进行性能管理以及使用分析. Application Insights功能一开始是出现在Visualstu ...

  7. [整理]Visual Studio 的Application Insights

    简单介绍 Application Insights(预览版) Visual Studio 的Application Insights插件简介 Application Insights for Visu ...

  8. (编译)使用 AppCenter 持续输出导出到 Application Insights

    原文地址:https://blog.xamarin.com/appcenter-continuous-export-application-insights/ 五星手机应用有一个特殊的特点:他们不会放 ...

  9. Azure Application Insights REST API使用教程

    本文是Azure Application Insights REST API的简单介绍,并会包含一个通过Python消费API的示例/小工具. 新加入的team中的一项工作是制作日常的运维报表,制作方 ...

  10. 【应用程序见解 Application Insights】在Application Insights中通过自定义查询结果定义指标并显示在Dashboard中

    问题情形 通过Application Insights收集到指标数据后,如Request,Trace,Exception.但是默认的Insights图表不能满足业务的需求,需要自定义相应的类SQL语句 ...

随机推荐

  1. JavaScript一种新的数据结构类型Map

    什么是map 它类似于对象,是键值对的集合,但键的范围不局限在于字符串.各种类型的值(包含对象)都可以作为键. 如果同一个键被多次赋值,后面的值将会覆盖其那面的值.如果读取一个未知的键,返回的是und ...

  2. 错误的daemon.json配置,导致docker容器启动失败 Failed to start Docker Application Container Engine

    docker学习-配置错误的源 问题点剖析 参考 docker学习-配置错误的源 问题点剖析 使用docker安装了nginx,编写Dockerfile,映射端口,终于跑起来了.但是,当我重启服务器, ...

  3. 【一】飞桨paddle【GPU、CPU】安装以及环境配置+python入门教学

    相关文章: [一]飞桨paddle[GPU.CPU]安装以及环境配置+python入门教学 [二]-Parl基础命令 [三]-Notebook.&pdb.ipdb 调试 [四]-强化学习入门简 ...

  4. 程序员必备技能:一键创建windows 服务

    使用windows开发或者使用windows服务器的朋,应该经常会遇到有些程序要开机启动,或者有些服务要持续执行. 这样最稳定可靠的,就是把程序创建为windows服务. 以下bat脚本,仅供参考. ...

  5. 如何进行IIS性能优化,提高应用并发能力

    2021-03-05 先附上IIS的官方文档,如果你的英文阅读能力不错的话,直接阅读官方文档,更加清楚明白: https://docs.microsoft.com/zh-cn/iis/get-star ...

  6. USACO 2022 Cu 题解

    USACO 2022 Cu 题解 AK用时:$ 3 $ 小时 $ 30 $ 分钟. A - Cow College 原题 Farmer John 计划为奶牛们新开办一所大学! 有 $ N $($ 1 ...

  7. VMware 虚拟机一键去虚拟化工具

    前言: 如果你想在 VMware 虚拟机里面多开玩游戏的话,但是现在大多数网游都会检测是否虚拟机,进入游戏被检测到在虚拟机中运行,游戏可能直接闪退.所以就得对 VMware 虚拟机进行去除虚拟化. 原 ...

  8. Java并发编程-CompletableFuture(下)

    大家好,我是小高先生,书接上文,我们继续来学习CompletableFuture.上文我们讲了基础装Future是如何升级为神装CompletableFuture以及如何购买CompletableFu ...

  9. 提高Java开发生产力,我选Stream API,真香啊

    Java 8 引入的Stream API提供了一种新的数据处理方式,它以声明式.函数式的编程模型,极大地简化了对集合.数组或其他支持数据源的操作.Stream可以被看作是一系列元素的流水线.允许你高效 ...

  10. NC19158 失衡天平

    题目链接 题目 题目描述 终于Alice走出了大魔王的陷阱,可是现在傻傻的她忘了带武器了,这可如何是好???这个时候,一个神秘老人走到她面前答应无偿给她武器,但老人有个条件,需要将所选武器分别放在天平 ...