Add shared_names config and port uptime tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2026-01-31 12:06:59 -08:00
parent df0c999284
commit d1b4de01e8
5 changed files with 56 additions and 4 deletions

View File

@@ -384,6 +384,7 @@ func (i *Interface) MarshalJSON() ([]byte, error) {
type InterfaceStats struct {
Speed uint64 `json:"speed,omitempty"`
Uptime uint64 `json:"uptime,omitempty"`
InErrors uint64 `json:"in_errors,omitempty"`
OutErrors uint64 `json:"out_errors,omitempty"`
InPktsRate float64 `json:"in_pkts_rate,omitempty"`
@@ -400,6 +401,7 @@ func round2(v float64) float64 {
func (s *InterfaceStats) MarshalJSON() ([]byte, error) {
type statsJSON struct {
Speed uint64 `json:"speed,omitempty"`
Uptime uint64 `json:"uptime,omitempty"`
InErrors uint64 `json:"in_errors,omitempty"`
OutErrors uint64 `json:"out_errors,omitempty"`
InPktsRate float64 `json:"in_pkts_rate,omitempty"`
@@ -410,6 +412,7 @@ func (s *InterfaceStats) MarshalJSON() ([]byte, error) {
}
return json.Marshal(statsJSON{
Speed: s.Speed,
Uptime: s.Uptime,
InErrors: s.InErrors,
OutErrors: s.OutErrors,
InPktsRate: round2(s.InPktsRate),