unifiapi

package
v0.0.0-...-57fec98 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBroker

type APIBroker struct {
	URL      string
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewAPIBroker

func NewAPIBroker(url string, username string, password string) *APIBroker

func (*APIBroker) CountryCodes

func (api *APIBroker) CountryCodes() string

func (*APIBroker) Device

func (api *APIBroker) Device() (DeviceAPIResponse, error)

func (*APIBroker) DeviceBasic

func (api *APIBroker) DeviceBasic() string

func (*APIBroker) Health

func (api *APIBroker) Health() string

func (*APIBroker) IsLoggedIn

func (api *APIBroker) IsLoggedIn() bool

func (*APIBroker) Login

func (api *APIBroker) Login() (int, error)

func (*APIBroker) Logout

func (api *APIBroker) Logout() (int, error)

func (*APIBroker) Stats

func (api *APIBroker) Stats() (StatsAPIResponse, error)

func (*APIBroker) Status

func (api *APIBroker) Status() string

func (*APIBroker) SysInfo

func (api *APIBroker) SysInfo() (SysInfoAPIResponse, error)

func (*APIBroker) VerifyConnectivity

func (api *APIBroker) VerifyConnectivity() bool

type Device

type Device struct {
	Name             string                 `json:"name"`
	IP               string                 `json:"ip"`
	MAC              string                 `json:"mac"`
	Version          string                 `json:"version"`
	KernelVersion    string                 `json:"kernel_version"`
	Temperatures     []Temperature          `json:"temperatures"`
	Storage          []Storage              `json:"storage"`
	Uptime           int                    `json:"uptime"`
	SysStats         SysStats               `json:"sys_stats"`
	SystemStats      SystemStats            `json:"system-stats"`
	StartupTimestamp int                    `json:"startup_timestamp"`
	UptimeStats      map[string]UptimeStats `json:"uptime_stats"`
	SpeedTestStatus  SpeedTestStatus        `json:"speedtest-status"`
	TransmitBytes    int                    `json:"tx_bytes"`
	ReceiveBytes     int                    `json:"rx_bytes"`
	Bytes            int                    `json:"bytes"`
}

type DeviceAPIResponse

type DeviceAPIResponse struct {
	Meta struct {
		RC string
	} `json:"meta"`

	Data []Device `json:"data"`
}

type LoginAPIErrorResponse

type LoginAPIErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type SpeedTestStatus

type SpeedTestStatus struct {
	Latency         int     `json:"latency"`
	RunDate         int     `json:"rundate"`
	RunTime         int     `json:"runtime"`
	SourceInterface string  `json:"source_interface"`
	StatusDownload  int     `json:"status_download"`
	StatusPing      int     `json:"status_ping"`
	StatusSummary   int     `json:"status_summary"`
	StatusUpload    int     `json:"status_upload"`
	XputDownload    float32 `json:"xput_download"`
	XputUpload      float32 `json:"xput_upload"`
}

type Stats

type Stats struct {
	SiteID              string `json:"site_id"`
	MAC                 string `json:"mac"`
	FirstSeen           int    `json:"first_seen"`
	LastSeen            int    `json:"last_seen"`
	Hostname            string `json:"hostname"`
	DisconnectTimestamp int    `json:"disconnect_timestamp"`
	FixedIP             string `json:"fixed_ip"`
	IP                  string `json:"ip"`
	Network             string `json:"network"`
	Uptime              int    `json:"uptime"`
	WiredTxBytes        int    `json:"wired-tx_bytes"`
	WiredRxBytes        int    `json:"wired-rx_bytes"`
	WiredTxPackets      int    `json:"wired-tx_packets"`
	WiredRxPackets      int    `json:"wired-rx_packets"`
}

type StatsAPIResponse

type StatsAPIResponse struct {
	Meta struct {
		RC string
	} `json:"meta"`

	Data []Stats `json:"data"`
}

type Storage

type Storage struct {
	MountPoint string `json:"mount_point"`
	Name       string `json:"name"`
	Size       int    `json:"size"`
	Type       string `json:"type"`
	Used       int    `json:"used"`
}

type SysInfoAPIResponse

type SysInfoAPIResponse struct {
	Meta struct {
		RC string
	} `json:"meta"`

	Data []SystemInfo `json:"data"`
}

type SysStats

type SysStats struct {
	LoadAvg1  float32 `json:"loadavg_1,string"`
	LoadAvg15 float32 `json:"loadavg_15,string"`
	LoadAvg5  float32 `json:"loadavg_5,string"`
	MemBuffer int     `json:"mem_buffer"`
	MemTotal  int     `json:"mem_total"`
	MemUsed   int     `json:"mem_used"`
}

type SystemInfo

type SystemInfo struct {
	Version          string   `json:"version"`
	UDMVersion       string   `json:"udm_version"`
	Uptime           int      `json:"uptime"`
	IpAddresses      []string `json:"ip_addrs"`
	UpdateAvailable  bool     `json:"update_available"`
	UpdateDownloaded bool     `json:"update_downloaded"`
}

type SystemStats

type SystemStats struct {
	CPU    float32 `json:"cpu,string"`
	Mem    float32 `json:"mem,string"`
	Uptime int     `json:"uptime,string"`
}

type Temperature

type Temperature struct {
	Name  string  `json:"name"`
	Type  string  `json:"type"`
	Value float32 `json:"value"`
}

type UDMProCollector

type UDMProCollector struct {
	Broker *APIBroker
}

func NewUDMProCollector

func NewUDMProCollector(broker *APIBroker) *UDMProCollector

func (*UDMProCollector) Collect

func (collector *UDMProCollector) Collect(ch chan<- prometheus.Metric)

func (*UDMProCollector) CollectDeviceMetrics

func (collector *UDMProCollector) CollectDeviceMetrics(ch chan<- prometheus.Metric)

func (*UDMProCollector) Describe

func (collector *UDMProCollector) Describe(ch chan<- *prometheus.Desc)

type UptimeStats

type UptimeStats struct {
	Availability   float32 `json:"availability"`
	LatencyAverage int     `json:"latency_average"`
	TimePeriod     int     `json:"time_period"`
	Downtime       int     `json:"downtime"`
}

Jump to

Keyboard shortcuts

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