Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
// MacroDB / RDS health.
//
// Adopted from monitors created by hand in the Datadog UI. Do not edit a
// monitor here and in the UI at the same time — this file wins on deploy.
import { adopted } from '../adopted';
import { notify } from '../notify';
// https://us5.datadoghq.com/monitors/1062630
adopted('rds-high-cpu', {
name: '[PROD] RDS High CPU Utilization',
type: 'query alert',
query:
'avg(last_1h):sum:aws.rds.cpuutilization{name:*-prod} by {name}.weighted() >= 95',
message: `RDS DB {{name.name}} is experiencing high CPU utilization.
${notify({ pages: true })}`,
monitorThresholds: {
critical: '95',
warning: '80',
},
onMissingData: 'show_no_data',
notifyAudit: false,
includeTags: true,
newGroupDelay: 0,
evaluationDelay: 900,
requireFullWindow: false,
});
// https://us5.datadoghq.com/monitors/1062636
adopted('macrodb-low-burst-balance', {
name: '[PROD] MacroDB Low Burst Balance',
type: 'query alert',
query: 'avg(last_1h):avg:aws.rds.burst_balance{name:macro-db-prod} <= 10',
message: `macro-db-prod burst balance is at {{value}}%.
${notify({ pages: false })}`,
monitorThresholds: {
critical: '10',
warning: '25',
},
onMissingData: 'default',
notifyAudit: false,
includeTags: false,
newHostDelay: 300,
evaluationDelay: 900,
});
// https://us5.datadoghq.com/monitors/1076524
adopted('rds-proxy-connections', {
name: '[PROD] Excessive concurrent connections in rds proxy',
type: 'query alert',
query:
'avg(last_1h):avg:aws.rds.proxy.database_connections{proxyname:macrodb-proxy-prod} > 500',
message: `We have excessive concurrent connections in the rds proxy. This can lead to slow database calls and potential outage if other services can not secure a connection
${notify({ pages: true })}`,
monitorThresholds: {
critical: '500',
},
notifyNoData: false,
notifyAudit: false,
includeTags: false,
newHostDelay: 300,
evaluationDelay: 900,
});
// https://us5.datadoghq.com/monitors/6120132
adopted('rds-storage-utilization', {
name: '[AWS] RDS Storage utilization is high',
type: 'query alert',
query:
'avg(last_1h):100 - ((avg:aws.rds.free_storage_space{*} by {dbinstanceidentifier,engine} / avg:aws.rds.total_storage_space{*} by {dbinstanceidentifier,engine}) * 100) > 90',
message: `{{#is_alert}}
🚨 CRITICAL — RDS Storage High
Instance: {{dbinstanceidentifier.name}}
Engine: {{engine.name}}
Storage utilization: {{value}}%
Critical threshold: {{threshold}}%
RDS storage utilization has reached a critical level. Investigate storage growth or increase the allocated storage.
{{/is_alert}}
{{#is_warning}}
⚠️ WARNING — RDS Storage High
Instance: {{dbinstanceidentifier.name}}
Engine: {{engine.name}}
Storage utilization: {{value}}%
Warning threshold: {{warn_threshold}}%
RDS storage utilization is approaching the critical threshold.
{{/is_warning}}
{{#is_recovery}}
✅ RECOVERED — RDS Storage Normal
Instance: {{dbinstanceidentifier.name}}
Engine: {{engine.name}}
Storage utilization: {{value}}%
RDS storage utilization has returned to an acceptable level.
{{/is_recovery}}
${notify({ pages: true })}`,
tags: ['integration:amazon_rds'],
monitorThresholds: {
critical: '90',
warning: '85',
},
onMissingData: 'default',
notifyAudit: false,
includeTags: true,
newGroupDelay: 60,
evaluationDelay: 900,
requireFullWindow: false,
});
// https://us5.datadoghq.com/monitors/6120237
adopted('rds-connection-anomaly', {
name: '[AWS] RDS Anomaly in database connections',
type: 'query alert',
query:
"avg(last_1d):anomalies(avg:aws.rds.database_connections{name:*-prod} by {dbinstanceidentifier}, 'basic', 2, direction='above', interval=300, alert_window='last_1h', count_default_zero='true') >= 0.99",
message: `The number of connections for RDS database {{dbinstanceidentifier.name}} is outside of the typical range.
${notify({ pages: false })}`,
tags: ['integration:amazon_rds'],
monitorThresholds: {
critical: '0.99',
criticalRecovery: '0',
},
monitorThresholdWindows: {
recoveryWindow: 'last_15m',
triggerWindow: 'last_1h',
},
onMissingData: 'default',
notifyAudit: false,
includeTags: true,
newGroupDelay: 60,
evaluationDelay: 900,
requireFullWindow: false,
});
// https://us5.datadoghq.com/monitors/16918778
adopted('rds-low-freeable-memory', {
name: 'Low freeable memory for {{database_instance.name}}',
type: 'query alert',
query:
'avg(last_1h):avg:aws.rds.freeable_memory{environment:prod OR database_instance:macro-db-prod.ctkwyjgndnfr.us-east-1.rds.amazonaws.com} by {database_instance} < 250000000',
// One threshold covers instances from 2 GiB to 128 GiB, and CloudWatch has
// no total-memory metric to alert on a percentage, so the floor is set below
// the normal minimum of the smallest instance. macrodb.ts and Grafana watch
// macro-db-prod and its replica at their own baselines; this one only
// notifies.
message: `{{database_instance.name}} freeable memory is {{value}} bytes, averaged over an hour. A healthy 2 GiB instance keeps about 1 GB freeable, so this is memory pressure on any instance class. Check connection count and swap usage.
${notify({ pages: false })}`,
monitorThresholds: {
critical: '250000000',
warning: '500000000',
},
onMissingData: 'default',
notifyAudit: false,
includeTags: true,
newGroupDelay: 60,
evaluationDelay: 900,
});
// https://us5.datadoghq.com/monitors/16918920
adopted('rds-high-iops', {
name: 'Database high iops for {{database_instance.name}}',
type: 'query alert',
query:
'avg(last_1h):avg:aws.rds.write_iops{environment:prod OR database_instance:macro-db-prod.ctkwyjgndnfr.us-east-1.rds.amazonaws.com} by {database_instance}.as_rate() + avg:aws.rds.read_iops{environment:prod OR database_instance:macro-db-prod.ctkwyjgndnfr.us-east-1.rds.amazonaws.com} by {database_instance}.as_rate() > 10000',
message: `{{database_instance.name}} read plus write IOPS are at {{value}}.
${notify({ pages: false })}`,
monitorThresholds: {
critical: '10000',
warning: '9000',
},
onMissingData: 'default',
notifyAudit: false,
includeTags: true,
newGroupDelay: 60,
evaluationDelay: 900,
});