Chapter 3. Managing alarms
You can use the Telemetry Alarming service (aodh) to trigger actions based on defined rules against metric or event data collected by Ceilometer or Gnocchi.
Alarms can be in one of the following states:
- ok
- The metric or event is in an acceptable state.
- firing
- The metric or event is outside of the defined ok state.
- insufficient data
- The alarm state is unknown. This can be for several reasons, for example, there is no data for the requested granularity, the check has not been executed yet, and so on.
3.1. Viewing existing alarms Copy linkLink copied to clipboard!
You can view existing Telemetry alarm information and list the meters assigned to a resource to check the current state of the metrics.
Procedure
List the existing Telemetry alarms:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To list the meters assigned to a resource, specify the UUID of the resource. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Creating an alarm Copy linkLink copied to clipboard!
Use the Telemetry Alarming service (aodh) to create an alarm that triggers when a particular condition is met, for example, when a threshold value is reached. In this example, the alarm activates and adds a log entry when the average CPU utilization for an individual instance exceeds 80%.
Procedure
Archive policies are pre-populated during the deployment process and you rarely need to create a new archive policy. However, if there is no configured archive policy, you must create one. To create an archive policy that creates metrics for 5s * 86400 points (5 days), use the following command:
openstack archive-policy create <name> \ -d granularity:5s,points:86400 \ -b 3 -m mean -m rate:mean
# openstack archive-policy create <name> \ -d granularity:5s,points:86400 \ -b 3 -m mean -m rate:mean
Copy to Clipboard Copied! Toggle word wrap Toggle overflow + Replace <name> with the name of the archive policy.
NoteEnsure that you set the value of the evaluation period for the Telemetry Alarming service to an integer greater than 60. The Ceilometer polling interval is linked to the evaluation period. Ensure that you set the Ceilometer polling interval value to a number between 60 and 600 and ensure that the value is greater than the value of the evaluation period for the Telemetry Alarming service. If the Ceilometer polling interval is too low, it can severely impact system load.
Create an alarm and use a query to isolate the specific ID of the instance for monitoring purposes. The ID of the instance in the following example is 94619081-abf5-4f1f-81c7-9cedaa872403.
NoteTo calculate the threshold value, use the following formula: 1,000,000,000 x {granularity} x {percentage_in_decimal}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3. Editing an alarm Copy linkLink copied to clipboard!
When you edit an alarm, you increase or decrease the value threshold of the alarm.
Procedure
To update the threshold value, use the
openstack alarm update
command. For example, to increase the alarm threshold to 75%, use the following command:openstack alarm update --name cpu_usage_high --threshold 75
# openstack alarm update --name cpu_usage_high --threshold 75
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.4. Disabling an alarm Copy linkLink copied to clipboard!
You can disable and enable alarms.
Procedure
Disable the alarm:
openstack alarm update --name cpu_usage_high --enabled=false
# openstack alarm update --name cpu_usage_high --enabled=false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.5. Deleting an alarm Copy linkLink copied to clipboard!
Use the openstack alarm delete
command to delete an alarm.
Procedure
To delete an alarm, enter the following command:
openstack alarm delete --name cpu_usage_high
# openstack alarm delete --name cpu_usage_high
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.6. Example: Monitoring the disk activity of instances Copy linkLink copied to clipboard!
This example demonstrates how to use an alarm that is part of the Telemetry Alarming service to monitor the cumulative disk activity for all the instances contained within a particular project.
Procedure
Review the existing projects and select the appropriate UUID of the project that you want to monitor. This example uses the
admin
tenant:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the project UUID to create an alarm that analyses the
sum()
of all read requests generated by the instances in theadmin
tenant. You can further restrain the query by using the--query
parameter:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.7. Example: Monitoring CPU use Copy linkLink copied to clipboard!
To monitor the performance of an instance, examine the Gnocchi database to identify which metrics you can monitor, such as memory or CPU usage.
Procedure
To identify the metrics you can monitor, enter the
openstack metric resource show
command with an instance UUID:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this result, the metrics value lists the components you can monitor with the Alarming service, for example
cpu
.To monitor CPU usage, use the
cpu
metric:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The archive_policy defines the aggregation interval for calculating the std, count, min, max, sum, mean values.
Inspect the currently selected archive policy for the
cpu
metric:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the Alarming service to create a monitoring task that queries
cpu
. This task triggers events based on the settings that you specify. For example, to raise a log entry when the CPU of an instance spikes over 80% for an extended duration, use the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - comparison-operator: The ge operator defines that the alarm triggers if the CPU usage is greater than or equal to 80%.
- granularity: Metrics have an archive policy associated with them; the policy can have various granularities. For example, 5 minutes aggregation for 1 hour + 1 hour aggregation over a month. The granularity value must match the duration described in the archive policy.
- evaluation-periods: Number of granularity periods that need to pass before the alarm triggers. For example, if you set this value to 2, the CPU usage must be over 80% for two polling periods before the alarm triggers.
[u’log://']: When you set
alarm_actions
orok_actions
to[u’log://']
, events, for example, the alarm is triggered or returns to a normal state, are recorded to the aodh log file.NoteYou can define different actions to run when an alarm is triggered (alarm_actions), and when it returns to a normal state (ok_actions), such as a webhook URL.
3.8. Viewing alarm history Copy linkLink copied to clipboard!
To check if a particular alarm has been triggered, you can query the alarm history and view the event information.
Procedure
Use the
openstack alarm-history show
command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow