Compare commits

...

1 Commits

Author SHA1 Message Date
Martin/Geno
438425c872
[TASK] add support for wifictld 2018-10-07 20:16:28 +02:00
4 changed files with 49 additions and 10 deletions

View File

@ -12,6 +12,7 @@ type NodeInfo struct {
Hardware Hardware `json:"hardware"` Hardware Hardware `json:"hardware"`
VPN bool `json:"vpn"` VPN bool `json:"vpn"`
Wireless *Wireless `json:"wireless,omitempty"` Wireless *Wireless `json:"wireless,omitempty"`
Wifictld *WifiCTLDNodeinfo `json:"wifictld,omitempty"`
} }
// NetworkInterface struct // NetworkInterface struct

View File

@ -32,6 +32,7 @@ type Statistics struct {
} `json:"traffic,omitempty"` } `json:"traffic,omitempty"`
Switch map[string]*SwitchPort `json:"switch,omitempty"` Switch map[string]*SwitchPort `json:"switch,omitempty"`
Wireless WirelessStatistics `json:"wireless,omitempty"` Wireless WirelessStatistics `json:"wireless,omitempty"`
Wifictld *WifiCTLDStatistics `json:"wifictld,omitempty"`
ProcStats *ProcStats `json:"stat,omitempty"` ProcStats *ProcStats `json:"stat,omitempty"`
} }

26
data/wifictld.go Normal file
View File

@ -0,0 +1,26 @@
package data
// WifiCTLDNodeinfo struct (defined in: https://chaos.expert/genofire/wifictld/blob/preview/wireless/wifictld/src/ubus_service.c - ubus_get_config)
type WifiCTLDNodeinfo struct {
Verbose uint8 `json:"verbose,omitempty"`
ClientTryThreashold uint32 `json:"client_try_threashold,omitempty"`
ClientSignalThreashold int32 `json:"client_signal_threashold,omitempty"`
ClientCleanEvery uint32 `json:"client_clean_every,omitempty"`
ClientCleanOlderThen uint32 `json:"client_clean_older_then,omitempty"`
ClientCleanAuthed uint8 `json:"client_clean_authed,omitempty"`
ClientForce uint8 `json:"client_force,omitempty"`
ClientForceProbe uint8 `json:"client_force_probe,omitempty"`
ClientProbeSteering uint8 `json:"client_probe_steering,omitempty"`
ClientProbeLearning uint8 `json:"client_probe_learning,omitempty"`
}
// WifiCTLDStatistics struct (defined in: https://chaos.expert/genofire/wifictld/blob/preview/wireless/respondd-module-wifictld/src/respondd.c - respondd_provider_statistics)
type WifiCTLDStatistics struct {
Total uint32 `json:"total,omitempty"`
Client24 uint32 `json:"client24,omitempty"`
Client5 uint32 `json:"client5,omitempty"`
Authed uint32 `json:"authed,omitempty"`
Connected uint32 `json:"connected,omitempty"`
HighestTryProbe uint32 `json:"highest_try_probe,omitempty"`
HighestTryAuth uint32 `json:"highest_try_auth,omitempty"`
}

View File

@ -153,6 +153,17 @@ func (conn *Connection) InsertNode(node *runtime.Node) {
tags.SetString("frequency"+suffix, strconv.Itoa(int(airtime.Frequency))) tags.SetString("frequency"+suffix, strconv.Itoa(int(airtime.Frequency)))
} }
// Add Wifictld statistics
if wifictld := stats.Wifictld; wifictld != nil {
fields["wifictld.total"] = wifictld.Total
fields["wifictld.client24"] = wifictld.Client24
fields["wifictld.client5"] = wifictld.Client5
fields["wifictld.authed"] = wifictld.Authed
fields["wifictld.connected"] = wifictld.Connected
fields["wifictld.highest_try_probe"] = wifictld.HighestTryProbe
fields["wifictld.highest_try_auth"] = wifictld.HighestTryAuth
}
conn.addPoint(MeasurementNode, tags, fields, time) conn.addPoint(MeasurementNode, tags, fields, time)
// Add DHCP statistics // Add DHCP statistics