tc4400exporter

package module
v0.0.0-...-239dd1e Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 12 Imported by: 0

README

tc4400_exporter

Go Reference

Command tc4400_exporter provides a Prometheus exporter for the Technicolor TC4400 Cable Modem. MIT Licensed.

Config

listen:
  address: ":9130"
  metricspath: "/metrics"
modems:
  -
    address: "http://192.168.100.1"
    username: "user"
    password: "pass"
    timeout: "5s"
  -
    address: "http://10.0.100.1"
    username: "admin"
    password: "secret"
    timeout: "5s"

The tc4400_exporter's Prometheus scrape configuration (prometheus.yml) is configured in a similar way to the official Prometheus blackbox_exporter.

The targets list under static_configs should specify the addresses of any TC4400 modems which should be monitored by the exporter. The address of the tc4400_exporter itself must be specified in relabel_configs as well.

scrape_configs:
  - job_name: 'tc4400'
    static_configs:
      - targets:
        - 'http://192.168.100.1' # TC4400 modem.
        - 'http://10.0.100.1' # TC4400 modem.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: '127.0.0.1:9393' # tc4400_exporter.

Usage

$ ./tc4400_exporter -config.file ./config.yaml
2022/02/05 16:18:06 starting TC4400 exporter on ":9130"

The exporter is now running at http://localhost:9130/metrics?target=http://192.168.100.1 and notice the target query param matches one of the modems in the config to support running a single tc4400_exporter for multiple TC4400 modems.

Documentation

Index

Constants

View Source
const (
	SummaryURL  = "/info.html"
	SoftwareURL = "/cmswinfo.html"
	StatsURL    = "/statsifc.html"
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(dial func(addr string) (*Client, error)) http.Handler

NewHandler returns an http.Handler that serves Prometheus metrics for arris devices. The dial function specifies how to connect to a device with the specified address on each HTTP request.

Each HTTP request must contain a "target" query parameter which indicates the network address of the device which should be scraped for metrics. If no port is specified, the arris device default of 65001 will be used.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	RootURL    string
	Username   string
	Password   string
}

func (*Client) Info

func (c *Client) Info(ctx context.Context) (*Info, error)

func (*Client) Stats

func (c *Client) Stats(ctx context.Context) ([]InterfaceStats, error)

type Collector

type Collector struct {
	ModemInfo *prometheus.Desc

	UptimeSecondsTotal *prometheus.Desc

	RxBytesTotal   *prometheus.Desc
	RxPacketsTotal *prometheus.Desc
	RxErrorsTotal  *prometheus.Desc
	RxDropsTotal   *prometheus.Desc

	TxBytesTotal   *prometheus.Desc
	TxPacketsTotal *prometheus.Desc
	TxErrorsTotal  *prometheus.Desc
	TxDropsTotal   *prometheus.Desc
	// contains filtered or unexported fields
}

Collector is a prometheus.Collector for a TC4400 modem.

func NewCollector

func NewCollector(c *Client) *Collector

NewCollector constructs a collector using a device.

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

type Info

type Info struct {
	NetworkSpecification string
	SerialNumber         string
	BoardID              string
	BuildTimestamp       time.Time
	HardwareVersion      string
	SoftwareVersion      string
	LinuxVersion         string
	Uptime               time.Duration
	SystemTime           time.Time
	IPv4Addr             net.IP
	IPv6Addr             net.IP
	ModemHardwareAddr    net.HardwareAddr
	LANHardwareAddr      net.HardwareAddr
}

type InterfaceStats

type InterfaceStats struct {
	Name string

	RxBytes   int64
	RxPackets int64
	RxErrors  int64
	RxDrops   int64

	TxBytes   int64
	TxPackets int64
	TxErrors  int64
	TxDrops   int64
}

Directories

Path Synopsis
cmd
tc4400_exporter
Command arris_exporter implements a Prometheus exporter for Arris cable modem devices.
Command arris_exporter implements a Prometheus exporter for Arris cable modem devices.

Jump to

Keyboard shortcuts

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