@@ -69,6 +69,8 @@ var LabeledMetrics = []Metric{
6969 MetricFilesystemUsage ,
7070 MetricFilesystemLimit ,
7171 MetricFilesystemAvailable ,
72+ MetricFilesystemInodes ,
73+ MetricFilesystemInodesFree ,
7274}
7375
7476var NodeAutoscalingMetrics = []Metric {
@@ -96,6 +98,8 @@ var FilesystemMetrics = []Metric{
9698 MetricFilesystemAvailable ,
9799 MetricFilesystemLimit ,
98100 MetricFilesystemUsage ,
101+ MetricFilesystemInodes ,
102+ MetricFilesystemInodesFree ,
99103}
100104var MemoryMetrics = []Metric {
101105 MetricMemoryLimit ,
@@ -651,6 +655,72 @@ var MetricFilesystemAvailable = Metric{
651655 },
652656}
653657
658+ var MetricFilesystemInodes = Metric {
659+ MetricDescriptor : MetricDescriptor {
660+ Name : "filesystem/inodes" ,
661+ Description : "Total number of inodes on a filesystem" ,
662+ Type : MetricGauge ,
663+ ValueType : ValueInt64 ,
664+ Units : UnitsBytes ,
665+ Labels : metricLabels ,
666+ },
667+ HasLabeledMetric : func (spec * cadvisor.ContainerSpec ) bool {
668+ return spec .HasFilesystem
669+ },
670+ GetLabeledMetric : func (spec * cadvisor.ContainerSpec , stat * cadvisor.ContainerStats ) []LabeledMetric {
671+ result := []LabeledMetric {}
672+ for _ , fs := range stat .Filesystem {
673+ if fs .HasInodes {
674+ result = append (result , LabeledMetric {
675+ Name : "filesystem/inodes" ,
676+ Labels : map [string ]string {
677+ LabelResourceID .Key : fs .Device ,
678+ },
679+ MetricValue : MetricValue {
680+ ValueType : ValueInt64 ,
681+ MetricType : MetricGauge ,
682+ IntValue : int64 (fs .Inodes ),
683+ },
684+ })
685+ }
686+ }
687+ return result
688+ },
689+ }
690+
691+ var MetricFilesystemInodesFree = Metric {
692+ MetricDescriptor : MetricDescriptor {
693+ Name : "filesystem/inodes_free" ,
694+ Description : "Free number of inodes on a filesystem" ,
695+ Type : MetricGauge ,
696+ ValueType : ValueInt64 ,
697+ Units : UnitsBytes ,
698+ Labels : metricLabels ,
699+ },
700+ HasLabeledMetric : func (spec * cadvisor.ContainerSpec ) bool {
701+ return spec .HasFilesystem
702+ },
703+ GetLabeledMetric : func (spec * cadvisor.ContainerSpec , stat * cadvisor.ContainerStats ) []LabeledMetric {
704+ result := []LabeledMetric {}
705+ for _ , fs := range stat .Filesystem {
706+ if fs .HasInodes {
707+ result = append (result , LabeledMetric {
708+ Name : "filesystem/inodes_free" ,
709+ Labels : map [string ]string {
710+ LabelResourceID .Key : fs .Device ,
711+ },
712+ MetricValue : MetricValue {
713+ ValueType : ValueInt64 ,
714+ MetricType : MetricGauge ,
715+ IntValue : int64 (fs .InodesFree ),
716+ },
717+ })
718+ }
719+ }
720+ return result
721+ },
722+ }
723+
654724func IsNodeAutoscalingMetric (name string ) bool {
655725 for _ , autoscalingMetric := range NodeAutoscalingMetrics {
656726 if autoscalingMetric .MetricDescriptor .Name == name {
0 commit comments