@@ -23,95 +23,126 @@ func (c *ArraySpaceCollector) Collect(ch chan<- prometheus.Metric) {
2323 return
2424 }
2525 a := arrays .Items [0 ]
26- ch <- prometheus .MustNewConstMetric (
27- c .ReductionDesc ,
28- prometheus .GaugeValue ,
29- a .Space .DataReduction ,
30- )
26+
27+ if a .Space .DataReduction != nil {
28+ ch <- prometheus .MustNewConstMetric (
29+ c .ReductionDesc ,
30+ prometheus .GaugeValue ,
31+ * a .Space .DataReduction ,
32+ )
33+ }
3134 ch <- prometheus .MustNewConstMetric (
3235 c .SpaceDesc ,
3336 prometheus .GaugeValue ,
3437 a .Capacity , "capacity" ,
3538 )
39+ if a .Space .Shared != nil {
40+ ch <- prometheus .MustNewConstMetric (
41+ c .SpaceDesc ,
42+ prometheus .GaugeValue ,
43+ float64 (* a .Space .Shared ), "shared" ,
44+ )
45+ }
46+ if a .Space .Snapshots != nil {
47+ ch <- prometheus .MustNewConstMetric (
48+ c .SpaceDesc ,
49+ prometheus .GaugeValue ,
50+ float64 (* a .Space .Snapshots ), "snapshots" ,
51+ )
52+ }
53+ if a .Space .System != nil {
54+ ch <- prometheus .MustNewConstMetric (
55+ c .SpaceDesc ,
56+ prometheus .GaugeValue ,
57+ float64 (* a .Space .System ), "system" ,
58+ )
59+ }
60+ if a .Space .ThinProvisioning != nil {
61+ ch <- prometheus .MustNewConstMetric (
62+ c .SpaceDesc ,
63+ prometheus .GaugeValue ,
64+ * a .Space .ThinProvisioning , "thin_provisioning" ,
65+ )
66+ }
67+ if a .Space .TotalPhysical != nil {
68+ ch <- prometheus .MustNewConstMetric (
69+ c .SpaceDesc ,
70+ prometheus .GaugeValue ,
71+ float64 (* a .Space .TotalPhysical ), "total_physical" ,
72+ )
73+ }
74+ if a .Space .TotalProvisioned != nil {
75+ ch <- prometheus .MustNewConstMetric (
76+ c .SpaceDesc ,
77+ prometheus .GaugeValue ,
78+ float64 (* a .Space .TotalProvisioned ), "total_provisioned" ,
79+ )
80+ }
81+ if a .Space .TotalReduction != nil {
82+ ch <- prometheus .MustNewConstMetric (
83+ c .SpaceDesc ,
84+ prometheus .GaugeValue ,
85+ * a .Space .TotalReduction , "total_reduction" ,
86+ )
87+ }
88+ if a .Space .Unique != nil {
89+ ch <- prometheus .MustNewConstMetric (
90+ c .SpaceDesc ,
91+ prometheus .GaugeValue ,
92+ float64 (* a .Space .Unique ), "unique" ,
93+ )
94+ }
95+ if a .Space .Virtual != nil {
96+ ch <- prometheus .MustNewConstMetric (
97+ c .SpaceDesc ,
98+ prometheus .GaugeValue ,
99+ float64 (* a .Space .Virtual ), "virtual" ,
100+ )
101+ }
102+ if a .Space .Replication != nil {
103+ ch <- prometheus .MustNewConstMetric (
104+ c .SpaceDesc ,
105+ prometheus .GaugeValue ,
106+ float64 (* a .Space .Replication ), "replication" ,
107+ )
108+ }
109+ if a .Space .SharedEffective != nil {
110+ ch <- prometheus .MustNewConstMetric (
111+ c .SpaceDesc ,
112+ prometheus .GaugeValue ,
113+ float64 (* a .Space .SharedEffective ), "shared_effective" ,
114+ )
115+ }
116+ if a .Space .SnapshotsEffective != nil {
117+ ch <- prometheus .MustNewConstMetric (
118+ c .SpaceDesc ,
119+ prometheus .GaugeValue ,
120+ float64 (* a .Space .SnapshotsEffective ), "snapshots_effective" ,
121+ )
122+ }
123+ if a .Space .UniqueEffective != nil {
124+ ch <- prometheus .MustNewConstMetric (
125+ c .SpaceDesc ,
126+ prometheus .GaugeValue ,
127+ float64 (* a .Space .UniqueEffective ), "unique_effective" ,
128+ )
129+ }
130+ if a .Space .TotalEffective != nil {
131+ ch <- prometheus .MustNewConstMetric (
132+ c .SpaceDesc ,
133+ prometheus .GaugeValue ,
134+ float64 (* a .Space .TotalEffective ), "total_effective" ,
135+ )
136+ }
36137 ch <- prometheus .MustNewConstMetric (
37138 c .SpaceDesc ,
38139 prometheus .GaugeValue ,
39- a .Space .Shared , "shared" ,
40- )
41- ch <- prometheus .MustNewConstMetric (
42- c .SpaceDesc ,
43- prometheus .GaugeValue ,
44- a .Space .Snapshots , "snapshots" ,
45- )
46- ch <- prometheus .MustNewConstMetric (
47- c .SpaceDesc ,
48- prometheus .GaugeValue ,
49- a .Space .System , "system" ,
50- )
51- ch <- prometheus .MustNewConstMetric (
52- c .SpaceDesc ,
53- prometheus .GaugeValue ,
54- a .Space .ThinProvisioning , "thin_provisioning" ,
55- )
56- ch <- prometheus .MustNewConstMetric (
57- c .SpaceDesc ,
58- prometheus .GaugeValue ,
59- a .Space .TotalPhysical , "total_physical" ,
60- )
61- ch <- prometheus .MustNewConstMetric (
62- c .SpaceDesc ,
63- prometheus .GaugeValue ,
64- a .Space .TotalProvisioned , "total_provisioned" ,
65- )
66- ch <- prometheus .MustNewConstMetric (
67- c .SpaceDesc ,
68- prometheus .GaugeValue ,
69- a .Space .TotalReduction , "total_reduction" ,
70- )
71- ch <- prometheus .MustNewConstMetric (
72- c .SpaceDesc ,
73- prometheus .GaugeValue ,
74- a .Space .Unique , "unique" ,
75- )
76- ch <- prometheus .MustNewConstMetric (
77- c .SpaceDesc ,
78- prometheus .GaugeValue ,
79- a .Space .Virtual , "virtual" ,
80- )
81- ch <- prometheus .MustNewConstMetric (
82- c .SpaceDesc ,
83- prometheus .GaugeValue ,
84- a .Space .Replication , "replication" ,
85- )
86- ch <- prometheus .MustNewConstMetric (
87- c .SpaceDesc ,
88- prometheus .GaugeValue ,
89- a .Space .SharedEffective , "shared_effective" ,
90- )
91- ch <- prometheus .MustNewConstMetric (
92- c .SpaceDesc ,
93- prometheus .GaugeValue ,
94- a .Space .SnapshotsEffective , "snapshots_effective" ,
95- )
96- ch <- prometheus .MustNewConstMetric (
97- c .SpaceDesc ,
98- prometheus .GaugeValue ,
99- a .Space .UniqueEffective , "unique_effective" ,
100- )
101- ch <- prometheus .MustNewConstMetric (
102- c .SpaceDesc ,
103- prometheus .GaugeValue ,
104- a .Space .TotalEffective , "total_effective" ,
105- )
106- ch <- prometheus .MustNewConstMetric (
107- c .SpaceDesc ,
108- prometheus .GaugeValue ,
109- a .Capacity - a .Space .System - a .Space .Replication - a .Space .Shared - a .Space .Snapshots - a .Space .Unique , "empty" ,
140+ a .Capacity - (float64 (* a .Space .System )+ float64 (* a .Space .Replication )+ float64 (* a .Space .Shared )+ float64 (* a .Space .Snapshots )+ float64 (* a .Space .Unique )), "empty" ,
110141 )
111142 ch <- prometheus .MustNewConstMetric (
112143 c .UtilizationDesc ,
113144 prometheus .GaugeValue ,
114- (a .Space .System + a .Space .Replication + a .Space .Shared + a .Space .Snapshots + a .Space .Unique )/ a .Capacity * 100 ,
145+ (float64 ( * a .Space .System ) + float64 ( * a .Space .Replication ) + float64 ( * a .Space .Shared ) + float64 ( * a .Space .Snapshots ) + float64 ( * a .Space .Unique ) )/ a .Capacity * 100 ,
115146 )
116147}
117148
0 commit comments