title: How to setup AWS CloudWatch's agent at Ubuntu to get (correct) custom metrics like cpu, memory and disk usage %
body: <p>I'm running an AWS EC2 m5.large (a none burstable instance). I have setup one of AWS CloudWatch's default metrics (CPU %) + some custom metrics (memory + disk usage) in my dashboard.</p>
  
  <p>But when I compare the numbers CloudWatch report to me they are pretty far from then actually usage of the Ubuntu 20.04 server when I log in to it...</p>
  
  <p>Actual usage:</p>
  
  <pre><code>CPU: ~ 35 %
  Memory: ~ 33 %
  </code></pre>
  
  <p>CloudWatch report:</p>
  
  <pre><code>CPU ~ 10 %
  Memory: ~ 50-55
  </code></pre>
  
  <p><a href="https://www.screencast.com/t/o1nAnOFjVZW" rel="noreferrer">https://www.screencast.com/t/o1nAnOFjVZW</a></p>
  
  <p>I have followed AWS own instructions to add the metrics for memory and disk usage (Because CloudWatch doesn't out of the box have access to O/S level stuff): <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html" rel="noreferrer">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html</a></p>
  
  <p>When numbers are so far from each other - then it would be impossible to setup useful alarms and notifications. I can't believe that is what AWS wants to provide to the people who chose to followed their original instructions?
  The only thing with match exactly is the disk usage %.</p>