bbox

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError added in v0.3.0

type APIError struct {
	Exception struct {
		Domain string `json:"domain"`
		Code   string `json:"code"`
		Errors []struct {
			Name   string `json:"name"`
			Reason string `json:"reason"`
		} `json:"errors"`
	} `json:"exception"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string, password string, logger log.Logger) (*Client, error)

func (*Client) Authenticate

func (client *Client) Authenticate() error

func (*Client) GetMetrics

func (client *Client) GetMetrics() (*Metrics, error)

GetMetrics retrieve available metrics for the API Router

type DNSAverage

type DNSAverage struct {
	DNS struct {
		NumberOfQueries float64 `json:""`
		Min             float64 `json:"min"`
		Max             float64 `json:"max"`
		Average         float64 `json:"avg"`
	} `json:"dns"`
}

type DNSMetrics

type DNSMetrics struct {
	Principal []DNSAverage `json:"principal"`
}

type DeviceCPU

type DeviceCPU struct {
	Device struct {
		CPU struct {
			Time struct {
				Total  float64 `json:"total"`
				User   float64 `json:"user"`
				Nice   float64 `json:"nice"`
				System float64 `json:"system"`
				IO     float64 `json:"io"`
				Idle   float64 `json:"idle"`
				Irq    float64 `json:"irq"`
			} `json:"time"`
			Process struct {
				Created float64 `json:"created"`
				Running float64 `json:"running"`
				Blocked float64 `json:"blocked"`
			} `json:"process"`
		} `json:"cpu"`
	} `json:"device"`
}

type DeviceInformations

type DeviceInformations struct {
	Device struct {
		Now           string  `json:"now"`
		Status        float64 `json:"status"`
		NumberOfBoots float64 `json:"number_of_boots"`
		ModelName     string  `json:"modelname"`
		Temperature   struct {
			Current float64 `json:"current"`
			Status  string  `json:"status"`
		} `json:"temperature"`
		Using struct {
			IPv4 int `json:"ipv4"`
			IPv6 int `json:"ipv6"`
			FTTH int `json:"ftth"`
			ADSL int `json:"adsl"`
			VDSL int `json:"vdsl"`
		} `json:"using"`
	} `json:"device"`
}

type DeviceMemory

type DeviceMemory struct {
	Device struct {
		Memory struct {
			Total  float64 `json:"total"`
			Free   float64 `json:"free"`
			Cached float64 `json:"cached"`
		} `json:"mem"`
	} `json:"device"`
}

type DeviceMetrics

type DeviceMetrics struct {
	Informations []DeviceInformations `json:"informations"`
	Memory       []DeviceMemory       `json:"device"`
	CPU          []DeviceCPU          `json:"cpu"`
}

type Ftth

type Ftth struct {
	Wan struct {
		Ftth struct {
			Mode  string `json:"mode"`
			State string `json:"state"`
		} `json:"ftth"`
	} `json:"wan"`
}

type FtthStatistics

type FtthStatistics []struct {
	Ftth Ftth `json:"ftth"`
}

type IPTVInformations

type IPTVInformations struct {
	IPTV []struct {
		// the IP Address of the multicast
		Address string `json:"address"`
		// the IP Address of receiver
		Ipaddress string `json:"ipaddress"`
		// image name of the logo
		Logo string `json:"logo"`
		// the offset for the logo
		// Logooffset string `json:"logooffset"`
		// The channel name
		Name string `json:"name"`
		// the channel number
		Number string `json:"number"`
		// Defines if the channel is really received or not
		Receipt string `json:"receipt"`
		// Channel Id in the epg
		Epgid string `json:"epgid"`
	} `json:"iptv"`
	Now string `json:"now"`
}

type IPTVMetrics

type IPTVMetrics struct {
	Informations []IPTVInformations `json:"informations"`
}

type LanDevice

type LanDevice struct {
	Hosts struct {
		List []LanHost `json:"list"`
	} `json:"hosts"`
}

type LanHost

type LanHost struct {
	ID         int           `json:"id"`
	Hostname   string        `json:"hostname"`
	Macaddress string        `json:"macaddress"`
	Ipaddress  string        `json:"ipaddress"`
	Type       string        `json:"type"`
	Link       string        `json:"link"`
	Devicetype string        `json:"devicetype"`
	Firstseen  string        `json:"firstseen"`
	Lastseen   interface{}   `json:"lastseen"`
	IP6Address []interface{} `json:"ip6address"`
	Ethernet   struct {
		Physicalport int    `json:"physicalport"`
		Logicalport  int    `json:"logicalport"`
		Speed        string `json:"speed"`
		Mode         string `json:"mode"`
	} `json:"ethernet"`
	Stb struct {
		Product string `json:"product"`
		Serial  string `json:"serial"`
	} `json:"stb,omitempty"`
	Wireless struct {
		Band       string      `json:"band"`
		Rssi0      interface{} `json:"rssi0"` // String or int ? "rssi0":"-76","rssi1":0,"rssi2":0
		Rssi1      interface{} `json:"rssi1"`
		Rssi2      interface{} `json:"rssi2"`
		Mcs        interface{} `json:"mcs"` // Same string or int ??
		Rate       interface{} `json:"rate"`
		Idle       interface{} `json:"idle"`
		Wexindex   interface{} `json:"wexindex"`
		Starealmac interface{} `json:"starealmac"`
	} `json:"wireless"`
	Plc struct {
		Rxphyrate        string `json:"rxphyrate"`
		Txphyrate        string `json:"txphyrate"`
		Associateddevice int    `json:"associateddevice"`
		Interface        int    `json:"interface"`
		Ethernetspeed    int    `json:"ethernetspeed"`
	} `json:"plc"`
	Lease           flexInt `json:"lease"`
	Active          int     `json:"active"`
	Parentalcontrol struct {
		Enable          int    `json:"enable"`
		Status          string `json:"status"`
		StatusRemaining int    `json:"statusRemaining"`
		StatusUntil     string `json:"statusUntil"`
	} `json:"parentalcontrol"`
	Ping struct {
		Average int `json:"average"`
	} `json:"ping"`
	Scan struct {
		Services []interface{} `json:"services"`
	} `json:"scan"`
}

type LanIPInformations

type LanIPInformations struct {
	Lan struct {
		IP struct {
			State      string        `json:"state"`
			Mtu        int           `json:"mtu"`
			Ipaddress  string        `json:"ipaddress"`
			IP6Enable  int           `json:"ip6enable"`
			IP6State   string        `json:"ip6state"`
			IP6Address []interface{} `json:"ip6address"`
			IP6Prefix  []interface{} `json:"ip6prefix"`
			Netmask    string        `json:"netmask"`
			Mac        string        `json:"mac"`
			Hostname   string        `json:"hostname"`
			Domain     string        `json:"domain"`
			Aliases    string        `json:"aliases"`
		} `json:"ip"`
		Switch struct {
			Ports []struct {
				ID         int    `json:"id"`
				State      string `json:"state"`
				LinkMode   string `json:"link_mode"`
				Blocked    int    `json:"blocked"`
				Flickering int    `json:"flickering"`
			} `json:"ports"`
		} `json:"switch"`
	} `json:"lan"`
}

type LanMetrics

type LanMetrics struct {
	IPInformations []LanIPInformations `json:"ip_informations"`
	Devices        []LanDevice         `json:"devices"`
	Statistics     []LanStatistics     `json:"statistics"`
}

type LanStatistics

type LanStatistics struct {
	Lan struct {
		Stats struct {
			Rx struct {
				Packets         flexInt `json:"packets"`
				Bytes           flexInt `json:"bytes"`
				Packetserrors   flexInt `json:"packetserrors"`
				Packetsdiscards flexInt `json:"packetsdiscards"`
			} `json:"rx"`
			Tx struct {
				Packets         flexInt `json:"packets"`
				Bytes           flexInt `json:"bytes"` // See: https://github.com/nlamirault/bbox_exporter/issues/1
				Packetserrors   flexInt `json:"packetserrors"`
				Packetsdiscards flexInt `json:"packetsdiscards"`
			} `json:"tx"`
		} `json:"stats"`
	} `json:"lan"`
}

LanStatistics represents statistics information of the Bbox LAN

type Metrics

type Metrics struct {
	Device    DeviceMetrics   `json:"device"`
	Wan       WanMetrics      `json:"wan"`
	Lan       LanMetrics      `json:"lan"`
	DNS       DNSMetrics      `json:"dns"`
	Services  ServicesMetrics `json:"services"`
	FtthState string          `json:"ftth_state"`
	Wireless  WirelessMetrics `json:"wireless"`
	IPTV      IPTVMetrics     `json:"iptv"`
}

Metrics define Bbox Prometheus metrics

type ServicesInformations

type ServicesInformations struct {
	Services struct {
		Now      string `json:"now"`
		Firewall struct {
			Status  int `json:"status"`
			Enable  int `json:"enable"`
			Nbrules int `json:"nbrules"`
		} `json:"firewall"`
		Dyndns struct {
			State   int `json:"state"`
			Enable  int `json:"enable"`
			Nbrules int `json:"nbrules"`
		} `json:"dyndns"`
		Dhcp struct {
			Status  int `json:"status"`
			Enable  int `json:"enable"`
			Nbrules int `json:"nbrules"`
		} `json:"dhcp"`
		Nat struct {
			Status  int `json:"status"`
			Enable  int `json:"enable"`
			Nbrules int `json:"nbrules"`
		} `json:"nat"`
		Gamermode struct {
			Status int `json:"status"`
			Enable int `json:"enable"`
		} `json:"gamermode"`
		Upnp struct {
			Igd struct {
				Status  int `json:"status"`
				Enable  int `json:"enable"`
				Nbrules int `json:"nbrules"`
			} `json:"igd"`
		} `json:"upnp"`
		Remote struct {
			Proxywol struct {
				Status int    `json:"status"`
				Enable int    `json:"enable"`
				IP     string `json:"ip"`
			} `json:"proxywol"`
			Admin struct {
				Status     int    `json:"status"`
				Enable     int    `json:"enable"`
				Port       int    `json:"port"`
				IP         string `json:"ip"`
				Duration   string `json:"duration"`
				Activable  int    `json:"activable"`
				IP6Address string `json:"ip6address"`
			} `json:"admin"`
		} `json:"remote"`
		Parentalcontrol struct {
			Enable int `json:"enable"`
		} `json:"parentalcontrol"`
		Wifischeduler struct {
			Enable int `json:"enable"`
		} `json:"wifischeduler"`
		Voipscheduler struct {
			Enable int `json:"enable"`
		} `json:"voipscheduler"`
		Notification struct {
			Enable int `json:"enable"`
		} `json:"notification"`
		Hotspot struct {
			Status int `json:"status"`
			Enable int `json:"enable"`
		} `json:"hotspot"`
		Usb struct {
			Samba struct {
				Status int `json:"status"`
				Enable int `json:"enable"`
			} `json:"samba"`
			Printer struct {
				Status int `json:"status"`
				Enable int `json:"enable"`
			} `json:"printer"`
			Dlna struct {
				Status int `json:"status"`
				Enable int `json:"enable"`
			} `json:"dlna"`
		} `json:"usb"`
	} `json:"services"`
}

type ServicesMetrics

type ServicesMetrics struct {
	Informations []ServicesInformations
}

type WanDiagsStatistics

type WanDiagsStatistics struct {
	Diags struct {
		DNS []struct {
			Min      float64 `json:"min"`
			Max      float64 `json:"max"`
			Average  float64 `json:"average"`
			Success  int     `json:"success"`
			Error    int     `json:"error"`
			Tries    int     `json:"tries"`
			Status   string  `json:"status"`
			Protocol string  `json:"protocol"`
		} `json:"dns"`
		Ping []struct {
			Min      float64 `json:"min"`
			Max      float64 `json:"max"`
			Average  float64 `json:"average"`
			Success  int     `json:"success"`
			Error    int     `json:"error"`
			Tries    int     `json:"tries"`
			Status   string  `json:"status"`
			Protocol string  `json:"protocol"`
		} `json:"ping"`
		HTTP []struct {
			Min      float64 `json:"min"`
			Max      float64 `json:"max"`
			Average  float64 `json:"average"`
			Success  int     `json:"success"`
			Error    int     `json:"error"`
			Tries    int     `json:"tries"`
			Status   string  `json:"status"`
			Protocol string  `json:"protocol"`
		} `json:"http"`
	} `json:"diags"`
}

type WanIPInformations

type WanIPInformations struct {
	Wan struct {
		Internet struct {
			State int `json:"state"`
		} `json:"internet"`
		Interface struct {
			ID      int `json:"id"`
			Default int `json:"default"`
			State   int `json:"state"`
		} `json:"interface"`
		IP struct {
			Address    string        `json:"address"`
			State      string        `json:"state"`
			Gateway    string        `json:"gateway"`
			Dnsservers string        `json:"dnsservers"`
			Subnet     string        `json:"subnet"`
			IP6State   string        `json:"ip6state"`
			IP6Address []interface{} `json:"ip6address"`
			IP6Prefix  []interface{} `json:"ip6prefix"`
			Mac        string        `json:"mac"`
			Mtu        int           `json:"mtu"`
		} `json:"ip"`
		Link struct {
			State string `json:"state"`
			Type  string `json:"type"`
		} `json:"link"`
	} `json:"wan"`
}

type WanIPStatistics

type WanIPStatistics struct {
	WAN struct {
		IP struct {
			Stats struct {
				Rx struct {
					Packets         flexInt `json:"packets"`
					Bytes           flexInt `json:"bytes"` // See: https://github.com/nlamirault/bbox_exporter/issues/1
					Packetserrors   flexInt `json:"packetserrors"`
					Packetsdiscards flexInt `json:"packetsdiscards"`
					Occupation      float64 `json:"occupation"`
					Bandwidth       flexInt `json:"bandwidth"`
					MaxBandwidth    flexInt `json:"maxBandwidth"`
				} `json:"rx"`
				Tx struct {
					Packets         flexInt `json:"packets"`
					Bytes           flexInt `json:"bytes"` // See: https://github.com/nlamirault/bbox_exporter/issues/1
					Packetserrors   flexInt `json:"packetserrors"`
					Packetsdiscards flexInt `json:"packetsdiscards"`
					Occupation      float64 `json:"occupation"`
					Bandwidth       flexInt `json:"bandwidth"`
					MaxBandwidth    flexInt `json:"maxBandwidth"`
				} `json:"tx"`
			} `json:"stats"`
		} `json:"ip"`
	} `json:"wan"`
}

type WanMetrics

type WanMetrics struct {
	IPInformations        []WanIPInformations  `json:"ip_informations"`
	IPStatistics          []WanIPStatistics    `json:"ip_statistics"`
	FtthStatistics        *FtthStatistics      `json:"ftth_statistics"`
	DiagnosticsStatistics []WanDiagsStatistics `json:"diagnostics"`
}

type WirelessMetrics

type WirelessMetrics struct {
	Wireless5GhzStatistics  []WirelessStatistics
	Wireless24GhzStatistics []WirelessStatistics
}

type WirelessStatistics

type WirelessStatistics struct {
	Wireless struct {
		SSID struct {
			ID    interface{} `json:"id"`
			Stats struct {
				Rx struct {
					Packets         flexInt `json:"packets"`
					Bytes           flexInt `json:"bytes"` // See: https://github.com/nlamirault/bbox_exporter/issues/1
					Packetserrors   flexInt `json:"packetserrors"`
					Packetsdiscards flexInt `json:"packetsdiscards"`
				} `json:"rx"`
				Tx struct {
					Packets         flexInt `json:"packets"`
					Bytes           flexInt `json:"bytes"` // See: https://github.com/nlamirault/bbox_exporter/issues/1
					Packetserrors   flexInt `json:"packetserrors"`
					Packetsdiscards flexInt `json:"packetsdiscards"`
				} `json:"tx"`
			} `json:"stats"`
		} `json:"ssid"`
	} `json:"wireless"`
}

WirelessStatistics represents statistics information of the Bbox WIFI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL