Cloudwatch monitor linux server load vs CPU

0

Afternoon all, CPU is good but sometimes not the issue, so trying to see how we can monitor the load on our linux servers (both Ubuntu and Amazon AMI) I haven't seen anything in my search, so I am guessing a custom metric, but not sure if anyone has already done this and can help out the best way.

Thanks.

已提問 2 年前檢視次數 868 次
1 個回答
0

After holding off and doing other things, I have figured it out. So what I did was a simple bash script to get the load and push that as a custom metric that runs every minute.

Here is the basic script if anyone wants/needs but having the load vs the CPU is a much better representation to the box as there are so many factors that can slow a server down;

#!/usr/bin/env bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

#Grab the load (and only the first 1 minute average)
load=$( cat /proc/loadavg | awk '{print $1;}' )

#to get the instance-ID
id=`cat /var/lib/cloud/data/instance-id`

#echo $id 
#echo $load
aws cloudwatch put-metric-data --metric-name="load"  --namespace "ServerLoad"  --dimensions Instance=$id --value $load

Thanks

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南