@@ -67,6 +67,8 @@ var LabeledMetrics = []Metric{
6767 MetricFilesystemUsage ,
6868 MetricFilesystemLimit ,
6969 MetricFilesystemAvailable ,
70+ MetricFilesystemInodes ,
71+ MetricFilesystemInodesFree ,
7072}
7173
7274var NodeAutoscalingMetrics = []Metric {
@@ -94,6 +96,8 @@ var FilesystemMetrics = []Metric{
9496 MetricFilesystemAvailable ,
9597 MetricFilesystemLimit ,
9698 MetricFilesystemUsage ,
99+ MetricFilesystemInodes ,
100+ MetricFilesystemInodesFree ,
97101}
98102var MemoryMetrics = []Metric {
99103 MetricMemoryLimit ,
@@ -609,6 +613,72 @@ var MetricFilesystemAvailable = Metric{
609613 },
610614}
611615
616+ var MetricFilesystemInodes = Metric {
617+ MetricDescriptor : MetricDescriptor {
618+ Name : "filesystem/inodes" ,
619+ Description : "Total number of inodes on a filesystem" ,
620+ Type : MetricGauge ,
621+ ValueType : ValueInt64 ,
622+ Units : UnitsBytes ,
623+ Labels : metricLabels ,
624+ },
625+ HasLabeledMetric : func (spec * cadvisor.ContainerSpec ) bool {
626+ return spec .HasFilesystem
627+ },
628+ GetLabeledMetric : func (spec * cadvisor.ContainerSpec , stat * cadvisor.ContainerStats ) []LabeledMetric {
629+ result := []LabeledMetric {}
630+ for _ , fs := range stat .Filesystem {
631+ if fs .HasInodes {
632+ result = append (result , LabeledMetric {
633+ Name : "filesystem/inodes" ,
634+ Labels : map [string ]string {
635+ LabelResourceID .Key : fs .Device ,
636+ },
637+ MetricValue : MetricValue {
638+ ValueType : ValueInt64 ,
639+ MetricType : MetricGauge ,
640+ IntValue : int64 (fs .Inodes ),
641+ },
642+ })
643+ }
644+ }
645+ return result
646+ },
647+ }
648+
649+ var MetricFilesystemInodesFree = Metric {
650+ MetricDescriptor : MetricDescriptor {
651+ Name : "filesystem/inodes_free" ,
652+ Description : "Free number of inodes on a filesystem" ,
653+ Type : MetricGauge ,
654+ ValueType : ValueInt64 ,
655+ Units : UnitsBytes ,
656+ Labels : metricLabels ,
657+ },
658+ HasLabeledMetric : func (spec * cadvisor.ContainerSpec ) bool {
659+ return spec .HasFilesystem
660+ },
661+ GetLabeledMetric : func (spec * cadvisor.ContainerSpec , stat * cadvisor.ContainerStats ) []LabeledMetric {
662+ result := []LabeledMetric {}
663+ for _ , fs := range stat .Filesystem {
664+ if fs .HasInodes {
665+ result = append (result , LabeledMetric {
666+ Name : "filesystem/inodes_free" ,
667+ Labels : map [string ]string {
668+ LabelResourceID .Key : fs .Device ,
669+ },
670+ MetricValue : MetricValue {
671+ ValueType : ValueInt64 ,
672+ MetricType : MetricGauge ,
673+ IntValue : int64 (fs .InodesFree ),
674+ },
675+ })
676+ }
677+ }
678+ return result
679+ },
680+ }
681+
612682func IsNodeAutoscalingMetric (name string ) bool {
613683 for _ , autoscalingMetric := range NodeAutoscalingMetrics {
614684 if autoscalingMetric .MetricDescriptor .Name == name {
0 commit comments