Files
nexus/sreweekly/articles/82/06-dead-man-s-switch-with-aws-cloudwatch-freshness-alerting-for-backups-a.html
2026-09-12 17:23:01 +08:00

255 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dead man&#39;s switch with AWS CloudWatch: Freshness-Alerting for Backups and Co | Sönke Ruempler</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="A recent challenge for one of the teams I am currently involved was to find a way in AWS CloudWatch: To alert if the metric breaches a specified threshold. To alert if a particular metric has not bee">
<meta property="og:type" content="article">
<meta property="og:title" content="Dead man&#39;s switch with AWS CloudWatch: Freshness-Alerting for Backups and Co">
<meta property="og:url" content="https://ruempler.eu/2017/06/26/dead-mans-switch-backup-alerting-aws-cloudwatch/">
<meta property="og:site_name" content="Sönke Ruempler">
<meta property="og:description" content="A recent challenge for one of the teams I am currently involved was to find a way in AWS CloudWatch: To alert if the metric breaches a specified threshold. To alert if a particular metric has not bee">
<meta property="og:locale">
<meta property="article:published_time" content="2017-06-26T10:00:00.000Z">
<meta property="article:modified_time" content="2026-09-06T09:37:40.000Z">
<meta property="article:author" content="Soenke Ruempler">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@s0enke">
<link rel="alternate" href="/atom.xml" title="Sönke Ruempler" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
<link rel="canonical" href="https://ruempler.eu/2017/06/26/dead-mans-switch-backup-alerting-aws-cloudwatch/"/>
<meta name="generator" content="Hexo 8.1.1"></head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">Sönke Ruempler</a>
</h1>
<h2 id="subtitle-wrap">
<a href="/" id="subtitle">Cloud Architect and Software Engineer</a>
</h2>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/categories/til">TIL</a>
<a class="main-nav-link" href="/contact">Contact</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://ruempler.eu"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main"><article id="post-dead-mans-switch-backup-alerting-aws-cloudwatch" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2017/06/26/dead-mans-switch-backup-alerting-aws-cloudwatch/" class="article-date">
<time datetime="2017-06-26T10:00:00.000Z" itemprop="datePublished">2017-06-26</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 class="article-title" itemprop="name">
Dead man&#39;s switch with AWS CloudWatch: Freshness-Alerting for Backups and Co
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>A recent challenge for one of the teams I am currently involved was to find a way in AWS CloudWatch:</p>
<ol>
<li>To alert if the metric breaches a specified threshold.</li>
<li>To alert if a particular metric has <strong>not</strong> been sent to CloudWatch within a specified interval.</li>
</ol>
<span id="more"></span>
<p>While the first one is pretty much standard CloudWatch functionality, the latter is a bit more tricky. In the Nagios&#x2F;Icinga world it’s called “freshness”. You could also call it special case of a “<a href="https://en.wikipedia.org/wiki/Dead_man%27s_switch">Dead man’s switch</a>“ for periodic tasks &#x2F; cronjobs.</p>
<p> So for example in our case we wanted to have monitored and alerted whether a backup job runs once per day.</p>
<p>So here is what we did (CloudFormation snippet below):</p>
<ul>
<li>Set the check period to the interval during which the metric is supposed to be sent. E.g. <code>86400</code> if the metric should is supposed to be sent every day. This instructs CloudWatch to check once per day.</li>
<li>Set evaluation periods to <code>1</code>: We want to get alerted immediately when there is no data written or the threshold has been breached. </li>
<li>And now the important one: We have to treat missing data as <code>breaching</code>, so that,if there has been no entry within the evaluation period then the alarm gets triggered.</li>
</ul>
<p>Example in CloudFormation syntax:</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">HealthCheckAlarm:</span></span><br><span class="line"> <span class="attr">Type:</span> <span class="string">AWS::CloudWatch::Alarm</span></span><br><span class="line"> <span class="attr">Properties:</span></span><br><span class="line"> <span class="attr">Period:</span> <span class="number">86400</span></span><br><span class="line"> <span class="attr">EvaluationPeriods:</span> <span class="number">1</span></span><br><span class="line"> <span class="attr">TreatMissingData:</span> <span class="string">breaching</span></span><br><span class="line"> <span class="string">...</span></span><br></pre></td></tr></table></figure>
<h2 id="References"><a href="#References" class="headerlink" title="References"></a>References</h2><ul>
<li><a href="https://serverfault.com/questions/743190/cloudwatch-freshness-checks-like-nagios-passive-checks">Cloudwatch freshness checks like Nagios passive checks</a></li>
</ul>
<div style="background: #f5f5f5; border: 1px solid #DDD; box-shadow: 3px 3px 0px rgba(0,0,0,0); padding: 10px">
<h3>Like what you read?</h3>
<p>You can <a href="https://cv.ruempler.eu/">hire me</a> or <a href="https://www.paypal.me/s0enke">make a donation via PayPal</a>!</p>
</div>
</div>
<footer class="article-footer">
<a data-url="https://ruempler.eu/2017/06/26/dead-mans-switch-backup-alerting-aws-cloudwatch/" data-id="cuidxMLgFETB8krm3l2gOrmJp" class="article-share-link">Share</a>
</footer>
</div>
<nav id="article-nav">
<a href="/2017/06/26/paul-o-neill-the-irreducible-components-of-leadership/" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">Newer</strong>
<div class="article-nav-title">
Paul O&#39;Neill: The Irreducible Components of Leadership
</div>
</a>
<a href="/2017/04/17/lesegruppen-buchclubs-organisationales-lernen-unternehmen/" id="article-nav-older" class="article-nav-link-wrap">
<strong class="article-nav-caption">Older</strong>
<div class="article-nav-title">Lesegruppen / Buchclubs in Unternehmen</div>
</a>
</nav>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Categories</h3>
<div class="widget">
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/til/">til</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2026/">2026</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2025/">2025</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2024/">2024</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/">2023</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/">2022</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/">2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/">2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/">2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/">2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/">2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/">2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/">2010</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2008/">2008</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2026/09/06/filter-kika-videos-by-age-with-targetaudiencecategory/">Filter KiKA videos by age with targetAudienceCategory</a>
</li>
<li>
<a href="/2025/11/09/enforcing-ports-and-adapters-in-php-with-deptrac-part2/">From Big Ball of Mud to Modulith Part 2: Introducing Ports and Adapters architecture</a>
</li>
<li>
<a href="/2025/06/27/enforcing-ports-and-adapters-in-php-with-deptrac/">From Big Ball of Mud to Modulith: Introducing and keeping a clean architecture in PHP with Deptrac</a>
</li>
<li>
<a href="/2024/11/25/solutions-to-the-lost-update-problem/">Solutions to the Lost Update Problem</a>
</li>
<li>
<a href="/2024/09/20/understanding-react-function-as-child-pattern/">Understanding the React Function as Children Pattern</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
&copy; 2026 Soenke Ruempler |
<a rel="me" href="https://awscommunity.social/@s0enke">mastodon</a><br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a><br>
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/categories/til" class="mobile-nav-link">TIL</a>
<a href="/contact" class="mobile-nav-link">Contact</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>