StackDriver-How to create alert for instance up/down

1,711 views
Skip to first unread message

cvg.h...@gmail.com

unread,
Aug 22, 2018, 12:52:19 PM8/22/18
to Google Stackdriver Discussion Forum
Hi,

I am using Stack Driver (Not Premier just basic Account) to and want to create an alert based on whether a GCE instance (Linux) is up or down.

Metric is available in the Metrics Explorer but not available in the metrics drop down section while creating Alert policy.

Is this option only available in Stack Driver Premier Account? If not please suggest how can I create alert for an instance up/down.

Thanks in advance.

Yuri Grinshteyn

unread,
Aug 22, 2018, 1:05:02 PM8/22/18
to cvg.h...@gmail.com, Google Stackdriver Discussion Forum
I don't know if this is the officially recommended approach, but you could use Metric Absence for any metric that should be always collected, like this:
image.png

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To post to this group, send email to google-stackdr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/84bbb457-3f7e-4096-92e9-9e734af12918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Yuri "The Grinch" Grinshteyn

Google Cloud Customer Engineer

theg...@google.com

This week in GCP

Harith J

unread,
Aug 23, 2018, 2:37:58 AM8/23/18
to Yuri Grinshteyn, Google Stackdriver Discussion Forum
Thanks Yuri. I think this will serve the purpose. Get back to you with the update


On Wed, Aug 22, 2018 at 10:04 AM, Yuri Grinshteyn <theg...@google.com> wrote:
I don't know if this is the officially recommended approach, but you could use Metric Absence for any metric that should be always collected, like this:
image.png
On Wed, Aug 22, 2018 at 9:52 AM <cvg.h...@gmail.com> wrote:
Hi,

I am using Stack Driver (Not Premier just basic Account) to and want to create an alert based on whether a GCE instance (Linux) is up or down.

Metric is available in the Metrics Explorer but not available in the metrics drop down section while creating Alert policy.

Is this option only available in Stack Driver Premier Account? If not please suggest how can I create alert for an instance up/down.

Thanks in advance.

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdriver-discu...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-discussion+unsub...@googlegroups.com.
To post to this group, send email to google-stackdriver-discussion@googlegroups.com.

Harith J

unread,
Aug 23, 2018, 2:45:17 AM8/23/18
to Yuri Grinshteyn, Google Stackdriver Discussion Forum
Is there any option to create the alert on immediate shut down of the instance? Because the minimum monitoring time of the metric absence time 5 minutes which is more.

Few more questions:

1) what exactly uptime metric will do?
2) can we create our own custom metric for node up/down? If so can it be available for alerting/policies? 

On Wed, Aug 22, 2018 at 11:37 PM, Harith J <cvg.h...@gmail.com> wrote:
Thanks Yuri. I think this will serve the purpose. Get back to you with the update

On Wed, Aug 22, 2018 at 10:04 AM, Yuri Grinshteyn <theg...@google.com> wrote:
I don't know if this is the officially recommended approach, but you could use Metric Absence for any metric that should be always collected, like this:
image.png
On Wed, Aug 22, 2018 at 9:52 AM <cvg.h...@gmail.com> wrote:
Hi,

I am using Stack Driver (Not Premier just basic Account) to and want to create an alert based on whether a GCE instance (Linux) is up or down.

Metric is available in the Metrics Explorer but not available in the metrics drop down section while creating Alert policy.

Is this option only available in Stack Driver Premier Account? If not please suggest how can I create alert for an instance up/down.

Thanks in advance.

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdriver-discussion@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-discussion+unsub...@googlegroups.com.
To post to this group, send email to google-stackdriver-discussion@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/84bbb457-3f7e-4096-92e9-9e734af12918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harith J

unread,
Aug 23, 2018, 3:16:52 AM8/23/18
to Yuri Grinshteyn, Google Stackdriver Discussion Forum
Metric Absence is not working..

Yuri Grinshteyn

unread,
Aug 23, 2018, 10:19:55 AM8/23/18
to cvg.h...@gmail.com, Google Stackdriver Discussion Forum
Is there any option to create the alert on immediate shut down of the instance? Because the minimum monitoring time of the metric absence time 5 minutes which is more.
- Yes - you could use a log-based metric instead, using the log entry about the VM shutdown as the data source.

1) what exactly uptime metric will do? 

2) can we create our own custom metric for node up/down? If so can it be available for alerting/policies? 
Yes - see the Monitoring API documentation for how to create custom metrics and send them to the API. - https://cloud.google.com/monitoring/custom-metrics/creating-metrics

Metric Absence is not working..
- can you provide more information? You may need to work with support to do actual troubleshooting, as that'll be difficult over email.

On Thu, Aug 23, 2018 at 12:16 AM Harith J <cvg.h...@gmail.com> wrote:
Metric Absence is not working..
On Wed, Aug 22, 2018 at 11:45 PM, Harith J <cvg.h...@gmail.com> wrote:
Is there any option to create the alert on immediate shut down of the instance? Because the minimum monitoring time of the metric absence time 5 minutes which is more.

Few more questions:

1) what exactly uptime metric will do?
2) can we create our own custom metric for node up/down? If so can it be available for alerting/policies? 
On Wed, Aug 22, 2018 at 11:37 PM, Harith J <cvg.h...@gmail.com> wrote:
Thanks Yuri. I think this will serve the purpose. Get back to you with the update

On Wed, Aug 22, 2018 at 10:04 AM, Yuri Grinshteyn <theg...@google.com> wrote:
I don't know if this is the officially recommended approach, but you could use Metric Absence for any metric that should be always collected, like this:
image.png
On Wed, Aug 22, 2018 at 9:52 AM <cvg.h...@gmail.com> wrote:
Hi,

I am using Stack Driver (Not Premier just basic Account) to and want to create an alert based on whether a GCE instance (Linux) is up or down.

Metric is available in the Metrics Explorer but not available in the metrics drop down section while creating Alert policy.

Is this option only available in Stack Driver Premier Account? If not please suggest how can I create alert for an instance up/down.

Thanks in advance.

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To post to this group, send email to google-stackdr...@googlegroups.com.
--

Yuri "The Grinch" Grinshteyn

Google Cloud Customer Engineer

theg...@google.com

This week in GCP

shree

unread,
Aug 25, 2018, 10:14:04 AM8/25/18
to Google Stackdriver Discussion Forum
Hi,

I am also facing same issue, i am unable to frame the query to create alerting using stackdriver api. i am totally confusing. please help me on the same. 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdriver-discu...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-discussion+unsub...@googlegroups.com.
--

Yuri "The Grinch" Grinshteyn

Google Cloud Customer Engineer

theg...@google.com

This week in GCP

Yuri Grinshteyn

unread,
Aug 25, 2018, 6:11:45 PM8/25/18
to pandu...@gmail.com, Google Stackdriver Discussion Forum
Hi, Shree - can you please create a separate thread in this forum describing what you're trying to do, what you've done so far, and where you're encountering issues?

Thank you,
Yuri

Hi,

Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
--

Yuri "The Grinch" Grinshteyn

Google Cloud Customer Engineer

theg...@google.com

This week in GCP



--

Yuri "The Grinch" Grinshteyn

Google Cloud Customer Engineer

theg...@google.com

This week in GCP

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.

---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.

To post to this group, send email to google-stackdr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Safyan

unread,
Aug 28, 2018, 3:16:38 PM8/28/18
to cvg.h...@gmail.com, Google Stackdriver Discussion Forum
On Wed, Aug 22, 2018 at 12:52 PM <cvg.h...@gmail.com> wrote:
Hi,

I am using Stack Driver (Not Premier just basic Account) to and want to create an alert based on whether a GCE instance (Linux) is up or down.


Can you define what you mean by "up"? In particular, there are two different cases that I think are important to distinguish:
  • Given that the instance is in the RUNNING state, detect that the instance is behaving improperly/incorrectly (but don't alert if deliberately paused/stopped).
  • Detect that the instance is in the PAUSED or STOPPED states (rather than in the RUNNING state).
 
Metric is available in the Metrics Explorer but not available in the metrics drop down section while creating Alert policy.

Which metric?
 

Is this option only available in Stack Driver Premier Account? If not please suggest how can I create alert for an instance up/down.

There shouldn't be any distinction between Basic and Premium tiers at this point, anymore (see: Stackdriver tiers).

Michael Safyan

unread,
Aug 28, 2018, 3:26:47 PM8/28/18
to Yuri Grinshteyn, cvg.h...@gmail.com, Google Stackdriver Discussion Forum
Quick note with regard to this strategy (of using metric absence); there is an important difference in behavior between "Single", "All", and "Group"....

For "All" and "Group", instances that are in the "PAUSED" or "STOPPED" state will be excluded (so as to not cause false positive alerts, especially when used with managed instance groups, autoscaling, etc.). So the "All"/"Group" strategy cannot detect the RUNNING->{PAUSED,STOPPED} transition if that is what you are trying to detect (it can, however, detect if the instance is nominally running but software on the VM is somehow stuck/non-functioning). If you use "Single", however, since you list a specific instance we assume that you want that specific instance to always be checked and don't filter it out (even if it is in the PAUSED/STOPPED state).

Related to this, you may also want to check out Preventing Accidental VM Deletion.

Michael Safyan

Senior Software Engineer · Stackdriver Monitoring

6425 Penn Ave 7th Floor; Pittsburgh, PA 15206

http://www.michaelsafyan.com | michae...@google.com



Reply all
Reply to author
Forward
0 new messages