Skip to content

Commit

Permalink
Merge bd62a0b into 003c44f
Browse files Browse the repository at this point in the history
  • Loading branch information
corny committed Apr 19, 2018
2 parents 003c44f + bd62a0b commit 85a8270
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions data/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package data
type Statistics struct {
NodeID string `json:"node_id"`
Clients Clients `json:"clients"`
DHCP *DHCP `json:"dhcp"`
RootFsUsage float64 `json:"rootfs_usage,omitempty"`
LoadAverage float64 `json:"loadavg,omitempty"`
Memory Memory `json:"memory,omitempty"`
Expand Down Expand Up @@ -64,6 +65,24 @@ type Clients struct {
Total uint32 `json:"total"`
}

// DHCP struct
type DHCP struct {
// counters
Decline int64 `json:"dhcp_decline"`
Offer int64 `json:"dhcp_offer"`
Ack int64 `json:"dhcp_ack"`
Nak int64 `json:"dhcp_nak"`
Request int64 `json:"dhcp_request"`
Discover int64 `json:"dhcp_discover"`
Inform int64 `json:"dhcp_inform"`
Release int64 `json:"dhcp_release"`

// gauge
LeasesCurrent int64 `json:"leases_current"`
LeasesAllocated int64 `json:"leases_allocated"`
LeasesPruned int64 `json:"leases_pruned"`
}

// Memory struct
type Memory struct {
Cached int64 `json:"cached"`
Expand Down
15 changes: 15 additions & 0 deletions database/influxdb/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ func (conn *Connection) InsertNode(node *runtime.Node) {
fields["traffic.mgmt_tx.packets"] = t.Packets
}

if dhcp := stats.DHCP; dhcp != nil {
fields["dhcp.decline"] = dhcp.Decline
fields["dhcp.offer"] = dhcp.Offer
fields["dhcp.ack"] = dhcp.Ack
fields["dhcp.nak"] = dhcp.Nak
fields["dhcp.request"] = dhcp.Request
fields["dhcp.discover"] = dhcp.Discover
fields["dhcp.inform"] = dhcp.Inform
fields["dhcp.release"] = dhcp.Release

fields["dhcp.leases.current"] = dhcp.LeasesCurrent
fields["dhcp.leases.allocated"] = dhcp.LeasesAllocated
fields["dhcp.leases.pruned"] = dhcp.LeasesPruned
}

for _, airtime := range stats.Wireless {
suffix := airtime.FrequencyName()
fields["airtime"+suffix+".chan_util"] = airtime.ChanUtil
Expand Down

0 comments on commit 85a8270

Please sign in to comment.