This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Viewing and Publishing Metrics

Viewing and Publishing Metrics

This section describes how to view Eucalyptus metrics as well as how to publish your own metrics.

1 - List Available Metrics

You can list available metrics via Euca2ools.To list available metrics:

Enter the following command.

euwatch-list-metrics

Eucalyptus returns a listing of all metrics, as shown in the following partial example output:

Metric Name         Namespace  Dimensions
CPUUtilization      AWS/EC2    {InstanceId=i-5431413d}
CPUUtilization      AWS/EC2    {InstanceType=m1.medium}
DiskReadBytes       AWS/EC2    {InstanceId=i-1d3d4d74}
DiskReadBytes       AWS/EC2    {InstanceType=m1.medium}
DiskReadOps         AWS/EC2    {InstanceId=i-d3c8baba}
DiskReadOps         AWS/EC2    {InstanceType=m1.medium}
DiskWriteBytes      AWS/EC2    {InstanceId=i-6732420e}	
DiskWriteBytes      AWS/EC2    {InstanceType=m1.medium}
DiskWriteOps        AWS/EC2    {InstanceId=i-e03d4d89}
DiskWriteOps        AWS/EC2    {InstanceType=m1.medium}
NetworkIn           AWS/EC2    {InstanceId=i-e0304089}
NetworkIn           AWS/EC2    {InstanceType=m1.medium}
NetworkOut          AWS/EC2    {InstanceId=i-69334300}
NetworkOut          AWS/EC2    {InstanceType=m1.medium}
StatusCheckFailed		 AWS/EC2 {InstanceId=i-6f8418e6}
StatusCheckFailed      	  AWS/EC2 {InstanceType=m1.medium}
StatusCheckFailed_Instance      AWS/EC2 {InstanceId=i-6f8418e6}
StatusCheckFailed_Instance      AWS/EC2 {InstanceType=m1.medium}
StatusCheckFailed_System        AWS/EC2 {InstanceId=i-6f8418e6}
StatusCheckFailed_System        AWS/EC2 {InstanceType=m1.medium}

2 - Get Statistics for a Metric

You can get statistics for metrics via Euca2ools.To get statistics for a metric:

Enter the following command.

 euwatch-get-stats -n NAMESPACE -s STAT1,STAT2,...
            			[--dimensions KEY1=VALUE1,KEY2=VALUE2,...]
            			[--start-time YYYY-MM-DDThh:mm:ssZ]
            			[--end-time YYYY-MM-DDThh:mm:ssZ] [--period SECONDS]
            			[--unit UNIT] [--show-empty-fields] [-U URL]
            			[--region USER@REGION] [-I KEY_ID] [-S KEY]
            			[--security-token TOKEN] [--debug] [--debugger]
            			[--version] [-h]
            			METRIC

The following example returns the average CPU utilization for the i-c08804a9 instance at one hour resolution.

euwatch-get-stats --namespace "AWS/EC2" --statistics "Average" \
--dimensions "InstanceId=i-c08804a9" --start-time 2016-12-14T23:00:00.000Z \
--end-time 2016-12-15T23:00:00.000Z --period 3600  CPUUtilization

The following example returns CPU utilization for all of your cloud’s instances.

euwatch-get-stats --namespace "AWS/EC2" --statistics "Average,Minimum,Maximum" \
--start-time 2016-02-14T23:00:00.000Z --end-time 2016-03-14T23:00:00.000Z \
--period 3600 CPUUtilization

3 - Publish Custom Metrics

CloudWatch allows you to publish your own metrics, such as application performance, system health, or customer usage.

Publish a single data point

To publish a single data point for a new or existing metric, call euwatch-put-data with one value and time stamp. For example, the following actions each publish one data point:

euwatch-put-data --metric-name PageViewCount --namespace "TestService" --value 2 --timestamp 2011-03-14T12:00:00.000Z
euwatch-put-data --metric-name PageViewCount --namespace "TestService" --value 4 --timestamp 2011-03-14T12:00:01.000Z
euwatch-put-data --metric-name PageViewCount --namespace "TestService" --value 5 --timestamp 2011-03-14T12:00:02.000Z

You can publish data points with time stamps as granular as one-thousandth of a second. However, CloudWatch aggregates the data to a minimum granularity of 60 seconds. For example, the PageViewCount metric from the previous examples contains three data points with time stamps just seconds apart. CloudWatch aggregates the three data points because they all have time stamps within a 60-second period.

CloudWatch uses 60-second boundaries when aggregating data points. For example, CloudWatch aggregates the data points from the previous example because all three data points fall within the 60-second period that begins at 2011-03-14T12:00:00.000Z and ends at 2011-03-14T12:00:59.999Z.

Publish statistic sets

You can also aggregate your data before you publish to CloudWatch. When you have multiple data points per minute, aggregating data minimizes the number of calls to euwatch-put-data . For example, instead of calling euwatch-put-data multiple times for three data points that are within three seconds of each other, you can aggregate the data into a statistic set that you publish with one call:

euwatch-put-data --metric-name PageViewCount --namespace "TestService" -s "Sum=11,Minimum=2,Maximum=5,SampleCount=3" --timestamp 2011-03-14T12:00:00.000

Publish the value zero

When your data is more sporadic and you have periods that have no associated data, you can choose to publish the value zero (0) for that period or no value at all. You might want to publish zero instead of no value if you use periodic calls to PutMetricData to monitor the health of your application. For example, you can set an Amazon CloudWatch alarm to notify you if your application fails to publish metrics every five minutes. You want such an application to publish zeros for periods with no associated data.

You might also publish zeros if you want to track the total number of data points or if you want statistics such as minimum and average to include data points with the value 0.

4 - Modify Metric Polling Timing

You can modify metrics timing and reporting defaults.When using the default CloudWatch properties, metrics reporting can take around 15 minutes:

  1. 5 minutes to receive a sensor data point for an instance.
  2. 5 more minutes to receive a second sensor data point for an instance.
  3. 1 more minute to calculate the difference between these two and send a single data point to CloudWatch.
  4. 1 more minute for CloudWatch to put the data in the database, making it available for a call.
  5. 5 more minutes for info to be available in the database.

The sensor data point timing values can be shortened by changing variables in the CLC.

To modify metrics defaults:

Modify the default polling interval CLC variable to a number less than 5.

cloud.monitor.default_poll_interval_mins

This is how often the CLC sends a request to the CC for sensor data. Default value is 5 minutes. Modify the history size CLC variable to a number less than 5.

cloud.monitor.history_size

This is how many data value samples are sent in each sensor data request. The default value is 5. The frequency requests is either 1 minute (if the cloud.monitor.default_poll_interval_mins is 1 minute) or half the value of cloud.monitor.default_poll_interval_mins if that value is greater). So by default, with a cloud.monitor.default_poll_interval_mins of 5 minutes and cloud.monitor.history_size size of 5, every 5 minutes the CLC asks for the last 5 data points from the CC, which should be timed for every 2.5 minutes (e.g., 2.5 minutes ago, 5 minutes ago, 7.5 minutes ago, and 10 minutes ago).