是否可以使用 C# (.net) 创建 Cloudwatch 自定义指标?

Cloud watch custom metrics creation with C# (.net) possible or not?

是否可以使用 AWS 提供的 .net SDK 创建 AWS CloudWatch 自定义指标。开发人员指南讨论了如何通过命令行工具发布自定义指标。 .net SDK 有可能吗?如果是,请提供相关链接或教程..

这是 .NET 的文档APIhttp://docs.aws.amazon.com/sdkfornet/latest/apidocs/Index.html

我在 aws 文档中找到了答案。

在这个 link: https://docs.aws.amazon.com/sdkfornet/latest/apidocs/Index.html 在主题下: Amazon.CloudWatch > AmazonCloudWatchClient > PutMetricData

下面是这个例子

var client = new AmazonCloudWatchClient();
 
var dimension = new Dimension
{
  Name = "Desktop Machine Metrics",
  Value = "Virtual Desktop Machine Usage"
};
 
var metric1 = new MetricDatum
{
  Dimensions = new List<Dimension>(),
  MetricName = "Desktop Machines Online",
  StatisticValues = new StatisticSet(),
  Timestamp = DateTime.Today,
  Unit = StandardUnit.Count,
  Value = 14
};
 
var metric2 = new MetricDatum
{
  Dimensions = new List<Dimension>(),
  MetricName = "Desktop Machines Offline",
  StatisticValues = new StatisticSet(),
  Timestamp = DateTime.Today,
  Unit = StandardUnit.Count,
  Value = 7
};
 
var metric3 = new MetricDatum
{
  Dimensions = new List<Dimension>(),
  MetricName = "Desktop Machines Online",
  StatisticValues = new StatisticSet(),
  Timestamp = DateTime.Today,
  Unit = StandardUnit.Count,
  Value = 12
};
 
var metric4 = new MetricDatum
{
  Dimensions = new List<Dimension>(),
  MetricName = "Desktop Machines Offline",
  StatisticValues = new StatisticSet(),
  Timestamp = DateTime.Today,
  Unit = StandardUnit.Count,
  Value = 9
};
 
var request = new PutMetricDataRequest
{
  MetricData = new List<MetricDatum>() { metric1, metric2, 
    metric3, metric4 },
  Namespace = "Example.com Custom Metrics"
};
 
client.PutMetricData(request);