DaanHoogland commented on code in PR #12613:
URL: https://github.com/apache/cloudstack/pull/12613#discussion_r2782757511
##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -216,6 +220,16 @@ private void addHostMetrics(final List<Item> metricsList,
final long dcId, final
}
metricsList.add(new ItemHostVM(zoneName, zoneUuid, host.getName(),
host.getUuid(), host.getPrivateIpAddress(),
vmDao.listByHostId(host.getId()).size()));
+
+ // Add SSL certificate expiration metric
+ if (caManager != null && caManager.getActiveCertificatesMap() !=
null) {
+ X509Certificate cert =
caManager.getActiveCertificatesMap().getOrDefault(host.getPrivateIpAddress(),
null);
+ if (cert != null) {
+ long certExpiryEpoch = cert.getNotAfter().getTime() /
1000; // Convert to epoch seconds
+ metricsList.add(new ItemHostCertExpiry(zoneName, zoneUuid,
host.getName(), host.getUuid(), host.getPrivateIpAddress(), certExpiryEpoch));
+ }
+ }
Review Comment:
`addSslCertificateExpirationMetric(..)` instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]