@@ -31,6 +31,7 @@ func (c *w60gInterfaceCollector) describe(ch chan<- *prometheus.Desc) {
31
31
ch <- c .txDistanceDesc
32
32
ch <- c .txPacketErrorRateDesc
33
33
}
34
+
34
35
func (c * w60gInterfaceCollector ) collect (ctx * collectorContext ) error {
35
36
reply , err := ctx .client .Run ("/interface/w60g/print" , "=.proplist=name" )
36
37
if err != nil {
@@ -53,7 +54,11 @@ func (c *w60gInterfaceCollector) collect(ctx *collectorContext) error {
53
54
54
55
return c .collectw60gMetricsForInterfaces (ifaces , ctx )
55
56
}
56
- func (c * w60gInterfaceCollector ) collectw60gMetricsForInterfaces (ifaces []string , ctx * collectorContext ) error {
57
+
58
+ func (c * w60gInterfaceCollector ) collectw60gMetricsForInterfaces (
59
+ ifaces []string ,
60
+ ctx * collectorContext ,
61
+ ) error {
57
62
reply , err := ctx .client .Run ("/interface/w60g/monitor" ,
58
63
"=numbers=" + strings .Join (ifaces , "," ),
59
64
"=once=" ,
@@ -77,7 +82,11 @@ func (c *w60gInterfaceCollector) collectw60gMetricsForInterfaces(ifaces []string
77
82
return nil
78
83
}
79
84
80
- func (c * w60gInterfaceCollector ) collectMetricsForw60gInterface (name string , se * proto.Sentence , ctx * collectorContext ) {
85
+ func (c * w60gInterfaceCollector ) collectMetricsForw60gInterface (
86
+ name string ,
87
+ se * proto.Sentence ,
88
+ ctx * collectorContext ,
89
+ ) {
81
90
for _ , prop := range c .props {
82
91
v , ok := se .Map [prop ]
83
92
if ! ok {
@@ -106,22 +115,37 @@ func neww60gInterfaceCollector() routerOSCollector {
106
115
107
116
labelNames := []string {"name" , "address" , "interface" }
108
117
return & w60gInterfaceCollector {
109
- frequencyDesc : description (prefix , "frequency" , "frequency of tx in MHz" , labelNames ),
110
- txMCSDesc : description (prefix , "txMCS" , "TX MCS" , labelNames ),
111
- txPHYRateDesc : description (prefix , "txPHYRate" , "PHY Rate in bps" , labelNames ),
112
- signalDesc : description (prefix , "signal" , "Signal quality in %" , labelNames ),
113
- rssiDesc : description (prefix , "rssi" , "Signal RSSI in dB" , labelNames ),
114
- txSectorDesc : description (prefix , "txSector" , "TX Sector" , labelNames ),
115
- txDistanceDesc : description (prefix , "txDistance" , "Distance to remote" , labelNames ),
116
- txPacketErrorRateDesc : description (prefix , "txPacketErrorRate" , "TX Packet Error Rate" , labelNames ),
117
- props : []string {"signal" , "rssi" , "tx-mcs" , "frequency" , "tx-phy-rate" , "tx-sector" , "distance" , "tx-packet-error-rate" },
118
+ frequencyDesc : description (
119
+ prefix ,
120
+ "frequency" ,
121
+ "frequency of tx in MHz" ,
122
+ labelNames ,
123
+ ),
124
+ txMCSDesc : description (prefix , "txMCS" , "TX MCS" , labelNames ),
125
+ txPHYRateDesc : description (prefix , "txPHYRate" , "PHY Rate in bps" , labelNames ),
126
+ signalDesc : description (prefix , "signal" , "Signal quality in %" , labelNames ),
127
+ rssiDesc : description (prefix , "rssi" , "Signal RSSI in dB" , labelNames ),
128
+ txSectorDesc : description (prefix , "txSector" , "TX Sector" , labelNames ),
129
+ txDistanceDesc : description (prefix , "txDistance" , "Distance to remote" , labelNames ),
130
+ txPacketErrorRateDesc : description (
131
+ prefix ,
132
+ "txPacketErrorRate" ,
133
+ "TX Packet Error Rate" ,
134
+ labelNames ,
135
+ ),
136
+ props : []string {
137
+ "signal" ,
138
+ "rssi" ,
139
+ "tx-mcs" ,
140
+ "frequency" ,
141
+ "tx-phy-rate" ,
142
+ "tx-sector" ,
143
+ "distance" ,
144
+ "tx-packet-error-rate" ,
145
+ },
118
146
}
119
147
}
120
148
121
- func (c * w60gInterfaceCollector ) valueForKey (name , value string ) (float64 , error ) {
122
- return strconv .ParseFloat (value , 64 )
123
- }
124
-
125
149
func (c * w60gInterfaceCollector ) descForKey (name string ) * prometheus.Desc {
126
150
switch name {
127
151
case "signal" :
0 commit comments