Skip to content

Commit

Permalink
Merge pull request #33 from steveteahan/fix-pending-maint-actions-met…
Browse files Browse the repository at this point in the history
…rics

Fix metric collection for RDS pending maintenance actions
  • Loading branch information
Steve Teahan authored Jun 2, 2022
2 parents b8b1cc2 + bbaec96 commit 9f62286
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,18 @@ 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 = action.AutoAppliedAfterDate.String()
}

var currentApplyDate string
if action.CurrentApplyDate != nil {
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 9f62286

Please sign in to comment.