The Metric data type contains information about a specific metric. If you call ListMetrics, Amazon CloudWatch returns information contained by this data type.

The example in the Examples section publishes two metrics named buffers and latency. Both metrics are in the examples namespace. Both metrics have two dimensions, InstanceID and InstanceType.

Ejemplo n.º 1
0
 // Check if a metric description contains a search string
 private bool text_in_metric(string text, Metric metric)
 {
     if (metric.MetricName.ToUpper().Contains(text) || metric.Namespace.ToUpper().Contains(text))
     {
         return true;
     }
     else
     {
         foreach (Dimension dim in metric.Dimensions)
         {
             if (dim.Name.ToUpper().Contains(text) || dim.Value.ToUpper().Contains(text))
             {
                 return true;
             }
         }
         return false;
     }
 }
Ejemplo n.º 2
0
 private string getSeriesName(Metric metric, int statID, double sf)
 {
     string name = String.Format("{0} {1} {2}",
                                 metric.MetricName,
                                 metric.Namespace,
                                 statList[statID]);
     foreach (var dim in metric.Dimensions)
     {
         name += String.Format(" {0}={1}",
                                 dim.Name,
                                 dim.Value);
     }
     name += String.Format(" ({0}:1)", sf.ToString("#,##0"));
     return name;
 }