2016-03-12 13:32:55 +01:00
|
|
|
package data
|
|
|
|
|
2016-03-12 18:18:35 +01:00
|
|
|
/*
|
|
|
|
Nodes Lua based respondd do not have a integer type.
|
|
|
|
They always return float.
|
|
|
|
*/
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
//Statistics struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Statistics struct {
|
2017-03-13 12:15:22 +01:00
|
|
|
NodeID string `json:"node_id"`
|
|
|
|
Clients Clients `json:"clients"`
|
2018-04-19 11:26:08 +02:00
|
|
|
DHCP *DHCP `json:"dhcp"`
|
2017-03-13 12:15:22 +01:00
|
|
|
RootFsUsage float64 `json:"rootfs_usage,omitempty"`
|
|
|
|
LoadAverage float64 `json:"loadavg,omitempty"`
|
|
|
|
Memory Memory `json:"memory,omitempty"`
|
|
|
|
Uptime float64 `json:"uptime,omitempty"`
|
|
|
|
Idletime float64 `json:"idletime,omitempty"`
|
|
|
|
GatewayIPv4 string `json:"gateway,omitempty"`
|
|
|
|
GatewayIPv6 string `json:"gateway6,omitempty"`
|
|
|
|
GatewayNexthop string `json:"gateway_nexthop,omitempty"`
|
|
|
|
Processes struct {
|
2016-03-12 13:32:55 +01:00
|
|
|
Total uint32 `json:"total"`
|
|
|
|
Running uint32 `json:"running"`
|
2016-06-19 00:01:12 +02:00
|
|
|
} `json:"processes,omitempty"`
|
2017-01-20 23:23:31 +01:00
|
|
|
MeshVPN *MeshVPN `json:"mesh_vpn,omitempty"`
|
2016-03-19 03:08:19 +01:00
|
|
|
Traffic struct {
|
|
|
|
Tx *Traffic `json:"tx"`
|
|
|
|
Rx *Traffic `json:"rx"`
|
|
|
|
Forward *Traffic `json:"forward"`
|
|
|
|
MgmtTx *Traffic `json:"mgmt_tx"`
|
|
|
|
MgmtRx *Traffic `json:"mgmt_rx"`
|
2016-06-19 00:01:12 +02:00
|
|
|
} `json:"traffic,omitempty"`
|
2018-05-06 00:11:01 +02:00
|
|
|
Switch map[string]*SwitchPort `json:"switch,omitempty"`
|
|
|
|
Wireless WirelessStatistics `json:"wireless,omitempty"`
|
|
|
|
ProcStats *ProcStats `json:"stat,omitempty"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// MeshVPNPeerLink struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type MeshVPNPeerLink struct {
|
|
|
|
Established float64 `json:"established"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// MeshVPNPeerGroup struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type MeshVPNPeerGroup struct {
|
|
|
|
Peers map[string]*MeshVPNPeerLink `json:"peers"`
|
|
|
|
Groups map[string]*MeshVPNPeerGroup `json:"groups"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// MeshVPN struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type MeshVPN struct {
|
|
|
|
Groups map[string]*MeshVPNPeerGroup `json:"groups,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Traffic struct
|
2016-03-19 03:08:19 +01:00
|
|
|
type Traffic struct {
|
2016-03-12 13:32:55 +01:00
|
|
|
Bytes float64 `json:"bytes,omitempty"`
|
|
|
|
Packets float64 `json:"packets,omitempty"`
|
|
|
|
Dropped float64 `json:"dropped,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Clients struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Clients struct {
|
|
|
|
Wifi uint32 `json:"wifi"`
|
|
|
|
Wifi24 uint32 `json:"wifi24"`
|
|
|
|
Wifi5 uint32 `json:"wifi5"`
|
|
|
|
Total uint32 `json:"total"`
|
|
|
|
}
|
|
|
|
|
2018-04-19 11:26:08 +02:00
|
|
|
// DHCP struct
|
|
|
|
type DHCP struct {
|
|
|
|
// Packet counters
|
|
|
|
Decline uint32 `json:"dhcp_decline"`
|
|
|
|
Offer uint32 `json:"dhcp_offer"`
|
|
|
|
Ack uint32 `json:"dhcp_ack"`
|
|
|
|
Nak uint32 `json:"dhcp_nak"`
|
|
|
|
Request uint32 `json:"dhcp_request"`
|
|
|
|
Discover uint32 `json:"dhcp_discover"`
|
|
|
|
Inform uint32 `json:"dhcp_inform"`
|
|
|
|
Release uint32 `json:"dhcp_release"`
|
|
|
|
|
|
|
|
LeasesAllocated uint32 `json:"leases_allocated_4"`
|
|
|
|
LeasesPruned uint32 `json:"leases_pruned_4"`
|
|
|
|
}
|
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// Memory struct
|
2016-03-12 13:32:55 +01:00
|
|
|
type Memory struct {
|
2018-01-31 18:15:00 +01:00
|
|
|
Cached int64 `json:"cached"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
Buffers int64 `json:"buffers"`
|
|
|
|
Free int64 `json:"free"`
|
2016-03-12 13:32:55 +01:00
|
|
|
}
|
2016-07-14 01:19:03 +02:00
|
|
|
|
2017-01-20 22:27:44 +01:00
|
|
|
// SwitchPort struct
|
2016-07-14 01:19:03 +02:00
|
|
|
type SwitchPort struct {
|
|
|
|
Speed uint32 `json:"speed"`
|
|
|
|
}
|
2018-05-06 00:11:01 +02:00
|
|
|
|
|
|
|
// ProcStats struct
|
|
|
|
type ProcStats struct {
|
|
|
|
CPU ProcStatsCPU `json:"cpu"`
|
|
|
|
Intr uint64 `json:"intr"`
|
|
|
|
ContextSwitches uint64 `json:"ctxt"`
|
|
|
|
SoftIRQ uint64 `json:"softirq"`
|
|
|
|
Processes uint64 `json:"processes"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProcStatsCPU struct
|
|
|
|
type ProcStatsCPU struct {
|
|
|
|
User uint64 `json:"user"`
|
|
|
|
Nice uint64 `json:"nice"`
|
|
|
|
System uint64 `json:"system"`
|
|
|
|
Idle uint64 `json:"idle"`
|
|
|
|
IOWait uint64 `json:"iowait"`
|
|
|
|
IRQ uint64 `json:"irq"`
|
|
|
|
SoftIRQ uint64 `json:"softirq"`
|
|
|
|
}
|