Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects DDM metrics from TP-Link switch
func NewCollector ¶
func NewCollector(snmpClient *SNMPClient, target string) *Collector
NewCollector creates a new DDM collector for a given target
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector
func (*Collector) CollectWithContext ¶
func (c *Collector) CollectWithContext(ctx context.Context, ch chan<- prometheus.Metric)
CollectWithContext collects metrics with a context for cancellation support
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector
type DDMMetrics ¶
type DDMMetrics struct {
// Strings (16 bytes each on 64-bit)
Port string
LAGMembership string // LAG/trunk membership (empty if not in LAG)
// Float64 values (8 bytes each)
Temperature float64
Voltage float64
BiasCurrent float64
TxPower float64
RxPower float64
// Temperature thresholds (Celsius)
TemperatureHighAlarm float64
TemperatureLowAlarm float64
TemperatureHighWarning float64
TemperatureLowWarning float64
// Voltage thresholds (Volts)
VoltageHighAlarm float64
VoltageLowAlarm float64
VoltageHighWarning float64
VoltageLowWarning float64
// Bias Current thresholds (mA)
BiasCurrentHighAlarm float64
BiasCurrentLowAlarm float64
BiasCurrentHighWarning float64
BiasCurrentLowWarning float64
// TX Power thresholds (dBm)
TxPowerHighAlarm float64
TxPowerLowAlarm float64
TxPowerHighWarning float64
TxPowerLowWarning float64
// RX Power thresholds (dBm)
RxPowerHighAlarm float64
RxPowerLowAlarm float64
RxPowerHighWarning float64
RxPowerLowWarning float64
// Int (8 bytes on 64-bit)
ShutdownPolicy int // Port shutdown policy: 0=none, 1=warning, 2=alarm
// Bools (1 byte each, but padded)
DDMEnabled bool // DDM monitoring enabled on port
DDMSupported bool // SFP supports DDM
LossOfSignal bool // SFP reports signal loss (LOS)
TxFault bool // SFP reports transmitter fault
}
DDMMetrics holds parsed DDM values for a port
type DDMResult ¶
type DDMResult struct {
SysName string
Metrics []DDMMetrics
}
DDMResult holds the complete result of a DDM scrape
type SNMPClient ¶
type SNMPClient struct {
// contains filtered or unexported fields
}
SNMPClient wraps gosnmp for TP-Link DDM queries
func NewSNMPClient ¶
func NewSNMPClient(target, community string) *SNMPClient
NewSNMPClient creates a new SNMP client
func (*SNMPClient) GetDDMMetrics ¶
func (c *SNMPClient) GetDDMMetrics(ctx context.Context) (*DDMResult, error)
GetDDMMetrics queries all DDM metrics and sysName from the switch
Click to show internal directories.
Click to hide internal directories.