@@ -23,78 +23,81 @@ func (c *FileSystemsPerfCollector) Describe(ch chan<- *prometheus.Desc) {
2323}
2424
2525func (c * FileSystemsPerfCollector ) Collect (ch chan <- prometheus.Metric ) {
26- filesystemsperf := c .Client .GetFileSystemsPerformance (c .FileSystems , "NFS" )
27- if len (filesystemsperf .Items ) == 0 {
26+ if len (c .FileSystems .Items ) == 0 {
2827 return
2928 }
3029
31- for _ , fp := range filesystemsperf .Items {
32- ch <- prometheus .MustNewConstMetric (
33- c .LatencyDesc ,
34- prometheus .GaugeValue ,
35- fp .UsecPerOtherOp ,
36- fp .Name , "usec_per_other_op" ,
37- )
38- ch <- prometheus .MustNewConstMetric (
39- c .LatencyDesc ,
40- prometheus .GaugeValue ,
41- fp .UsecPerReadOp ,
42- fp .Name , "usec_per_read_op" ,
43- )
44- ch <- prometheus .MustNewConstMetric (
45- c .LatencyDesc ,
46- prometheus .GaugeValue ,
47- fp .UsecPerWriteOp ,
48- fp .Name , "usec_per_write_op" ,
49- )
50- ch <- prometheus .MustNewConstMetric (
51- c .ThroughputDesc ,
52- prometheus .GaugeValue ,
53- fp .OthersPerSec ,
54- fp .Name , "others_per_sec" ,
55- )
56- ch <- prometheus .MustNewConstMetric (
57- c .ThroughputDesc ,
58- prometheus .GaugeValue ,
59- fp .ReadsPerSec ,
60- fp .Name , "reads_per_sec" ,
61- )
62- ch <- prometheus .MustNewConstMetric (
63- c .ThroughputDesc ,
64- prometheus .GaugeValue ,
65- fp .WritesPerSec ,
66- fp .Name , "writes_per_sec" ,
67- )
68- ch <- prometheus .MustNewConstMetric (
69- c .BandwidthDesc ,
70- prometheus .GaugeValue ,
71- fp .ReadBytesPerSec ,
72- fp .Name , "read_bytes_per_sec" ,
73- )
74- ch <- prometheus .MustNewConstMetric (
75- c .BandwidthDesc ,
76- prometheus .GaugeValue ,
77- fp .WriteBytesPerSec ,
78- fp .Name , "write_bytes_per_sec" ,
79- )
80- ch <- prometheus .MustNewConstMetric (
81- c .AverageSizeDesc ,
82- prometheus .GaugeValue ,
83- fp .BytesPerOp ,
84- fp .Name , "bytes_per_op" ,
85- )
86- ch <- prometheus .MustNewConstMetric (
87- c .AverageSizeDesc ,
88- prometheus .GaugeValue ,
89- fp .BytesPerRead ,
90- fp .Name , "bytes_per_read" ,
91- )
92- ch <- prometheus .MustNewConstMetric (
93- c .AverageSizeDesc ,
94- prometheus .GaugeValue ,
95- fp .BytesPerWrite ,
96- fp .Name , "bytes_per_write" ,
97- )
30+ protocols := []string {"all" , "SMB" , "NFS" }
31+ for _ , proto := range protocols {
32+ filesystemsperf := c .Client .GetFileSystemsPerformance (c .FileSystems , proto )
33+ for _ , fp := range filesystemsperf .Items {
34+ ch <- prometheus .MustNewConstMetric (
35+ c .LatencyDesc ,
36+ prometheus .GaugeValue ,
37+ fp .UsecPerOtherOp ,
38+ fp .Name , "usec_per_other_op" , proto ,
39+ )
40+ ch <- prometheus .MustNewConstMetric (
41+ c .LatencyDesc ,
42+ prometheus .GaugeValue ,
43+ fp .UsecPerReadOp ,
44+ fp .Name , "usec_per_read_op" , proto ,
45+ )
46+ ch <- prometheus .MustNewConstMetric (
47+ c .LatencyDesc ,
48+ prometheus .GaugeValue ,
49+ fp .UsecPerWriteOp ,
50+ fp .Name , "usec_per_write_op" , proto ,
51+ )
52+ ch <- prometheus .MustNewConstMetric (
53+ c .ThroughputDesc ,
54+ prometheus .GaugeValue ,
55+ fp .OthersPerSec ,
56+ fp .Name , "others_per_sec" , proto ,
57+ )
58+ ch <- prometheus .MustNewConstMetric (
59+ c .ThroughputDesc ,
60+ prometheus .GaugeValue ,
61+ fp .ReadsPerSec ,
62+ fp .Name , "reads_per_sec" , proto ,
63+ )
64+ ch <- prometheus .MustNewConstMetric (
65+ c .ThroughputDesc ,
66+ prometheus .GaugeValue ,
67+ fp .WritesPerSec ,
68+ fp .Name , "writes_per_sec" , proto ,
69+ )
70+ ch <- prometheus .MustNewConstMetric (
71+ c .BandwidthDesc ,
72+ prometheus .GaugeValue ,
73+ fp .ReadBytesPerSec ,
74+ fp .Name , "read_bytes_per_sec" , proto ,
75+ )
76+ ch <- prometheus .MustNewConstMetric (
77+ c .BandwidthDesc ,
78+ prometheus .GaugeValue ,
79+ fp .WriteBytesPerSec ,
80+ fp .Name , "write_bytes_per_sec" , proto ,
81+ )
82+ ch <- prometheus .MustNewConstMetric (
83+ c .AverageSizeDesc ,
84+ prometheus .GaugeValue ,
85+ fp .BytesPerOp ,
86+ fp .Name , "bytes_per_op" , proto ,
87+ )
88+ ch <- prometheus .MustNewConstMetric (
89+ c .AverageSizeDesc ,
90+ prometheus .GaugeValue ,
91+ fp .BytesPerRead ,
92+ fp .Name , "bytes_per_read" , proto ,
93+ )
94+ ch <- prometheus .MustNewConstMetric (
95+ c .AverageSizeDesc ,
96+ prometheus .GaugeValue ,
97+ fp .BytesPerWrite ,
98+ fp .Name , "bytes_per_write" , proto ,
99+ )
100+ }
98101 }
99102}
100103
@@ -104,25 +107,25 @@ func NewFileSystemsPerfCollector(fb *client.FBClient,
104107 LatencyDesc : prometheus .NewDesc (
105108 "purefb_file_systems_performance_latency_usec" ,
106109 "FlashBlade file systems latency" ,
107- []string {"name" , "dimension" },
110+ []string {"name" , "dimension" , "protocol" },
108111 prometheus.Labels {},
109112 ),
110113 ThroughputDesc : prometheus .NewDesc (
111114 "purefb_file_systems_performance_throughput_iops" ,
112115 "FlashBlade file systems throughput" ,
113- []string {"name" , "dimension" },
116+ []string {"name" , "dimension" , "protocol" },
114117 prometheus.Labels {},
115118 ),
116119 BandwidthDesc : prometheus .NewDesc (
117120 "purefb_file_systems_performance_bandwidth_bytes" ,
118121 "FlashBlade file systems bandwidth" ,
119- []string {"name" , "dimension" },
122+ []string {"name" , "dimension" , "protocol" },
120123 prometheus.Labels {},
121124 ),
122125 AverageSizeDesc : prometheus .NewDesc (
123126 "purefb_file_systems_performance_average_bytes" ,
124127 "FlashBlade file systems average operations size" ,
125- []string {"name" , "dimension" },
128+ []string {"name" , "dimension" , "protocol" },
126129 prometheus.Labels {},
127130 ),
128131 Client : fb ,
0 commit comments