如何从AWS RDS获取TotalStorageSpace或UsedStorageSpace指标? [英] How do I get TotalStorageSpace or UsedStorageSpace metric from AWS RDS?

查看:66
本文介绍了如何从AWS RDS获取TotalStorageSpace或UsedStorageSpace指标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到AWS RDS提供了一个 FreeStorageSpace 指标来监视磁盘使用情况.现在,我正在尝试为我的所有RDS创建通用抢先警报,但是在 FreeStorageSpace 上设置理想阈值是没有意义的.

I see that AWS RDS provides a FreeStorageSpace metric for monitoring disk usage. Now I am trying to create a generic pre-emptive alert for all my RDS but setting up an ideal threshold on FreeStorageSpace is not making sense.

例如,对于RDS具有总磁盘空间为100G的情况,20G可能是一个很好的阈值,但对于总磁盘空间为40G的RDS可能会产生误导.

For example, 20G might be a good threshold with RDS having total disk space as 100G but might be misleading for a RDS with total disk space of 40G.

所以我想知道是否有一种方法可以从RDS(直接或间接地)获得 TotalStorageSpace UsedStorageSpace 指标.

So I was wondering if there is a way to get TotalStorageSpace or UsedStorageSpace metric from RDS (directly or indirectly).

更新

由于事实已经确定, FreeStorageSpace 是RDS提供的唯一与磁盘存储有关的度量标准,因此有关是否/如何为 TotalStorageSpace 建立自定义度量标准的任何想法还是 UsedStorageSpace ?

Since the fact is established that FreeStorageSpace is the only metric RDS provides related to disk storage, any ideas on if / how we can we build a custom metric for TotalStorageSpace or UsedStorageSpace?

p.s .:为每个RDS创建单独的警报以评估磁盘使用百分比似乎浪费了时间和资源.

p.s.: Creating separate alarms for each RDS for evaluating disk usage percentage seems such waste of time and resource.

推荐答案

如果启用增强监控,然后Cloudwatch Logs中的RDSOSMetrics日志组将具有包含文件系统统计信息的详细JSON日志消息.我最终创建了Cloudwatch Logs指标过滤器,以从根文件系统的 fileSys 属性中解析出 usedPercent 值.至少对于Postgresql而言,这些详细的日志包括//rdsdbdata 文件系统.后者是在存储空间方面令人感兴趣的.

If you enable Enhanced Monitoring, then the RDSOSMetrics log group in Cloudwatch Logs will have detailed JSON log messages which include filesystem statistics. I ended up creating a Cloudwatch Logs metric filter to parse out the usedPercent value from the fileSys attribute for the root filesystem. At least for Postgresql, these detailed logs include both / and /rdsdbdata filesystems; the latter is the one that is of interest in terms of storage space.

您可以创建格式为 {$.instanceID =" My_DB_Instance_Name"&&$ .fileSys [0] .mountPoint ="/rdsdbdata"} 和相应的指标值 $.fileSys [0] .usedPercent ,以获取给定实例的已用存储百分比.然后,它将用作可用于触发警报的日志指标.您可能需要创建另一个度量标准,用 filesystem [1] 替换 filesystem [0] ,因为该数组的排序未知.您可能想要为每个RDS实例创建这些实例,以便知道哪个RDS实例空间不足,但是您的问题似乎表明您不希望每个实例都发出警报.

You can create a metric filter of the form {$.instanceID = "My_DB_Instance_Name" && $.fileSys[0].mountPoint = "/rdsdbdata"} and a corresponding metric value $.fileSys[0].usedPercent to get the used storage percentage for a given instance. This would then be available as a Log Metric that you could use to trigger an alarm. You probably need to create another metric replacing filesystem[0] with filesystem[1] since ordering is unknown for that array. You'd probably want to create these for each RDS instance you have so you know which one is running out of space, but you question seems to indicate you don't want a per-instance alarm.

我想您可以从指标过滤器中排除 $.instanceID ,而只需将所有值写入一个指标即可.当达到阈值并触发警报时,您需要开始检查以查看哪个实例负责.

I suppose you could exclude the $.instanceID from the metric filter and just get all values written to a single metric. When it reached a threshold and triggered an alarm, you'd need to start checking to see which instance is responsible.

这篇关于如何从AWS RDS获取TotalStorageSpace或UsedStorageSpace指标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆