Documentation ¶
Overview ¶
Example (ParsePkt) ¶
fmt.Printf("%.2f", parsePkt("1.61G Bytes"))
Output: 1728724336.64
Example (ParsePkt_2) ¶
fmt.Printf("%.2f", parsePkt("957.24M Bytes"))
Output: 1003738890.24
Example (ParseUptime) ¶
fmt.Println(parseDuration("05 Days,21 Hours,33 Minutes,44 Seconds"))
Output: 509624
Index ¶
- Variables
- type CMDocsisWAN
- type CMInit
- type Collector
- func (c *Collector) Collect(ch chan<- prom.Metric)
- func (c *Collector) CollectCMDocisWAN(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) CollectCMInit(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) CollectConnectInfo(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) CollectDonwstreamInfo(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) CollectInfo(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) CollectUpstreamInfo(wg *sync.WaitGroup, session *Session, ch chan<- prom.Metric)
- func (c *Collector) Describe(ch chan<- *prom.Desc)
- type ConnectInfo
- type ConnectType
- type DownstreamInfo
- type HitronRouter
- func (r *HitronRouter) CMDocsisWAN() (*CMDocsisWAN, error)
- func (r *HitronRouter) CMInit() (*CMInit, error)
- func (r *HitronRouter) ConnectInfo() ([]ConnectInfo, error)
- func (r *HitronRouter) DownstreamInfo() ([]DownstreamInfo, error)
- func (r *HitronRouter) Info() (*SysInfo, error)
- func (r *HitronRouter) Login() (*Session, error)
- func (r *HitronRouter) UpstreamInfo() ([]UpstreamInfo, error)
- type Modulation
- type Session
- type SysInfo
- type UpstreamInfo
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Modulation_16QAM Modulation = 0 Modulation_64QAM = 1 Modulation_256QAM = 2 Modulation_1024QAM = 3 Modulation_32QAM = 4 Modulation_128QAM = 5 Modulation_QPSK = 6 )
View Source
var ( StatusSuccess = "Success" NetworkAccessPermitted = "Permitted" ErrorBackingOff = errors.New("Backing off, because the router told us to do so") ErrorLoginAnswer = errors.New("Login response unknown") // Time to wait for a previous session to end before failing a scrape. WaitTimeout = time.Second * 3 // Timeout for individual requests. RequestTimeout = time.Second * 30 )
Functions ¶
This section is empty.
Types ¶
type CMDocsisWAN ¶
type CMDocsisWAN struct { Configname string `json:"Configname"` // Secret NetworkAccess string `json:"NetworkAccess"` // Permitted CmIpAddress string `json:"CmIpAddress"` // 10.40.123.123 CmNetMask string `json:"CmNetMask"` // 255.255.240.0 CmGateway string `json:"CmGateway"` // 10.40.123.1 CmIpLeaseDuration string `json:"CmIpLeaseDuration"` // 03 Days,00 Hours,00 Minutes,00 Seconds" }
type CMInit ¶
type CMInit struct { HwInit string `json:"hwInit"` // Success FindDownstream string `json:"findDownstream"` // Success Ranging string `json:"ranging"` // Success Dhcp string `json:"dhcp"` // Success TimeOfday string `json:"timeOfday"` // Secret DownloadCfg string `json:"downloadCfg"` // Success Registration string `json:"registration"` // Success EaeStatus string `json:"eaeStatus"` // Secret BpiStatus string `json:"bpiStatus"` // AUTH:authorized, TEK:operational NetworkAccess string `json:"networkAccess"` // Permitted TrafficStatus string `json:"trafficStatus"` // Enable }
type Collector ¶
type Collector struct {
Router *HitronRouter
}
func (*Collector) CollectCMDocisWAN ¶
func (*Collector) CollectCMInit ¶
func (*Collector) CollectConnectInfo ¶
func (*Collector) CollectDonwstreamInfo ¶
func (*Collector) CollectInfo ¶
func (*Collector) CollectUpstreamInfo ¶
type ConnectInfo ¶
type ConnectInfo struct { Id int `json:"id"` // 4 HostName string `json:"hostName"` // unknown IpAddr string `json:"ipAddr"` // 192.168.0.21 IpType string `json:"ipType"` // IPv4 MacAddr string `json:"macAddr"` // 68:DB:F5:F4:40:59 ConnectType ConnectType `json:"connectType"` // DHCP-IP / Self-assigned Interface string `json:"interface"` // Ethernet Online string `json:"online"` // active Comnum int `json:"comnum"` // 1 }
type ConnectType ¶
type ConnectType string
var ( DHCP ConnectType = "DHCP-IP" Static ConnectType = "Self-assigned" )
type DownstreamInfo ¶
type DownstreamInfo struct { PortId int `json:"portId,string"` // 1 Frequency int64 `json:"frequency,string"` // 474000000 Modulation Modulation `json:"modulation,string"` // 2 SignalStrength float64 `json:"signalStrength,string"` // 3.500 Snr float64 `json:"snr,string"` // 36.387 ChannelId int `json:"channelId,string"` // 1 }
type HitronRouter ¶
type HitronRouter struct { URL string Username string Password string // contains filtered or unexported fields }
func NewHitronRouter ¶
func NewHitronRouter(rawUrl, username, password string) *HitronRouter
func (*HitronRouter) CMDocsisWAN ¶
func (r *HitronRouter) CMDocsisWAN() (*CMDocsisWAN, error)
func (*HitronRouter) CMInit ¶
func (r *HitronRouter) CMInit() (*CMInit, error)
func (*HitronRouter) ConnectInfo ¶
func (r *HitronRouter) ConnectInfo() ([]ConnectInfo, error)
func (*HitronRouter) DownstreamInfo ¶
func (r *HitronRouter) DownstreamInfo() ([]DownstreamInfo, error)
func (*HitronRouter) Info ¶
func (r *HitronRouter) Info() (*SysInfo, error)
func (*HitronRouter) Login ¶
func (r *HitronRouter) Login() (*Session, error)
func (*HitronRouter) UpstreamInfo ¶
func (r *HitronRouter) UpstreamInfo() ([]UpstreamInfo, error)
type Modulation ¶
type Modulation int
type Session ¶
type Session struct {
*HitronRouter
}
type SysInfo ¶
type SysInfo struct { HwVersion string `json:"hwVersion"` // 1A SwVersion string `json:"swVersion"` // 4.12.34.567-XX-YYY SerialNumber string `json:"serialNumber"` // VCAP12345678 RfMac string `json:"rfMac"` // 68:8F:12:34:12:34 WanIp string `json:"wanIp"` // 84.12.34.56/21 AftrName string `json:"aftrName"` // AftrAddr string `json:"aftrAddr"` // DelegatedPrefix string `json:"delegatedPrefix"` // LanIPv6Addr string `json:"lanIPv6Addr"` // SystemUptime string `json:"systemUptime"` // 04 Days,22 Hours,23 Minutes,48 Seconds SystemTime string `json:"systemTime"` // Sat Apr 03, 2021, 14:16:41 Timezone string `json:"timezone"` // 1 WRecPkt string `json:"WRecPkt"` // 815.00M Bytes WSendPkt string `json:"WSendPkt"` // 527.44M Bytes LanIp string `json:"lanIp"` // 192.168.0.1/24 LRecPkt string `json:"LRecPkt"` // 779.79M Bytes LSendPkt string `json:"LSendPkt"` // 1.15G Bytes }
type UpstreamInfo ¶
type UpstreamInfo struct { PortId int `json:"portId,string"` // 1 Frequency int `json:"frequency,string"` // 51000199 Bandwidth int `json:"bandwidth,string"` // 6400000 ScdmaMode string `json:"scdmaMode"` // ATDMA SignalStrength float64 `json:"signalStrength,string"` // 47.500 ChannelId int `json:"channelId,string"` // 4 }
Click to show internal directories.
Click to hide internal directories.