Clicking Events>>Alerting Policies from the navigation bar (or heading to https://app.stackdriver.com/policy) will bring you to the policy overview page. From here you can see general information about your configured policies. You can also edit, delete or deactivate your policies.
Click to get started. There are four parts to creating a policy, but you will want to begin by first entering a name for your policy.
To allow for greater control over your alerts, you can add multiple conditions to a policy. Elite and trial users can add up to four conditions to any policy.
When you add conditions, they will display at the top of your policy. From there, you can tell the policy to trigger when ALL conditions are met or when ANY condition is met.
The first thing to notice when adding a condition are your options in the left column. Metric alerts will allow you to add a Target and Configuration, while Health alerts only require a Target.
Add Metric condition
Select Metric Threshold or Metric Absence to get a detailed description of what the condition will test. For this example, select Metric Threshold and click Next.
Choose a Resource Type (Instance, Database, Load Balancer, etc.), and then decide if you would like your alert to apply to a Single resource or a Group of resources. If single, choose the resource. If group, select the group name.
Choose your If metric (CPU Usage, Disk I/O, Blocked Processes, Rabbit Messages, etc.). You will then see a chart appear below with that metric displayed. Choose your Condition (above or below the threshold), your Threshold (the line that, once crossed, will trigger your alert) and then For how long the violation should persist before your alert triggers.
Click Save Condition to add this condition to your policy.
Add Health Condition
Select any available Health check to get a detailed description of what the condition will test. For this example, select Load Balancer AZ Check and click Next.
Choose a Resource Type (in this case, Load Balancer), and then decide if you would like your alert to apply to a Single resource or a Group of resources. If single, choose the resource. If group, select the group name.
Click Save Condition to return to the policy page.
Once you have configured a condition, you can add any of the following notifications in any combination (click the link for setup instructions):
Elite users have the option to add automated actions to a policy for EC2 or RDS. For EC2, you can choose to Reboot Instance or Move Host; for RDS you can choose to Add Capacity.
Action Delay will dictate how soon the action should begin after the policy triggers. For example, you can set the Move Host action to begin five minutes after your CPU utilization policy triggers.
Notify Me lets you choose to receive a notification after each step of the process, after the process is completed, or not to receive a notification at all.
Increase Size By (GB) is available if you select the Add Capacity action for RDS.
You can add Markdown text to describe your policy in more detail or to offer instructions on what to do if the alert is triggered. This text will be displayed on the individual policy page and on the policy overview page.
Don't forget to save your policy!