feat(inputs.fritzbox): Add plugin (#16390)
This commit is contained in:
parent
61f0f039f2
commit
1406f41ce8
|
|
@ -28,7 +28,6 @@ Pull requests welcome.
|
|||
- [db2](https://github.com/bonitoo-io/telegraf-input-db2) - Gather the statistic data from DB2 RDBMS
|
||||
- [apt](https://github.com/x70b1/telegraf-apt) - Check Debian for package updates.
|
||||
- [knot](https://github.com/x70b1/telegraf-knot) - Collect stats from Knot DNS.
|
||||
- [fritzbox](https://github.com/hdecarne-github/fritzbox-telegraf-plugin) - Gather statistics from [FRITZ!Box](https://avm.de/produkte/fritzbox/) router and repeater
|
||||
- [linux-psi-telegraf-plugin](https://github.com/gridscale/linux-psi-telegraf-plugin) - Gather pressure stall information ([PSI](https://facebookmicrosites.github.io/psi/)) from the Linux Kernel
|
||||
- [hwinfo](https://github.com/zachstence/hwinfo-telegraf-plugin) - Gather Windows system hardware information from [HWiNFO](https://www.hwinfo.com/)
|
||||
- [libvirt](https://gitlab.com/warrenio/tools/telegraf-input-libvirt) - Gather libvirt domain stats, based on a historical Telegraf implementation [libvirt](https://libvirt.org/)
|
||||
|
|
|
|||
|
|
@ -373,6 +373,7 @@ following works:
|
|||
- github.com/stretchr/testify [MIT License](https://github.com/stretchr/testify/blob/master/LICENSE)
|
||||
- github.com/tdrn-org/go-hue [MIT License](https://github.com/tdrn-org/go-log/blob/main/LICENSE)
|
||||
- github.com/tdrn-org/go-nsdp [MIT License](https://github.com/tdrn-org/go-nsdp/blob/main/LICENSE)
|
||||
- github.com/tdrn-org/go-tr064 [Apache License 2.0](https://github.com/tdrn-org/go-tr064/blob/main/LICENSE)
|
||||
- github.com/testcontainers/testcontainers-go [MIT License](https://github.com/testcontainers/testcontainers-go/blob/main/LICENSE)
|
||||
- github.com/thomasklein94/packer-plugin-libvirt [Mozilla Public License 2.0](https://github.com/thomasklein94/packer-plugin-libvirt/blob/main/LICENSE)
|
||||
- github.com/tidwall/gjson [MIT License](https://github.com/tidwall/gjson/blob/master/LICENSE)
|
||||
|
|
|
|||
1
go.mod
1
go.mod
|
|
@ -482,6 +482,7 @@ require (
|
|||
github.com/stoewer/go-strcase v1.3.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/tdrn-org/go-nsdp v0.5.0
|
||||
github.com/tdrn-org/go-tr064 v0.2.2
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/tinylru v1.2.1 // indirect
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -2296,6 +2296,8 @@ github.com/tdrn-org/go-hue v0.3.0 h1:ywIlfTx9lcDp+n9XyGNY/9mUihW82lsWUanTzvdfeMc
|
|||
github.com/tdrn-org/go-hue v0.3.0/go.mod h1:KUnPy2lGoP43ygNoCg6jVEhf8h5fpRn0Esjxq9syCnU=
|
||||
github.com/tdrn-org/go-nsdp v0.5.0 h1:bOs8qABaP/BSQlWeziZx9gjGkC2ld9UQek9p5w6PvdY=
|
||||
github.com/tdrn-org/go-nsdp v0.5.0/go.mod h1:zp7CxiCPcyXHo+s6tn+wrNBr1qQe1G/hOh/FybM5xiM=
|
||||
github.com/tdrn-org/go-tr064 v0.2.2 h1:rDybEK1m2xfV5QPWHtnIJOt+xG4GFSkQSwA6FS2bQC4=
|
||||
github.com/tdrn-org/go-tr064 v0.2.2/go.mod h1:P2WWUiBcXDGOo+sqJ4hWn4YXYH9kWaYjZo74EdFDSS0=
|
||||
github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0=
|
||||
github.com/testcontainers/testcontainers-go v0.35.0 h1:uADsZpTKFAtp8SLK+hMwSaa+X+JiERHtd4sQAFmXeMo=
|
||||
github.com/testcontainers/testcontainers-go v0.35.0/go.mod h1:oEVBj5zrfJTrgjwONs1SsRbnBtH9OKl+IGl3UMcr2B4=
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
//go:build !custom || inputs || inputs.fritzbox
|
||||
|
||||
package all
|
||||
|
||||
import _ "github.com/influxdata/telegraf/plugins/inputs/fritzbox" // register plugin
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
# Fritzbox Input Plugin
|
||||
|
||||
This plugin gathers status information from [AVM][avm] devices (routers,
|
||||
repeaters, etc) using the device's [TR-064][tr064] interface.
|
||||
|
||||
⭐ Telegraf v1.35.0
|
||||
🏷️ network, iot
|
||||
💻 all
|
||||
|
||||
[avm]: https://en.avm.de/
|
||||
[tr064]: https://avm.de/service/schnittstellen/
|
||||
|
||||
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
||||
|
||||
In addition to the plugin-specific configuration settings, plugins support
|
||||
additional global and plugin configuration settings. These settings are used to
|
||||
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
||||
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
||||
|
||||
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
||||
|
||||
## Configuration
|
||||
|
||||
```toml @sample.conf
|
||||
# Gather fritzbox status
|
||||
[[inputs.fritzbox]]
|
||||
## URLs of the devices to query including login credentials
|
||||
urls = [ "http://user:password@fritz.box:49000/" ]
|
||||
|
||||
## The information to collect (see README for further details).
|
||||
# collect = [
|
||||
# "device",
|
||||
# "wan",
|
||||
# "ppp",
|
||||
# "dsl",
|
||||
# "wlan",
|
||||
# ]
|
||||
|
||||
## The http timeout to use.
|
||||
# timeout = "10s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
```
|
||||
|
||||
### Collect options
|
||||
|
||||
The following collect options are available:
|
||||
|
||||
`device` : Collect device information like model name, SW version, uptime etc
|
||||
for the configured devices. Will create `fritzbox_device` metrics.
|
||||
|
||||
`wan` : Collect generic WAN connection status like bit rates, transferred
|
||||
bytes for the configured devices. Will create `fritzbox_wan`metrics.
|
||||
|
||||
`ppp` : Collect PPP connection parameters like bit rates, uptime for the
|
||||
configured devices. Will create `fritzbox_ppp` metrics.
|
||||
|
||||
`dsl` : Collect DSL line status and statistics for the configured devices.
|
||||
Will create `fritzbox_dsl` metrics.
|
||||
|
||||
`wlan` : Collect status and number of associated devices for all WLANs.
|
||||
Will create `fritzbox_wlan` metrics.
|
||||
|
||||
`hosts` : Collect detailed information of the mesh network including
|
||||
connected nodes, there role in the network as well as their connection
|
||||
bandwidth. Will create `fritzbox_hosts` metrics.
|
||||
|
||||
> [!NOTE] Collecting `hosts` metrics is time consuming and generates
|
||||
> very detailed data. If you activate this option, consider increasing
|
||||
> the plugin's query interval to avoid interval overruns and to minimize
|
||||
> the amount of collected data.
|
||||
|
||||
## Metrics
|
||||
|
||||
By default field names are directly derived from the corresponding [interface
|
||||
specification][tr064].
|
||||
|
||||
- `fritzbox_device`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- fields
|
||||
- `uptime` (uint) - Device's uptime in seconds.
|
||||
- `model_name` (string) - Device's model name.
|
||||
- `serial_number` (string) - Device's serial number.
|
||||
- `hardware_version` (string) - Device's hardware version.
|
||||
- `software_version` (string) - Device's software version.
|
||||
- `fritzbox_wan`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- fields
|
||||
- `layer1_upstream_max_bit_rate` (uint) - The WAN interface's maximum upstream bit rate (bits/sec)
|
||||
- `layer1_downstream_max_bit_rate` (uint) - The WAN interface's maximum downstream bit rate (bits/sec)
|
||||
- `upstream_current_max_speed` (uint) - The WAN interface's current maximum upstream transfer rate (bytes/sec)
|
||||
- `downstream_current_max_speed` (uint) - The WAN interface's current maximum downstream data rate (bytes/sec)
|
||||
- `total_bytes_sent` (uint) - The total number of bytes sent via the WAN interface (bytes)
|
||||
- `total_bytes_received` (uint) - The total number of bytes received via the WAN interface (bytes)
|
||||
- `fritzbox_ppp`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- fields
|
||||
- `uptime` (uint) - The current uptime of the PPP connection in seconds
|
||||
- `upstream_max_bit_rate` (uint) - The current maximum upstream bit rate negotiated for the PPP connection (bits/sec)
|
||||
- `downstream_max_bit_rate` (uint) - The current maximum downstream bit rate negotiated for the PPP connection (bits/sec)
|
||||
- `fritzbox_dsl`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- `status` - The status of the DLS line (Up or Down)
|
||||
- fields
|
||||
- `upstream_curr_rate` (uint) - Current DSL upstream rate (kilobits/sec)
|
||||
- `downstream_curr_rate` (uint) - Current DSL downstream rate (kilobits/sec)
|
||||
- `upstream_max_rate` (uint) - Maximum DSL upstream rate (kilobits/sec)
|
||||
- `downstream_max_rate` (uint) - Maximum DSL downstream rate (kilobits/sec)
|
||||
- `upstream_noise_margin` (uint) - Upstream noise margin (db)
|
||||
- `downstream_noise_margin` (uint) - Downstream noise margin (db)
|
||||
- `upstream_attenuation` (uint) - Upstream attenuation (db)
|
||||
- `downstream_attenuation` (uint) - Downstream attenuation (db)
|
||||
- `upstream_power` (uint) - Upstream power
|
||||
- `downstream_power` (uint) - Downstream power
|
||||
- `receive_blocks` (uint) - Received blocks
|
||||
- `transmit_blocks` (uint) - Transmitted blocks
|
||||
- `cell_delin` (uint) - Cell delineation count
|
||||
- `link_retrain` (uint) - Link retrains
|
||||
- `init_errors` (uint) - Initialization errors
|
||||
- `init_timeouts` (uint) - Initialization timeouts
|
||||
- `loss_of_framing` (uint) - Loss of frame errors
|
||||
- `errored_secs` (uint) - Continuous seconds with errors
|
||||
- `severly_errored_secs` (uint) - Continuous seconds with severe errors
|
||||
- `fec_errors` (uint) - Local (Modem) FEC (Forward Error Correction) errors
|
||||
- `atuc_fec_errors` (uint) - Remote (DSLAM) FEC (Forward Error Correction) errors
|
||||
- `hec_errors` (uint) - Local (Modem) HEC (Header Error Control) errors
|
||||
- `atuc_hec_errors` (uint) - Remote (DSLAM) HEC (Header Error Control) errors
|
||||
- `crc_errors` (uint) - Local (Modem) CRC (Cyclic Redundancy Check) error
|
||||
- `atuc_crc_errors` (uint) - Remote (DSLAM) CRC (Cyclic Redundancy Check) errors
|
||||
- `fritzbox_wlan`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- `wlan` - The WLAN SSID (name)
|
||||
- `channel` - The channel used by this WLAN
|
||||
- `band` - The band (in MHz) used by this WLAN
|
||||
- `status` - The status of the WLAN line (Up or Down)
|
||||
- fields
|
||||
- `total_associations` (uint) - The number of devices connected to this WLAN.
|
||||
- `fritzbox_hosts`
|
||||
- tags
|
||||
- `source` - The name of the device (this metric has been queried from)
|
||||
- `service` - The service id used to query this metric
|
||||
- `node` - The name of the node connected to the mesh network
|
||||
- `node_role` - The node's role ("master" = mesh master, "slave" = mesh slave, "client") in the network
|
||||
- `node_ap` - The name of the access point this node is connected to
|
||||
- `node_ap_role` - The access point's role ("master" = mesh master, "slave" = mesh slave, never "client") in the network
|
||||
- `link_type` - The link type ("WLAN" or "LAN") of the peer connection
|
||||
- `link_name` - The link name of the connection
|
||||
- fields
|
||||
- `max_data_rate_tx` (uint) - The connection's maximum transmit rate (kilobits/sec)
|
||||
- `max_data_rate_rx` (uint) - The connection's maximum receive rate (kilobits/sec)
|
||||
- `cur_data_rate_tx` (uint) - The connection's maximum transmit rate (kilobits/sec)
|
||||
- `cur_data_rate_rx` (uint) - The connection's current receive rate (kilobits/sec)
|
||||
|
||||
## Example Output
|
||||
|
||||
```text
|
||||
fritzbox_device,service=DeviceInfo1,source=fritz.box uptime=2058438i,model_name="Mock 1234",serial_number="123456789",hardware_version="Mock 1234",software_version="1.02.03" 1737003520174438000
|
||||
|
||||
fritzbox_wan,service=WANCommonInterfaceConfig1,source=fritz.box layer1_upstream_max_bit_rate=48816000i,layer1_downstream_max_bit_rate=253247000i,upstream_current_max_speed=511831i,downstream_current_max_speed=1304268i,total_bytes_sent=129497283207i,total_bytes_received=554484531337i 1737003587690504000
|
||||
|
||||
fritzbox_ppp,service=WANPPPConnection1,source=fritz.box uptime=369434i,upstream_max_bit_rate=44213433i,downstream_max_bit_rate=68038668i 1737003622308149000
|
||||
|
||||
fritzbox_dsl,service=WANDSLInterfaceConfig1,source=fritz.box,status=Up downstream_curr_rate=249065i,downstream_max_rate=249065i,downstream_power=513i,init_timeouts=0i,atuc_crc_errors=13i,errored_secs=25i,atuc_hec_errors=0i,upstream_noise_margin=80i,downstream_noise_margin=60i,downstream_attenuation=140i,receive_blocks=490282831i,transmit_blocks=254577751i,init_errors=0i,crc_errors=53i,fec_errors=0i,hec_errors=0i,upstream_max_rate=48873i,upstream_attenuation=80i,upstream_power=498i,cell_delin=0i,link_retrain=2i,loss_of_framing=0i,upstream_curr_rate=46719i,severly_errored_secs=0i,atuc_fec_errors=0i 1737003645769642000
|
||||
|
||||
fritzbox_wlan,band=2400,channel=13,service=WLANConfiguration1,source=fritz.box,ssid=MOCK1234,status=Up total_associations=11i 1737003673561198000
|
||||
|
||||
fritzbox_hosts,node=device#17,node_ap=device#1,node_ap_role=master,node_role=slave,link_name=AP:2G:0,link_type=WLAN,service=Hosts1,source=fritz.box cur_data_rate_tx=216000i,cur_data_rate_rx=216000i,max_data_rate_tx=216000i,max_data_rate_rx=216000i 1737003707257394000
|
||||
fritzbox_hosts,node=device#24,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=LAN:1,link_type=LAN,service=Hosts1,source=fritz.box max_data_rate_tx=1000000i,max_data_rate_rx=1000000i,cur_data_rate_tx=0i,cur_data_rate_rx=0i 1737003707257248000
|
||||
```
|
||||
|
|
@ -0,0 +1,413 @@
|
|||
//go:generate ../../../tools/readme_config_includer/generator
|
||||
package fritzbox
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/tdrn-org/go-tr064"
|
||||
"github.com/tdrn-org/go-tr064/mesh"
|
||||
"github.com/tdrn-org/go-tr064/services/igddesc/igdicfg"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/deviceinfo"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/hosts"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/wancommonifconfig"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/wandslifconfig"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/wanpppconn"
|
||||
"github.com/tdrn-org/go-tr064/services/tr64desc/wlanconfig"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/config"
|
||||
"github.com/influxdata/telegraf/plugins/common/tls"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
//go:embed sample.conf
|
||||
var sampleConfig string
|
||||
|
||||
type serviceHandlerFunc func(telegraf.Accumulator, *tr064.Client, tr064.ServiceDescriptor) error
|
||||
|
||||
type Fritzbox struct {
|
||||
URLs []string `toml:"urls"`
|
||||
Collect []string `toml:"collect"`
|
||||
Timeout config.Duration `toml:"timeout"`
|
||||
Log telegraf.Logger `toml:"-"`
|
||||
tls.ClientConfig
|
||||
|
||||
deviceClients []*tr064.Client
|
||||
serviceHandlers map[string]serviceHandlerFunc
|
||||
}
|
||||
|
||||
func (*Fritzbox) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (f *Fritzbox) Init() error {
|
||||
// No need to run without any devices configured
|
||||
if len(f.URLs) == 0 {
|
||||
return errors.New("no device URLs configured")
|
||||
}
|
||||
|
||||
// Use default collect options if nothing is configured
|
||||
if len(f.Collect) == 0 {
|
||||
f.Collect = []string{"device", "wan", "ppp", "dsl", "wlan"}
|
||||
}
|
||||
|
||||
// Setup TLS
|
||||
tlsConfig, err := f.TLSConfig()
|
||||
if err != nil {
|
||||
return fmt.Errorf("initializing TLS configuration failed: %w", err)
|
||||
}
|
||||
|
||||
// Initialize the device clients
|
||||
debug := f.Log.Level().Includes(telegraf.Trace)
|
||||
f.deviceClients = make([]*tr064.Client, 0, len(f.URLs))
|
||||
for _, rawUrl := range f.URLs {
|
||||
parsedUrl, err := url.Parse(rawUrl)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing device URL %q failed: %w", rawUrl, err)
|
||||
}
|
||||
client := tr064.NewClient(parsedUrl)
|
||||
client.Debug = debug
|
||||
client.Timeout = time.Duration(f.Timeout)
|
||||
client.TlsConfig = tlsConfig
|
||||
f.deviceClients = append(f.deviceClients, client)
|
||||
}
|
||||
|
||||
// Initialize the service handlers
|
||||
f.serviceHandlers = make(map[string]serviceHandlerFunc, len(f.Collect))
|
||||
for _, c := range f.Collect {
|
||||
switch c {
|
||||
case "device":
|
||||
f.serviceHandlers[deviceinfo.ServiceShortType] = f.gatherDeviceInfo
|
||||
case "wan":
|
||||
f.serviceHandlers[wancommonifconfig.ServiceShortType] = f.gatherWanInfo
|
||||
case "ppp":
|
||||
f.serviceHandlers[wanpppconn.ServiceShortType] = f.gatherPppInfo
|
||||
case "dsl":
|
||||
f.serviceHandlers[wandslifconfig.ServiceShortType] = f.gatherDslInfo
|
||||
case "wlan":
|
||||
f.serviceHandlers[wlanconfig.ServiceShortType] = f.gatherWlanInfo
|
||||
case "hosts":
|
||||
f.serviceHandlers[hosts.ServiceShortType] = f.gatherHostsInfo
|
||||
default:
|
||||
return fmt.Errorf("invalid service %q in collect parameter", c)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
for _, deviceClient := range f.deviceClients {
|
||||
wg.Add(1)
|
||||
// Pass deviceClient as parameter to avoid any race conditions
|
||||
go func(client *tr064.Client) {
|
||||
defer wg.Done()
|
||||
f.gatherDevice(acc, client)
|
||||
}(deviceClient)
|
||||
}
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherDevice(acc telegraf.Accumulator, deviceClient *tr064.Client) {
|
||||
services, err := deviceClient.Services(tr064.DefaultServiceSpec)
|
||||
if err != nil {
|
||||
acc.AddError(err)
|
||||
return
|
||||
}
|
||||
for _, service := range services {
|
||||
serviceHandler, exists := f.serviceHandlers[service.ShortType()]
|
||||
// If no serviceHandler has been setup during Init(), we ignore this service.
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
acc.AddError(serviceHandler(acc, deviceClient, service))
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherDeviceInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := deviceinfo.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
info := &deviceinfo.GetInfoResponse{}
|
||||
if err := serviceClient.GetInfo(info); err != nil {
|
||||
return fmt.Errorf("failed to query device info: %w", err)
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"uptime": info.NewUpTime,
|
||||
"model_name": info.NewModelName,
|
||||
"serial_number": info.NewSerialNumber,
|
||||
"hardware_version": info.NewHardwareVersion,
|
||||
"software_version": info.NewSoftwareVersion,
|
||||
}
|
||||
acc.AddFields("fritzbox_device", fields, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherWanInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := wancommonifconfig.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
commonLinkProperties := &wancommonifconfig.GetCommonLinkPropertiesResponse{}
|
||||
if err := serviceClient.GetCommonLinkProperties(commonLinkProperties); err != nil {
|
||||
return fmt.Errorf("failed to query link properties: %w", err)
|
||||
}
|
||||
// Prefer igdicfg service over wancommonifconfig service for total bytes stats, because igdicfg supports uint64 counters
|
||||
igdServices, err := deviceClient.ServicesByType(tr064.IgdServiceSpec, igdicfg.ServiceShortType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to lookup IGD service: %w", err)
|
||||
}
|
||||
var totalBytesSent uint64 = 0
|
||||
var totalBytesReceived uint64 = 0
|
||||
if len(igdServices) > 0 {
|
||||
igdServiceClient := &igdicfg.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: igdServices[0],
|
||||
}
|
||||
addonInfos := &igdicfg.GetAddonInfosResponse{}
|
||||
if err = igdServiceClient.GetAddonInfos(addonInfos); err != nil {
|
||||
return fmt.Errorf("failed to query addon info: %w", err)
|
||||
}
|
||||
totalBytesSent, err = strconv.ParseUint(addonInfos.NewX_AVM_DE_TotalBytesSent64, 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse total bytes sent: %w", err)
|
||||
}
|
||||
totalBytesReceived, err = strconv.ParseUint(addonInfos.NewX_AVM_DE_TotalBytesReceived64, 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse total bytes received: %w", err)
|
||||
}
|
||||
} else {
|
||||
// Fall back to wancommonifconfig service in case igdicfg is not available (only uint32 based)
|
||||
totalBytesSentResponse := &wancommonifconfig.GetTotalBytesSentResponse{}
|
||||
if err = serviceClient.GetTotalBytesSent(totalBytesSentResponse); err != nil {
|
||||
return fmt.Errorf("failed to query bytes sent: %w", err)
|
||||
}
|
||||
totalBytesSent = uint64(totalBytesSentResponse.NewTotalBytesSent)
|
||||
totalBytesReceivedResponse := &wancommonifconfig.GetTotalBytesReceivedResponse{}
|
||||
if err = serviceClient.GetTotalBytesReceived(totalBytesReceivedResponse); err != nil {
|
||||
return fmt.Errorf("failed to query bytes received: %w", err)
|
||||
}
|
||||
totalBytesReceived = uint64(totalBytesReceivedResponse.NewTotalBytesReceived)
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"layer1_upstream_max_bit_rate": commonLinkProperties.NewLayer1UpstreamMaxBitRate,
|
||||
"layer1_downstream_max_bit_rate": commonLinkProperties.NewLayer1DownstreamMaxBitRate,
|
||||
"upstream_current_max_speed": commonLinkProperties.NewX_AVM_DE_UpstreamCurrentMaxSpeed,
|
||||
"downstream_current_max_speed": commonLinkProperties.NewX_AVM_DE_DownstreamCurrentMaxSpeed,
|
||||
"total_bytes_sent": totalBytesSent,
|
||||
"total_bytes_received": totalBytesReceived,
|
||||
}
|
||||
acc.AddFields("fritzbox_wan", fields, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherPppInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := wanpppconn.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
info := &wanpppconn.GetInfoResponse{}
|
||||
if err := serviceClient.GetInfo(info); err != nil {
|
||||
return fmt.Errorf("failed to query PPP info: %w", err)
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"uptime": info.NewUptime,
|
||||
"upstream_max_bit_rate": info.NewUpstreamMaxBitRate,
|
||||
"downstream_max_bit_rate": info.NewDownstreamMaxBitRate,
|
||||
}
|
||||
acc.AddFields("fritzbox_ppp", fields, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherDslInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := wandslifconfig.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
info := &wandslifconfig.GetInfoResponse{}
|
||||
if err := serviceClient.GetInfo(info); err != nil {
|
||||
return fmt.Errorf("failed to query DSL info: %w", err)
|
||||
}
|
||||
statisticsTotal := &wandslifconfig.GetStatisticsTotalResponse{}
|
||||
if info.NewStatus == "Up" {
|
||||
if err := serviceClient.GetStatisticsTotal(statisticsTotal); err != nil {
|
||||
return fmt.Errorf("failed to query DSL statistics: %w", err)
|
||||
}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
"status": info.NewStatus,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"upstream_curr_rate": info.NewUpstreamCurrRate,
|
||||
"downstream_curr_rate": info.NewDownstreamCurrRate,
|
||||
"upstream_max_rate": info.NewUpstreamMaxRate,
|
||||
"downstream_max_rate": info.NewDownstreamMaxRate,
|
||||
"upstream_noise_margin": info.NewUpstreamNoiseMargin,
|
||||
"downstream_noise_margin": info.NewDownstreamNoiseMargin,
|
||||
"upstream_attenuation": info.NewUpstreamAttenuation,
|
||||
"downstream_attenuation": info.NewDownstreamAttenuation,
|
||||
"upstream_power": info.NewUpstreamPower,
|
||||
"downstream_power": info.NewDownstreamPower,
|
||||
"receive_blocks": statisticsTotal.NewReceiveBlocks,
|
||||
"transmit_blocks": statisticsTotal.NewTransmitBlocks,
|
||||
"cell_delin": statisticsTotal.NewCellDelin,
|
||||
"link_retrain": statisticsTotal.NewLinkRetrain,
|
||||
"init_errors": statisticsTotal.NewInitErrors,
|
||||
"init_timeouts": statisticsTotal.NewInitTimeouts,
|
||||
"loss_of_framing": statisticsTotal.NewLossOfFraming,
|
||||
"errored_secs": statisticsTotal.NewErroredSecs,
|
||||
"severly_errored_secs": statisticsTotal.NewSeverelyErroredSecs,
|
||||
"fec_errors": statisticsTotal.NewFECErrors,
|
||||
"atuc_fec_errors": statisticsTotal.NewATUCFECErrors,
|
||||
"hec_errors": statisticsTotal.NewHECErrors,
|
||||
"atuc_hec_errors": statisticsTotal.NewATUCHECErrors,
|
||||
"crc_errors": statisticsTotal.NewCRCErrors,
|
||||
"atuc_crc_errors": statisticsTotal.NewATUCCRCErrors,
|
||||
}
|
||||
acc.AddFields("fritzbox_dsl", fields, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherWlanInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := wlanconfig.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
info := &wlanconfig.GetInfoResponse{}
|
||||
if err := serviceClient.GetInfo(info); err != nil {
|
||||
return fmt.Errorf("failed to query WLAN info: %w", err)
|
||||
}
|
||||
totalAssociations := &wlanconfig.GetTotalAssociationsResponse{}
|
||||
if info.NewStatus == "Up" {
|
||||
if err := serviceClient.GetTotalAssociations(totalAssociations); err != nil {
|
||||
return fmt.Errorf("failed to query WLAN associations: %w", err)
|
||||
}
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
"status": info.NewStatus,
|
||||
"ssid": info.NewSSID,
|
||||
"channel": strconv.Itoa(int(info.NewChannel)),
|
||||
"band": f.wlanBandFromInfo(info),
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"total_associations": totalAssociations.NewTotalAssociations,
|
||||
}
|
||||
acc.AddGauge("fritzbox_wlan", fields, tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) wlanBandFromInfo(info *wlanconfig.GetInfoResponse) string {
|
||||
band := info.NewX_AVM_DE_FrequencyBand
|
||||
if band != "" {
|
||||
return band
|
||||
}
|
||||
if 1 <= info.NewChannel && info.NewChannel <= 14 {
|
||||
return "2400"
|
||||
}
|
||||
return "5000"
|
||||
}
|
||||
|
||||
func (f *Fritzbox) gatherHostsInfo(acc telegraf.Accumulator, deviceClient *tr064.Client, service tr064.ServiceDescriptor) error {
|
||||
serviceClient := hosts.ServiceClient{
|
||||
TR064Client: deviceClient,
|
||||
Service: service,
|
||||
}
|
||||
connections, err := f.fetchHostsConnections(&serviceClient)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to fetch hosts connections: %w", err)
|
||||
}
|
||||
for _, connection := range connections {
|
||||
// Ignore ephemeral UUID style device names
|
||||
_, err = uuid.Parse(connection.RightDeviceName)
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
tags := map[string]string{
|
||||
"source": serviceClient.TR064Client.DeviceUrl.Hostname(),
|
||||
"service": serviceClient.Service.ShortId(),
|
||||
"node": connection.RightDeviceName,
|
||||
"node_role": f.hostRole(connection.RightMeshRole),
|
||||
"node_ap": connection.LeftDeviceName,
|
||||
"node_ap_role": f.hostRole(connection.LeftMeshRole),
|
||||
"link_type": connection.InterfaceType,
|
||||
"link_name": connection.InterfaceName,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"max_data_rate_tx": connection.MaxDataRateTx,
|
||||
"max_data_rate_rx": connection.MaxDataRateRx,
|
||||
"cur_data_rate_tx": connection.CurDataRateTx,
|
||||
"cur_data_rate_rx": connection.CurDataRateRx,
|
||||
}
|
||||
acc.AddGauge("fritzbox_hosts", fields, tags)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Fritzbox) hostRole(role string) string {
|
||||
if role == "unknown" {
|
||||
return "client"
|
||||
}
|
||||
return role
|
||||
}
|
||||
|
||||
func (f *Fritzbox) fetchHostsConnections(serviceClient *hosts.ServiceClient) ([]*mesh.Connection, error) {
|
||||
meshListPath := &hosts.X_AVM_DE_GetMeshListPathResponse{}
|
||||
if err := serviceClient.X_AVM_DE_GetMeshListPath(meshListPath); err != nil {
|
||||
return nil, fmt.Errorf("failed to query mesh list path: %w", err)
|
||||
}
|
||||
meshListResponse, err := serviceClient.TR064Client.Get(meshListPath.NewX_AVM_DE_MeshListPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to access mesh list %q: %w", meshListPath.NewX_AVM_DE_MeshListPath, err)
|
||||
}
|
||||
if meshListResponse.StatusCode == http.StatusNotFound {
|
||||
return make([]*mesh.Connection, 0), nil
|
||||
}
|
||||
if meshListResponse.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("failed to fetch mesh list %q: %s", meshListPath.NewX_AVM_DE_MeshListPath, meshListResponse.Status)
|
||||
}
|
||||
defer meshListResponse.Body.Close()
|
||||
meshListBytes, err := io.ReadAll(meshListResponse.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read mesh list: %w", err)
|
||||
}
|
||||
meshList := &mesh.List{}
|
||||
if json.Unmarshal(meshListBytes, meshList); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse mesh list: %w", err)
|
||||
}
|
||||
return meshList.Connections(), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("fritzbox", func() telegraf.Input {
|
||||
return &Fritzbox{Timeout: config.Duration(10 * time.Second)}
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package fritzbox
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tdrn-org/go-tr064/mock"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/config"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
"github.com/influxdata/telegraf/plugins/parsers/influx"
|
||||
"github.com/influxdata/telegraf/testutil"
|
||||
)
|
||||
|
||||
func TestValidDefaultConfig(t *testing.T) {
|
||||
// Verify plugin can be loaded from config
|
||||
conf := config.NewConfig()
|
||||
require.NoError(t, conf.LoadConfig("sample.conf"))
|
||||
require.Len(t, conf.Inputs, 1)
|
||||
f, ok := conf.Inputs[0].Input.(*Fritzbox)
|
||||
require.True(t, ok)
|
||||
|
||||
// Verify successful Init
|
||||
require.NoError(t, f.Init())
|
||||
|
||||
// Verify everything is setup according to plugin defaults
|
||||
require.ElementsMatch(t, []string{"http://user:password@fritz.box:49000/"}, f.URLs)
|
||||
require.Equal(t, []string{"device", "wan", "ppp", "dsl", "wlan"}, f.Collect)
|
||||
require.Equal(t, config.Duration(10*time.Second), f.Timeout)
|
||||
require.Empty(t, f.TLSKeyPwd)
|
||||
require.False(t, f.InsecureSkipVerify)
|
||||
}
|
||||
|
||||
func TestValidCustomConfig(t *testing.T) {
|
||||
// Verify plugin can be loaded from config
|
||||
conf := config.NewConfig()
|
||||
require.NoError(t, conf.LoadConfig("testdata/conf/valid.conf"))
|
||||
require.Len(t, conf.Inputs, 1)
|
||||
f, ok := conf.Inputs[0].Input.(*Fritzbox)
|
||||
require.True(t, ok)
|
||||
|
||||
// Verify successful Init
|
||||
require.NoError(t, f.Init())
|
||||
|
||||
// Verify everything is setup according to the config file
|
||||
require.ElementsMatch(t, []string{"http://boxuser:boxpassword@fritz.box:49000/", "http://:repeaterpassword@fritz.repeater:49000/"}, f.URLs)
|
||||
require.Equal(t, []string{"device", "wan", "ppp", "dsl", "wlan", "hosts"}, f.Collect)
|
||||
require.Equal(t, config.Duration(60*time.Second), f.Timeout)
|
||||
require.Equal(t, "secret", f.TLSKeyPwd)
|
||||
require.True(t, f.InsecureSkipVerify)
|
||||
}
|
||||
|
||||
func TestInvalidURLsConfig(t *testing.T) {
|
||||
// Verify plugin can be loaded from config
|
||||
conf := config.NewConfig()
|
||||
require.NoError(t, conf.LoadConfig("testdata/conf/invalid_urls.conf"))
|
||||
require.Len(t, conf.Inputs, 1)
|
||||
f, ok := conf.Inputs[0].Input.(*Fritzbox)
|
||||
require.True(t, ok)
|
||||
|
||||
// Verify Init failure
|
||||
require.EqualError(t, f.Init(), `parsing device URL "::" failed: parse "::": missing protocol scheme`)
|
||||
}
|
||||
|
||||
func TestInvalidCollectConfig(t *testing.T) {
|
||||
// Verify plugin can be loaded from config
|
||||
conf := config.NewConfig()
|
||||
require.NoError(t, conf.LoadConfig("testdata/conf/invalid_collect.conf"))
|
||||
require.Len(t, conf.Inputs, 1)
|
||||
f, ok := conf.Inputs[0].Input.(*Fritzbox)
|
||||
require.True(t, ok)
|
||||
|
||||
// Verify Init failure
|
||||
require.EqualError(t, f.Init(), `invalid service "undefined" in collect parameter`)
|
||||
}
|
||||
|
||||
func TestCases(t *testing.T) {
|
||||
// Get all testcase directories
|
||||
testcases, err := os.ReadDir("testdata/testcases")
|
||||
require.NoError(t, err)
|
||||
|
||||
// Register the plugin
|
||||
inputs.Add("fritzbox", func() telegraf.Input {
|
||||
return &Fritzbox{Timeout: config.Duration(10 * time.Second)}
|
||||
})
|
||||
|
||||
for _, testcase := range testcases {
|
||||
// Only handle folders
|
||||
if !testcase.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
t.Run(testcase.Name(), func(t *testing.T) {
|
||||
testcaseDir := filepath.Join("testdata/testcases", testcase.Name())
|
||||
configFile := filepath.Join(testcaseDir, "telegraf.conf")
|
||||
mockDir := filepath.Join(testcaseDir, "mock")
|
||||
expectedMetricsFile := filepath.Join(testcaseDir, "expected.out")
|
||||
|
||||
// Setup the services to mock (one per sub-folder of mockDir)
|
||||
services, err := os.ReadDir(mockDir)
|
||||
require.NoError(t, err)
|
||||
serviceMocks := make([]*mock.ServiceMock, 0, len(services))
|
||||
for _, service := range services {
|
||||
// Ignore the mock files
|
||||
if !testcase.IsDir() {
|
||||
continue
|
||||
}
|
||||
serviceMock := mock.ServiceMockFromFile("/"+service.Name(), filepath.Join(mockDir, service.Name(), "response.xml"))
|
||||
serviceMocks = append(serviceMocks, serviceMock)
|
||||
}
|
||||
|
||||
// Start testcase mock server
|
||||
tr064Server := mock.Start(mockDir, serviceMocks...)
|
||||
defer tr064Server.Shutdown()
|
||||
|
||||
// Load plugin from config
|
||||
conf := config.NewConfig()
|
||||
require.NoError(t, conf.LoadConfig(configFile))
|
||||
require.Len(t, conf.Inputs, 1)
|
||||
f, ok := conf.Inputs[0].Input.(*Fritzbox)
|
||||
require.True(t, ok)
|
||||
|
||||
// Target plugin at mock server
|
||||
f.URLs = []string{tr064Server.Server().String()}
|
||||
f.Log = &testutil.Logger{Name: "fritzbox"}
|
||||
|
||||
// Verify successful Init
|
||||
require.NoError(t, f.Init())
|
||||
|
||||
// Verify successfull Gather
|
||||
acc := &testutil.Accumulator{}
|
||||
require.NoError(t, acc.GatherError(f.Gather))
|
||||
|
||||
// Load expexected metrics
|
||||
parser := &influx.Parser{}
|
||||
require.NoError(t, parser.Init())
|
||||
expectedMetrics, err := testutil.ParseMetricsFromFile(expectedMetricsFile, parser)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify metrics are as expected
|
||||
testutil.RequireMetricsEqual(t, expectedMetrics, acc.GetTelegrafMetrics(), testutil.IgnoreTime(), testutil.IgnoreType(), testutil.SortMetrics())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# Gather fritzbox status
|
||||
[[inputs.fritzbox]]
|
||||
## URLs of the devices to query including login credentials
|
||||
urls = [ "http://user:password@fritz.box:49000/" ]
|
||||
|
||||
## The information to collect (see README for further details).
|
||||
# collect = [
|
||||
# "device",
|
||||
# "wan",
|
||||
# "ppp",
|
||||
# "dsl",
|
||||
# "wlan",
|
||||
# ]
|
||||
|
||||
## The http timeout to use.
|
||||
# timeout = "10s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
# tls_key_pwd = "secret"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Gather fritzbox status
|
||||
[[inputs.fritzbox]]
|
||||
## URLs of the devices to query including login credentials
|
||||
urls = [ "http://user:password@fritz.box:49000/" ]
|
||||
|
||||
## The information to collect (see README for further details).
|
||||
collect = [ "undefined" ]
|
||||
|
||||
## The http timeout to use.
|
||||
# timeout = "10s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
# tls_key_pwd = "secret"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# Gather fritzbox status
|
||||
[[inputs.fritzbox]]
|
||||
## URLs of the devices to query including login credentials
|
||||
urls = [ "http://user:password@fritz.box:49000/", "::" ]
|
||||
|
||||
## The information to collect (see README for further details).
|
||||
# collect = [
|
||||
# "device",
|
||||
# "wan",
|
||||
# "ppp",
|
||||
# "dsl",
|
||||
# "wlan",
|
||||
# ]
|
||||
|
||||
## The http timeout to use.
|
||||
# timeout = "10s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
# tls_key_pwd = "secret"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Gather fritzbox status
|
||||
[[inputs.fritzbox]]
|
||||
## URLs of the devices to query including login credentials
|
||||
urls = [
|
||||
"http://boxuser:boxpassword@fritz.box:49000/",
|
||||
"http://:repeaterpassword@fritz.repeater:49000/",
|
||||
]
|
||||
|
||||
## The information to collect (see README for further details).
|
||||
collect = [
|
||||
"device",
|
||||
"wan",
|
||||
"ppp",
|
||||
"dsl",
|
||||
"wlan",
|
||||
"hosts",
|
||||
]
|
||||
|
||||
## The http timeout to use.
|
||||
timeout = "1m"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
tls_key_pwd = "secret"
|
||||
## Use TLS but skip chain & host verification
|
||||
insecure_skip_verify = true
|
||||
|
|
@ -0,0 +1 @@
|
|||
fritzbox_device,service=DeviceInfo1,source=127.0.0.1 hardware_version="Mock 1234",model_name="Mock 1234",serial_number="123456789",software_version="1.02.03",uptime=2058438u 1737088489284767000
|
||||
19
plugins/inputs/fritzbox/testdata/testcases/device/mock/deviceinfo/response.xml
vendored
Normal file
19
plugins/inputs/fritzbox/testdata/testcases/device/mock/deviceinfo/response.xml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetInfoResponse xmlns:u="urn:dslforum-org:service:DeviceInfo:1">
|
||||
<NewManufacturerName>AVM</NewManufacturerName>
|
||||
<NewManufacturerOUI>00000E</NewManufacturerOUI>
|
||||
<NewModelName>Mock 1234</NewModelName>
|
||||
<NewDescription>Mock 1234 Release 1.02.03</NewDescription>
|
||||
<NewProductClass>MOCK1234</NewProductClass>
|
||||
<NewSerialNumber>123456789</NewSerialNumber>
|
||||
<NewSoftwareVersion>1.02.03</NewSoftwareVersion>
|
||||
<NewHardwareVersion>Mock 1234</NewHardwareVersion>
|
||||
<NewSpecVersion>1.0</NewSpecVersion>
|
||||
<NewProvisioningCode>000.000.000.000</NewProvisioningCode>
|
||||
<NewUpTime>2058438</NewUpTime>
|
||||
<NewDeviceLog/>
|
||||
</u:GetInfoResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:DeviceInfo:1</serviceType>
|
||||
<serviceId>urn:DeviceInfo-com:serviceId:DeviceInfo1</serviceId>
|
||||
<controlURL>/deviceinfo</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "device" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
fritzbox_dsl,service=WANDSLInterfaceConfig1,source=127.0.0.1,status=Up atuc_crc_errors=13u,atuc_fec_errors=0u,atuc_hec_errors=0u,cell_delin=0u,crc_errors=53u,downstream_attenuation=140u,downstream_curr_rate=249065u,downstream_max_rate=249065u,downstream_noise_margin=60u,downstream_power=513u,errored_secs=25u,fec_errors=0u,hec_errors=0u,init_errors=0u,init_timeouts=0u,link_retrain=2u,loss_of_framing=0u,receive_blocks=490282831u,severly_errored_secs=0u,transmit_blocks=254577751u,upstream_attenuation=80u,upstream_curr_rate=46719i,upstream_max_rate=48873u,upstream_noise_margin=80u,upstream_power=498u 1737088741855188000
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:WANDSLInterfaceConfig:1</serviceType>
|
||||
<serviceId>urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1</serviceId>
|
||||
<controlURL>/wandslifconfig</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
39
plugins/inputs/fritzbox/testdata/testcases/dsl/mock/wandslifconfig/response.xml
vendored
Normal file
39
plugins/inputs/fritzbox/testdata/testcases/dsl/mock/wandslifconfig/response.xml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetInfoResponse xmlns:u="urn:dslforum-org:service:WANDSLInterfaceConfig:1">
|
||||
<NewEnable>1</NewEnable>
|
||||
<NewStatus>Up</NewStatus>
|
||||
<NewDataPath>Fast</NewDataPath>
|
||||
<NewUpstreamCurrRate>46719</NewUpstreamCurrRate>
|
||||
<NewDownstreamCurrRate>249065</NewDownstreamCurrRate>
|
||||
<NewUpstreamMaxRate>48873</NewUpstreamMaxRate>
|
||||
<NewDownstreamMaxRate>249065</NewDownstreamMaxRate>
|
||||
<NewUpstreamNoiseMargin>80</NewUpstreamNoiseMargin>
|
||||
<NewDownstreamNoiseMargin>60</NewDownstreamNoiseMargin>
|
||||
<NewUpstreamAttenuation>80</NewUpstreamAttenuation>
|
||||
<NewDownstreamAttenuation>140</NewDownstreamAttenuation>
|
||||
<NewATURVendor>41564d00</NewATURVendor>
|
||||
<NewATURCountry>0400</NewATURCountry>
|
||||
<NewUpstreamPower>498</NewUpstreamPower>
|
||||
<NewDownstreamPower>513</NewDownstreamPower>
|
||||
</u:GetInfoResponse>
|
||||
<u:GetStatisticsTotalResponse xmlns:u="urn:dslforum-org:service:WANDSLInterfaceConfig:1">
|
||||
<NewReceiveBlocks>490282831</NewReceiveBlocks>
|
||||
<NewTransmitBlocks>254577751</NewTransmitBlocks>
|
||||
<NewCellDelin>0</NewCellDelin>
|
||||
<NewLinkRetrain>2</NewLinkRetrain>
|
||||
<NewInitErrors>0</NewInitErrors>
|
||||
<NewInitTimeouts>0</NewInitTimeouts>
|
||||
<NewLossOfFraming>0</NewLossOfFraming>
|
||||
<NewErroredSecs>25</NewErroredSecs>
|
||||
<NewSeverelyErroredSecs>0</NewSeverelyErroredSecs>
|
||||
<NewFECErrors>0</NewFECErrors>
|
||||
<NewATUCFECErrors>0</NewATUCFECErrors>
|
||||
<NewHECErrors>0</NewHECErrors>
|
||||
<NewATUCHECErrors>0</NewATUCHECErrors>
|
||||
<NewCRCErrors>53</NewCRCErrors>
|
||||
<NewATUCCRCErrors>13</NewATUCCRCErrors>
|
||||
</u:GetStatisticsTotalResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "dsl" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
fritzbox_hosts,node=device#17,node_ap=device#1,node_ap_role=master,node_role=slave,link_name=AP:2G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=216000i,cur_data_rate_tx=216000i,max_data_rate_rx=216000i,max_data_rate_tx=216000i 1737063884317915000
|
||||
fritzbox_hosts,node=device#17,node_ap=device#1,node_ap_role=master,node_role=slave,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=1300000i,cur_data_rate_tx=975000i,max_data_rate_rx=1300000i,max_data_rate_tx=1300000i 1737063884317962000
|
||||
fritzbox_hosts,node=device#4,node_ap=device#1,node_ap_role=master,node_role=client,link_name=LAN:1,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=1000000i,cur_data_rate_tx=1000000i,max_data_rate_rx=1000000i,max_data_rate_tx=1000000i 1737063884317976000
|
||||
fritzbox_hosts,node=device#26,node_ap=device#1,node_ap_role=master,node_role=client,link_name=LAN:2,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=1000000i,cur_data_rate_tx=1000000i,max_data_rate_rx=1000000i,max_data_rate_tx=1000000i 1737063884317992000
|
||||
fritzbox_hosts,node=device#2,node_ap=device#1,node_ap_role=master,node_role=client,link_name=LAN:3,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=100000i,cur_data_rate_tx=100000i,max_data_rate_rx=100000i,max_data_rate_tx=100000i 1737063884318005000
|
||||
fritzbox_hosts,node=device#3,node_ap=device#1,node_ap_role=master,node_role=client,link_name=LAN:4,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=100000i,cur_data_rate_tx=100000i,max_data_rate_rx=100000i,max_data_rate_tx=100000i 1737063884318018000
|
||||
fritzbox_hosts,node=device#14,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:2G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=65000i,cur_data_rate_tx=72000i,max_data_rate_rx=72200i,max_data_rate_tx=72200i 1737063884318031000
|
||||
fritzbox_hosts,node=device#5,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:2G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=72000i,cur_data_rate_tx=72000i,max_data_rate_rx=72200i,max_data_rate_tx=72200i 1737063884318043000
|
||||
fritzbox_hosts,node=device#11,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=390000i,cur_data_rate_tx=433000i,max_data_rate_rx=433300i,max_data_rate_tx=433300i 1737063884318065000
|
||||
fritzbox_hosts,node=device#11,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=585000i,cur_data_rate_tx=866000i,max_data_rate_rx=866700i,max_data_rate_tx=866700i 1737063884318082000
|
||||
fritzbox_hosts,node=device#16,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=866000i,cur_data_rate_tx=866000i,max_data_rate_rx=866700i,max_data_rate_tx=866700i 1737063884318118000
|
||||
fritzbox_hosts,node=device#18,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=526000i,cur_data_rate_tx=780000i,max_data_rate_rx=866700i,max_data_rate_tx=866700i 1737063884318140000
|
||||
fritzbox_hosts,node=device#19,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=650000i,cur_data_rate_tx=1170000i,max_data_rate_rx=1733300i,max_data_rate_tx=1733300i 1737063884318153000
|
||||
fritzbox_hosts,node=device#7,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=780000i,cur_data_rate_tx=866000i,max_data_rate_rx=866700i,max_data_rate_tx=866700i 1737063884318166000
|
||||
fritzbox_hosts,node=device#8,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=390000i,cur_data_rate_tx=433000i,max_data_rate_rx=433300i,max_data_rate_tx=433300i 1737063884318179000
|
||||
fritzbox_hosts,node=device#9,node_ap=device#1,node_ap_role=master,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=390000i,cur_data_rate_tx=433000i,max_data_rate_rx=433300i,max_data_rate_tx=433300i 1737063884318192000
|
||||
fritzbox_hosts,node=device#13,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=LAN:1,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=0i,cur_data_rate_tx=0i,max_data_rate_rx=1000000i,max_data_rate_tx=1000000i 1737063884318215000
|
||||
fritzbox_hosts,node=device#24,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=LAN:1,link_type=LAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=0i,cur_data_rate_tx=0i,max_data_rate_rx=1000000i,max_data_rate_tx=1000000i 1737063884318233000
|
||||
fritzbox_hosts,node=device#6,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=AP:2G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=72200i,cur_data_rate_tx=72000i,max_data_rate_rx=72000i,max_data_rate_tx=72000i 1737063884318251000
|
||||
fritzbox_hosts,node=device#10,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=866700i,cur_data_rate_tx=866000i,max_data_rate_rx=866000i,max_data_rate_tx=866000i 1737063884318263000
|
||||
fritzbox_hosts,node=device#22,node_ap=device#17,node_ap_role=slave,node_role=client,link_name=AP:5G:0,link_type=WLAN,service=Hosts1,source=127.0.0.1 cur_data_rate_rx=866700i,cur_data_rate_tx=866000i,max_data_rate_rx=866000i,max_data_rate_tx=866000i 1737063884318275000
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:X_AVM-DE_GetMeshListPathResponse xmlns:u="urn:dslforum-org:service:Hosts:1">
|
||||
<NewX_AVM-DE_MeshListPath>/meshlist.json?sid=123456789abcdef</NewX_AVM-DE_MeshListPath>
|
||||
</u:X_AVM-DE_GetMeshListPathResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:Hosts:1</serviceType>
|
||||
<serviceId>urn:LanDeviceHosts-com:serviceId:Hosts1</serviceId>
|
||||
<controlURL>/hosts</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "hosts" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
fritzbox_ppp,service=WANPPPConnection1,source=127.0.0.1 downstream_max_bit_rate=68038668u,upstream_max_bit_rate=44213433u,uptime=369434u 1737088658570388000
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:WANPPPConnection:1</serviceType>
|
||||
<serviceId>urn:WANPPPConnection-com:serviceId:WANPPPConnection1</serviceId>
|
||||
<controlURL>/wanpppconn</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetInfoResponse xmlns:u="urn:dslforum-org:service:WANPPPConnection:1">
|
||||
<NewEnable>1</NewEnable>
|
||||
<NewConnectionStatus>Connected</NewConnectionStatus>
|
||||
<NewPossibleConnectionTypes>IP_Routed, IP_Bridged</NewPossibleConnectionTypes>
|
||||
<NewConnectionType>IP_Routed</NewConnectionType>
|
||||
<NewName>internet</NewName>
|
||||
<NewUptime>369434</NewUptime>
|
||||
<NewUpstreamMaxBitRate>44213433</NewUpstreamMaxBitRate>
|
||||
<NewDownstreamMaxBitRate>68038668</NewDownstreamMaxBitRate>
|
||||
<NewLastConnectionError>ERROR_NONE</NewLastConnectionError>
|
||||
<NewIdleDisconnectTime>0</NewIdleDisconnectTime>
|
||||
<NewRSIPAvailable>0</NewRSIPAvailable>
|
||||
<NewUserName>5511248654630001@setup.t-online.de</NewUserName>
|
||||
<NewNATEnabled>1</NewNATEnabled>
|
||||
<NewExternalIPAddress>217.238.141.33</NewExternalIPAddress>
|
||||
<NewDNSServers>2003:180:2:7000::53, 2003:180:2:9000::53,217.237.151.115,217.237.148.102</NewDNSServers>
|
||||
<NewMACAddress>dc:39:6f:3a:bc:40</NewMACAddress>
|
||||
<NewConnectionTrigger>AlwaysOn</NewConnectionTrigger>
|
||||
<NewLastAuthErrorInfo></NewLastAuthErrorInfo>
|
||||
<NewMaxCharsUsername>128</NewMaxCharsUsername>
|
||||
<NewMinCharsUsername>3</NewMinCharsUsername>
|
||||
<NewAllowedCharsUsername>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._@()#/%[]{}*+§$&=?!:;,</NewAllowedCharsUsername>
|
||||
<NewMaxCharsPassword>64</NewMaxCharsPassword>
|
||||
<NewMinCharsPassword>3</NewMinCharsPassword>
|
||||
<NewAllowedCharsPassword>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._@()#/%[]{}*+§$&=?!:;,</NewAllowedCharsPassword>
|
||||
<NewTransportType>PPPoE</NewTransportType>
|
||||
<NewRouteProtocolRx>Off</NewRouteProtocolRx>
|
||||
<NewPPPoEServiceName></NewPPPoEServiceName>
|
||||
<NewRemoteIPAddress></NewRemoteIPAddress>
|
||||
<NewPPPoEACName>MUNJ20</NewPPPoEACName>
|
||||
<NewDNSEnabled>1</NewDNSEnabled>
|
||||
<NewDNSOverrideAllowed>1</NewDNSOverrideAllowed>
|
||||
</u:GetInfoResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "ppp" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
fritzbox_wan,service=WANCommonInterfaceConfig1,source=127.0.0.1 downstream_current_max_speed=1304268u,layer1_downstream_max_bit_rate=253247000u,layer1_upstream_max_bit_rate=48816000u,total_bytes_received=554484531337u,total_bytes_sent=129497283207u,upstream_current_max_speed=511831u 1737088572669757000
|
||||
24
plugins/inputs/fritzbox/testdata/testcases/wan/mock/WANCommonIFC1/response.xml
vendored
Normal file
24
plugins/inputs/fritzbox/testdata/testcases/wan/mock/WANCommonIFC1/response.xml
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetAddonInfosResponse xmlns:u="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1">
|
||||
<NewByteSendRate>178</NewByteSendRate>
|
||||
<NewByteReceiveRate>10893</NewByteReceiveRate>
|
||||
<NewPacketSendRate>0</NewPacketSendRate>
|
||||
<NewPacketReceiveRate>0</NewPacketReceiveRate>
|
||||
<NewTotalBytesSent>648264327</NewTotalBytesSent>
|
||||
<NewTotalBytesReceived>433750153</NewTotalBytesReceived>
|
||||
<NewAutoDisconnectTime>0</NewAutoDisconnectTime>
|
||||
<NewIdleDisconnectTime>1</NewIdleDisconnectTime>
|
||||
<NewDNSServer1>0.0.0.0</NewDNSServer1>
|
||||
<NewDNSServer2>0.0.0.0</NewDNSServer2>
|
||||
<NewVoipDNSServer1>0.0.0.0</NewVoipDNSServer1>
|
||||
<NewVoipDNSServer2>0.0.0.0</NewVoipDNSServer2>
|
||||
<NewUpnpControlEnabled>0</NewUpnpControlEnabled>
|
||||
<NewRoutedBridgedModeBoth>1</NewRoutedBridgedModeBoth>
|
||||
<NewX_AVM_DE_TotalBytesSent64>129497283207</NewX_AVM_DE_TotalBytesSent64>
|
||||
<NewX_AVM_DE_TotalBytesReceived64>554484531337</NewX_AVM_DE_TotalBytesReceived64>
|
||||
<NewX_AVM_DE_WANAccessType>DSL</NewX_AVM_DE_WANAccessType>
|
||||
</u:GetAddonInfosResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType>
|
||||
<serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId>
|
||||
<controlURL>/WANCommonIFC1</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:WANCommonInterfaceConfig:1</serviceType>
|
||||
<serviceId>urn:WANCIfConfig-com:serviceId:WANCommonInterfaceConfig1</serviceId>
|
||||
<controlURL>/wancommonifconfig</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
15
plugins/inputs/fritzbox/testdata/testcases/wan/mock/wancommonifconfig/response.xml
vendored
Normal file
15
plugins/inputs/fritzbox/testdata/testcases/wan/mock/wancommonifconfig/response.xml
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetCommonLinkPropertiesResponse xmlns:u="urn:dslforum-org:service:WANCommonInterfaceConfig:1">
|
||||
<NewWANAccessType>DSL</NewWANAccessType>
|
||||
<NewLayer1UpstreamMaxBitRate>48816000</NewLayer1UpstreamMaxBitRate>
|
||||
<NewLayer1DownstreamMaxBitRate>253247000</NewLayer1DownstreamMaxBitRate>
|
||||
<NewPhysicalLinkStatus>Up</NewPhysicalLinkStatus>
|
||||
<NewX_AVM-DE_DownstreamCurrentUtilization>281672,1069998,122887,154143,335464,376641,201036,1046752,1304268,117397,42277,54058,41911,193162,372545,232857,661911,884903,35486,43050</NewX_AVM-DE_DownstreamCurrentUtilization>
|
||||
<NewX_AVM-DE_UpstreamCurrentUtilization>100417,76139,389328,217575,68110,49200,248209,122899,83175,466221,511831,491191,372128,192963,269890,222214,41261,56576,328630,388027</NewX_AVM-DE_UpstreamCurrentUtilization>
|
||||
<NewX_AVM-DE_DownstreamCurrentMaxSpeed>1304268</NewX_AVM-DE_DownstreamCurrentMaxSpeed>
|
||||
<NewX_AVM-DE_UpstreamCurrentMaxSpeed>511831</NewX_AVM-DE_UpstreamCurrentMaxSpeed>
|
||||
</u:GetCommonLinkPropertiesResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "wan" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
fritzbox_wlan,band=2400,channel=13,service=WLANConfiguration1,source=127.0.0.1,ssid=MOCK1234,status=Up total_associations=11u 1737063660847310000
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<scpd xmlns="urn:dslforum-org:service-1-0">
|
||||
<actionList/>
|
||||
<serviceStateTable/>
|
||||
</scpd>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<root xmlns="urn:dslforum-org:device-1-0">
|
||||
<device>
|
||||
<serviceList>
|
||||
<service>
|
||||
<serviceType>urn:dslforum-org:service:WLANConfiguration:1</serviceType>
|
||||
<serviceId>urn:WLANConfiguration-com:serviceId:WLANConfiguration1</serviceId>
|
||||
<controlURL>/wlanconfig</controlURL>
|
||||
<SCPDURL>/dummySCPD.xml</SCPDURL>
|
||||
</service>
|
||||
</serviceList>
|
||||
<deviceList/>
|
||||
</device>
|
||||
</root>
|
||||
30
plugins/inputs/fritzbox/testdata/testcases/wlan/mock/wlanconfig/response.xml
vendored
Normal file
30
plugins/inputs/fritzbox/testdata/testcases/wlan/mock/wlanconfig/response.xml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetInfoResponse xmlns:u="urn:dslforum-org:service:WLANConfiguration:1">
|
||||
<NewEnable>1</NewEnable>
|
||||
<NewStatus>Up</NewStatus>
|
||||
<NewMaxBitRate>Auto</NewMaxBitRate>
|
||||
<NewChannel>13</NewChannel>
|
||||
<NewSSID>MOCK1234</NewSSID>
|
||||
<NewBeaconType>11i</NewBeaconType>
|
||||
<NewX_AVM-DE_PossibleBeaconTypes>None,11i,WPAand11i,11iandWPA3</NewX_AVM-DE_PossibleBeaconTypes>
|
||||
<NewMACAddressControlEnabled>0</NewMACAddressControlEnabled>
|
||||
<NewStandard>n</NewStandard>
|
||||
<NewBSSID>00:00:00:00:00:00</NewBSSID>
|
||||
<NewBasicEncryptionModes>None</NewBasicEncryptionModes>
|
||||
<NewBasicAuthenticationMode>None</NewBasicAuthenticationMode>
|
||||
<NewMaxCharsSSID>32</NewMaxCharsSSID>
|
||||
<NewMinCharsSSID>1</NewMinCharsSSID>
|
||||
<NewAllowedCharsSSID>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</NewAllowedCharsSSID>
|
||||
<NewMinCharsPSK>64</NewMinCharsPSK>
|
||||
<NewMaxCharsPSK>64</NewMaxCharsPSK>
|
||||
<NewAllowedCharsPSK>0123456789ABCDEFabcdef</NewAllowedCharsPSK>
|
||||
<NewX_AVM-DE_FrequencyBand>2400</NewX_AVM-DE_FrequencyBand>
|
||||
<NewX_AVM-DE_WLANGlobalEnable>1</NewX_AVM-DE_WLANGlobalEnable>
|
||||
</u:GetInfoResponse>
|
||||
<u:GetTotalAssociationsResponse xmlns:u="urn:dslforum-org:service:WLANConfiguration:1">
|
||||
<NewTotalAssociations>11</NewTotalAssociations>
|
||||
</u:GetTotalAssociationsResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[[inputs.fritzbox]]
|
||||
## URLs are set dynamically by test
|
||||
# urls = [ ]
|
||||
collect = [ "wlan" ]
|
||||
# everything else stays at defaults
|
||||
|
||||
Loading…
Reference in New Issue