Skip to content

Commit

Permalink
Fix metric collection for RDS pending maintenance actions
Browse files Browse the repository at this point in the history
It appears that AutoAppliedAfterDate and CurrentApplyDate are optional
and AWS decided to remove these for some recent OS upgrades immediately
after I pushed this change.
  • Loading branch information
Steve Teahan committed Jun 2, 2022
1 parent b8b1cc2 commit 891374a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,22 @@ func (e *RDSExporter) Collect(ch chan<- prometheus.Metric) {
// DescribePendingMaintenanceActions only returns ARNs, so this gets the identifier.
dbIdentifier := strings.Split(*instance.ResourceIdentifier, ":")[6]
instancesWithPendingMaint[dbIdentifier] = true
ch <- prometheus.MustNewConstMetric(e.PendingMaintenanceActions, prometheus.GaugeValue, 1, *e.sess.Config.Region, dbIdentifier, *action.Action, action.AutoAppliedAfterDate.String(), action.CurrentApplyDate.String(), *action.Description)

var autoApplyDate string
if action.AutoAppliedAfterDate == nil {
autoApplyDate = ""
} else {
autoApplyDate = action.AutoAppliedAfterDate.String()
}

var currentApplyDate string
if action.CurrentApplyDate == nil {
currentApplyDate = ""
} else {
currentApplyDate = action.CurrentApplyDate.String()
}

ch <- prometheus.MustNewConstMetric(e.PendingMaintenanceActions, prometheus.GaugeValue, 1, *e.sess.Config.Region, dbIdentifier, *action.Action, autoApplyDate, currentApplyDate, *action.Description)
}
}

Expand Down

0 comments on commit 891374a

Please sign in to comment.