@@ -56,6 +56,8 @@ func nodeMetricFamilies(allowAnnotationsList, allowLabelsList []string) []genera
56
56
createNodeStatusCapacityFamilyGenerator (),
57
57
createNodeStatusConditionFamilyGenerator (),
58
58
createNodeStateAddressFamilyGenerator (),
59
+ createNodeVolumeCountGenerator (),
60
+ createNodeVolumeInUseGenerator (),
59
61
}
60
62
}
61
63
@@ -506,6 +508,44 @@ func createNodeStatusConditionFamilyGenerator() generator.FamilyGenerator {
506
508
)
507
509
}
508
510
511
+ func createNodeVolumeCountGenerator () generator.FamilyGenerator {
512
+ return * generator .NewFamilyGeneratorWithStability (
513
+ "kube_node_volumes_attached_count" ,
514
+ "Number of volumes attached to the node" ,
515
+ metric .Gauge ,
516
+ basemetrics .STABLE ,
517
+ "" ,
518
+ wrapNodeFunc (func (n * v1.Node ) * metric.Family {
519
+ return & metric.Family {
520
+ Metrics : []* metric.Metric {
521
+ {
522
+ Value : float64 (len (n .Status .VolumesAttached )),
523
+ },
524
+ },
525
+ }
526
+ }),
527
+ )
528
+ }
529
+
530
+ func createNodeVolumeInUseGenerator () generator.FamilyGenerator {
531
+ return * generator .NewFamilyGeneratorWithStability (
532
+ "kube_node_volumes_in_use_count" ,
533
+ "Number of volumes in use on the node" ,
534
+ metric .Gauge ,
535
+ basemetrics .STABLE ,
536
+ "" ,
537
+ wrapNodeFunc (func (n * v1.Node ) * metric.Family {
538
+ return & metric.Family {
539
+ Metrics : []* metric.Metric {
540
+ {
541
+ Value : float64 (len (n .Status .VolumesInUse )),
542
+ },
543
+ },
544
+ }
545
+ }),
546
+ )
547
+ }
548
+
509
549
func wrapNodeFunc (f func (* v1.Node ) * metric.Family ) func (interface {}) * metric.Family {
510
550
return func (obj interface {}) * metric.Family {
511
551
node := obj .(* v1.Node )
0 commit comments