@@ -420,20 +420,19 @@ func (c *systemCollector) collectLicense(client collector.Client, ch chan<- prom
420
420
ch <- prometheus .MustNewConstMetric (licenseInstalledDesc , prometheus .GaugeValue , float64 (lic .Installed ), licenseLabels ... )
421
421
ch <- prometheus .MustNewConstMetric (licenseNeededDesc , prometheus .GaugeValue , float64 (lic .Needed ), licenseLabels ... )
422
422
423
- expiry_str := strings .ToLower (lic .ValidityType )
424
- expiry , err := time .Parse ("2006-01-02 03:04:05 MST" , expiry_str )
425
- if err != nil {
426
- if strings .Compare (expiry_str , "expired" ) == 0 {
427
- ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (- 1 ), licenseLabels ... )
428
- } else if strings .Compare (expiry_str , "permanent" ) == 0 {
429
- ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (math .Inf (1 )), licenseLabels ... )
423
+ if strings .Compare (lic .ValidityType , "expired" ) == 0 {
424
+ ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (- 1 ), licenseLabels ... )
425
+ } else if strings .Compare (lic .ValidityType , "permanent" ) == 0 {
426
+ ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (math .Inf (1 )), licenseLabels ... )
427
+ } else {
428
+ expiry_str := strings .ToLower (lic .EndDate )
429
+ expiry , err := time .Parse ("2006-01-02" , expiry_str )
430
+ if err != nil {
431
+ ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (math .Inf (- 1 )), licenseLabels ... )
430
432
} else {
431
- ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (math .Inf (- 1 )), licenseLabels ... )
433
+ license_ttl_days := time .Until (expiry ).Hours () / 24.0
434
+ ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (license_ttl_days ), licenseLabels ... )
432
435
}
433
- } else {
434
- license_ttl_days := time .Until (expiry ).Hours () / 24.0
435
- ch <- prometheus .MustNewConstMetric (licenseExpiryDesc , prometheus .GaugeValue , float64 (license_ttl_days ), licenseLabels ... )
436
436
}
437
437
}
438
438
}
439
-
0 commit comments