Reputation: 369
I have to create an alert on CPU utilization metric of a VM in GCP and it must follow the below condition:
is it possible via GCP stackdriver monitoring.?
Upvotes: 1
Views: 1067
Reputation: 2533
An alerting policy describes a set of conditions that you want to monitor. These conditions might relate to the health of an application, the value of a system metric, or to resource consumption. The conditions for an alerting policy define what is monitored and when to trigger an alert.
For example, suppose you want to define an alerting policy that emails you if the CPU utilization of a Compute Engine VM instance is above 50% for 3 minutes. You use the conditions dialog to specify that you want to monitor the CPU utilization of a Compute Engine VM instance, and that you want an alerting policy to trigger when that utilization is above 50% for 3 minutes.
According to your use case you will need to create two alerting policies on the same GCP metric, because your use case contains two different alert conditions with different notification channels.
1. Create an Alert policy that will send you an alert to email when threshold>50%.
Click on save, now you can add notification channels, click on manage notification channels and add mail notification channels. Refer manage notification channels for more information.
2. Repeat the same process to create an Alert policy that will send you an alert to mobile when threshold>80%, you can select an SMS notification channel while selecting notification channels.
Refer Create an alert policy and Specifying conditions for alert policies for information.
Upvotes: 1
Reputation: 2944
Yes. This is possible by creating 2 alert policies to meet your 2 conditions.
First, create an alert policy that will send to email when threshold >50%. Second, create an alert policy that will send to mobile when threshold >80%.
Please see GCP - Using alerting UI for creation of Alert Policy and GCP - Notification Options for the options for the notification which includes Email and Mobile (SMS).
Upvotes: 0