Code Monkey home page Code Monkey logo

fritzbox_exporter's Issues

Export also VPN metrics

Is it possible to add VPN metrics?
Like whether the link is up/down, how much data has been transferred or the bandwidth of the tunnel?

unexpected error: XML syntax error on line 1: element <HR> closed by </BODY>

I tried to run the docker image from the docker hub. It fails and spams the console with the following message:
unexpected error: XML syntax error on line 1: element <HR> closed by </BODY>

If I open the link http://<Frtitz!Box-IP>:49000/igddesc.xml in the browser, the service definition is displayed. So I don't know why the XML Syntax error occurs.

I'm using a Fritz!Box 7530 with firmware 07.21.

Here the result, if opening the link directly:
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>
<friendlyName>FRITZ!Box 7530</friendlyName>
<manufacturer>AVM Berlin</manufacturer>
<manufacturerURL>http://www.avm.de</manufacturerURL>
<modelDescription>FRITZ!Box 7530</modelDescription>
<modelName>FRITZ!Box 7530</modelName>
<modelNumber>avm</modelNumber>
<modelURL>http://www.avm.de</modelURL>
<UDN>uuid://removed//</UDN>
<iconList>
<icon>
<mimetype>image/gif</mimetype>
<width>118</width>
<height>119</height>
<depth>8</depth>
<url>/ligd.gif</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:schemas-any-com:service:Any:1</serviceType>
<serviceId>urn:any-com:serviceId:any1</serviceId>
<controlURL>/igdupnp/control/any</controlURL>
<eventSubURL>/igdupnp/control/any</eventSubURL>
<SCPDURL>/any.xml</SCPDURL>
</service>
</serviceList>
<deviceList>
<device>
<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>
<friendlyName>WANDevice - FRITZ!Box 7530</friendlyName>
<manufacturer>AVM Berlin</manufacturer>
<manufacturerURL>www.avm.de</manufacturerURL>
<modelDescription>WANDevice - FRITZ!Box 7530</modelDescription>
<modelName>WANDevice - FRITZ!Box 7530</modelName>
<modelNumber>avm</modelNumber>
<modelURL>www.avm.de</modelURL>
<UDN>uuid://removed//</UDN>
<UPC>AVM IGD</UPC>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType>
<serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId>
<controlURL>/igdupnp/control/WANCommonIFC1</controlURL>
<eventSubURL>/igdupnp/control/WANCommonIFC1</eventSubURL>
<SCPDURL>/igdicfgSCPD.xml</SCPDURL>
</service>
</serviceList>
<deviceList>
<device>
<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>
<friendlyName>WANConnectionDevice - FRITZ!Box 7530</friendlyName>
<manufacturer>AVM Berlin</manufacturer>
<manufacturerURL>www.avm.de</manufacturerURL>
<modelDescription>WANConnectionDevice - FRITZ!Box 7530</modelDescription>
<modelName>WANConnectionDevice - FRITZ!Box 7530</modelName>
<modelNumber>avm</modelNumber>
<modelURL>www.avm.de</modelURL>
<UDN>uuid://removed//</UDN>
<UPC>AVM IGD</UPC>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:WANDSLLinkConfig:1</serviceType>
<serviceId>urn:upnp-org:serviceId:WANDSLLinkC1</serviceId>
<controlURL>/igdupnp/control/WANDSLLinkC1</controlURL>
<eventSubURL>/igdupnp/control/WANDSLLinkC1</eventSubURL>
<SCPDURL>/igddslSCPD.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>
<serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId>
<controlURL>/igdupnp/control/WANIPConn1</controlURL>
<eventSubURL>/igdupnp/control/WANIPConn1</eventSubURL>
<SCPDURL>/igdconnSCPD.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:WANIPv6FirewallControl:1</serviceType>
<serviceId>urn:upnp-org:serviceId:WANIPv6Firewall1</serviceId>
<controlURL>/igd2upnp/control/WANIPv6Firewall1</controlURL>
<eventSubURL>/igd2upnp/control/WANIPv6Firewall1</eventSubURL>
<SCPDURL>/igd2ipv6fwcSCPD.xml</SCPDURL>
</service>
</serviceList>
</device>
</deviceList>
</device>
</deviceList>
<presentationURL>http://fritz.box</presentationURL>
</device>
</root>

Collect errors with Fritzbox 6490 with OS version 6.87

I used the docker container, the docker logs gives this:

services loaded
2019/03/11 07:49:12 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:08:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:09:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:10:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:11:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:12:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:13:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:14:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
2019/03/11 08:15:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
result not found TotalAssociations
2019/03/11 08:17:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
result not found TotalAssociations
result not found TotalAssociations
result not found TotalAssociations
2019/03/11 08:20:10 could not call action: XML syntax error on line 1: element <HR> closed by </BODY>
result not found TotalAssociations

The output of the metrics endpoint is this:

# HELP fritzbox_exporter_collect_errors Number of collection errors.
# TYPE fritzbox_exporter_collect_errors counter
fritzbox_exporter_collect_errors 18
# HELP gateway_wan_bytes_receive_rate byte receive rate on gateway WAN interface
# TYPE gateway_wan_bytes_receive_rate gauge
gateway_wan_bytes_receive_rate{gateway="fritz.box"} 18065
# HELP gateway_wan_bytes_received bytes received on gateway WAN interface
# TYPE gateway_wan_bytes_received counter
gateway_wan_bytes_received{gateway="fritz.box"} 0
# HELP gateway_wan_bytes_send_rate byte send rate on gateway WAN interface
# TYPE gateway_wan_bytes_send_rate gauge
gateway_wan_bytes_send_rate{gateway="fritz.box"} 9596
# HELP gateway_wan_bytes_sent bytes sent on gateway WAN interface
# TYPE gateway_wan_bytes_sent counter
gateway_wan_bytes_sent{gateway="fritz.box"} 0
# HELP gateway_wan_connection_status WAN connection status (Connected = 1)
# TYPE gateway_wan_connection_status gauge
gateway_wan_connection_status{gateway="fritz.box"} 0
# HELP gateway_wan_connection_uptime_seconds WAN connection uptime
# TYPE gateway_wan_connection_uptime_seconds gauge
gateway_wan_connection_uptime_seconds{gateway="fritz.box"} 0
# HELP gateway_wan_layer1_downstream_max_bitrate Layer1 downstream max bitrate
# TYPE gateway_wan_layer1_downstream_max_bitrate gauge
gateway_wan_layer1_downstream_max_bitrate{gateway="fritz.box"} 2.12e+08
# HELP gateway_wan_layer1_link_status Status of physical link (Up = 1)
# TYPE gateway_wan_layer1_link_status gauge
gateway_wan_layer1_link_status{gateway="fritz.box"} 0
# HELP gateway_wan_layer1_upstream_max_bitrate Layer1 upstream max bitrate
# TYPE gateway_wan_layer1_upstream_max_bitrate gauge
gateway_wan_layer1_upstream_max_bitrate{gateway="fritz.box"} 2.65e+07
# HELP gateway_wan_packets_received packets received on gateway WAN interface
# TYPE gateway_wan_packets_received counter
gateway_wan_packets_received{gateway="fritz.box"} 0
# HELP gateway_wan_packets_sent packets sent on gateway WAN interface
# TYPE gateway_wan_packets_sent counter
gateway_wan_packets_sent{gateway="fritz.box"} 0
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 5.9123e-05
go_gc_duration_seconds{quantile="0.25"} 7.4359e-05
go_gc_duration_seconds{quantile="0.5"} 9.0119e-05
go_gc_duration_seconds{quantile="0.75"} 0.000175396
go_gc_duration_seconds{quantile="1"} 0.000209894
go_gc_duration_seconds_sum 0.002493336
go_gc_duration_seconds_count 22
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 11
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.11.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 1.931904e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 3.1779736e+07
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.452059e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 181837
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
go_memstats_gc_cpu_fraction 3.510988517134665e-06
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 2.371584e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 1.931904e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 6.201344e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 4.407296e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 12389
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 0
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 6.6420736e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.5522925301405578e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 194226
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 6912
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 16384
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 71136
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 81920
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 4.194304e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 1.253597e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 688128
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 688128
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 7.2284408e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 10
# HELP http_request_duration_microseconds The HTTP request latencies in microseconds.
# TYPE http_request_duration_microseconds summary
http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 856764.708
http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 859527.022
http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 859601.168
http_request_duration_microseconds_sum{handler="prometheus"} 1.5437948359000001e+07
http_request_duration_microseconds_count{handler="prometheus"} 18
# HELP http_request_size_bytes The HTTP request sizes in bytes.
# TYPE http_request_size_bytes summary
http_request_size_bytes{handler="prometheus",quantile="0.5"} 216
http_request_size_bytes{handler="prometheus",quantile="0.9"} 415
http_request_size_bytes{handler="prometheus",quantile="0.99"} 415
http_request_size_bytes_sum{handler="prometheus"} 4498
http_request_size_bytes_count{handler="prometheus"} 18
# HELP http_requests_total Total number of HTTP requests made.
# TYPE http_requests_total counter
http_requests_total{code="200",handler="prometheus",method="get"} 18
# HELP http_response_size_bytes The HTTP response sizes in bytes.
# TYPE http_response_size_bytes summary
http_response_size_bytes{handler="prometheus",quantile="0.5"} 1946
http_response_size_bytes{handler="prometheus",quantile="0.9"} 1960
http_response_size_bytes{handler="prometheus",quantile="0.99"} 1961
http_response_size_bytes_sum{handler="prometheus"} 34876
http_response_size_bytes_count{handler="prometheus"} 18
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.41
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 9
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.4073856e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.55229042655e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.13967104e+08
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1

main.go missing

Hi, after your merge and added .gitignore on Oct 16, the repo seems to be broken, at least from the point of view from the forked one, so it cannot be built anymore.

Docker Image not working anymore

Just asking, but is something about the image not working?
I did compile the binary on my system last night and got

gateway_wan_bytes_received{gateway="fritz.box"} 1.1767101047e+10

Or in my debugging

11767101047

With the image from last night i got

3181655973

And with the updated image from 3h before now, i get only fritzbox_exporter_collect_errors as variable and no gateway ones

PS: maybe docker registry didn't get me the recent image last night but cannot check anymore (only one tag on docker hub)

How to connect to Grafana Dashboard?

Hello, sorry I know this is not a "issue" more a question.

I can start the Docker Container, he is up and running. I can see my telemetrics.

But If I try to connect the grafana Dashboard with Prometheus it doesent work.

Can someone told me, wich data I have to enter in the Grafana Part to get it work?

Support other UPnP IGDs

TL;DR, I think the current implementation can support non-fritzbox modems fairly quickly.
Sharing some info that I have.

Scrolling through the code, most of it uses UPnP's intended workflow to gather data.
However one main issue stops it from being generic: hardcoding /igddesc.xml and /tr64desc.xml for the device descriptors.

response, err := http.Get(fmt.Sprintf("%s/igddesc.xml", r.BaseURL))

igddesc, err := http.Get(fmt.Sprintf("%s/tr64desc.xml", r.BaseURL))

SSDP

The typical UPnP approach would be to do an SSDP query, matching
ST urn:schemas-upnp-org:device:InternetGatewayDevice:1.

My ARRIS modem then reports http://192.168.178.1:5000/rootDesc.xml.
Be sure to try it yourself, ssdp-query urn:schemas-upnp-org:device:InternetGatewayDevice:1.

Afaik, service discovery is not normally the job of an exporter.
Rather I would suggest to accept the URLs of a device descriptor, instead of separate host + port + hardcoded path.

Users could set their target to:

  • http://fritz.box:49000/igddesc.xml
  • http://fritz.box:49000/tr64desc.xml
  • http://192.168.178.1:5000/rootDesc.xml

Or whatever else their SSDP query returns. Very similar to the http blackbox exporter.

Service base URL

SCDP and Control URLs are used here, which are typically relative. According to the UPnP spec, they follow RFC3986 section 5. In short that means it's the same as webpages, /something.xml is a resource from the root and something.xml is a sibling to the current path.

For compatibility we shouldn't use sprintf for this, as we have func (*URL) ResolveReference. (Note the mention of the same RFC)

Available metrics

The upnp.org services are outlined here: https://openconnectivity.org/developer/specifications/upnp-resources/upnp/internet-gateway-device-igd-v-2-0/

The Arris modem supports:

There's other worthwhile data in these specs. Such as WANIPConnection.ExternalIPAddress (required) or that WANCommonInterfaceConfig.GetAddonInfos is non-standard and other devices may need individual GetTotalBytesSent, GetTotalBytesReceived, etc. actions to fetch this.

Enhance documentation and error reporting

Hi there.

I am trying to run the docker image but it seems to fail. The error message does not really indicate what I could fix. It's a new setup so it never worked before...

docker run --net=host -p9133:9133 mxschmitt/fritzbox_exporter -stdout
WARNING: Published ports are discarded when using host network mode
2019/12/09 21:15:53 could not print metrics to stdout: could not load UPnP service: could not load Tr64: could not decode XML: XML syntax error on line 1: element <HR> closed by </BODY>

If I try to access the metrics I get this:

curl http://localhost:9133
404 page not found

All this is run against a Fritzbox 7490 that has metrics exposed via UPNP.

curl http://fritz.box:49000/igddesc.xml
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>
<friendlyName>Gateway</friendlyName>
<manufacturer>AVM Berlin</manufacturer>
...

ARM Support on Docker-Hub

I would like to run the docker_exporter on my Raspberry PI. Could you please publish your Docker image for arm on Docker-Hub?

set env variables

Hi, thanks for the great work!!

My Fritz!Box is however not reachable on its default address so it would be very practical if the next values could be set through docker "ENV" variables:

	flag.StringVar(&settings.FritzBox.IP, "gateway-address", "fritz.box", "The hostname or IP of the FRITZ!Box")
	flag.IntVar(&settings.FritzBox.Port, "gateway-port", 49000, "The port of the FRITZ!Box UPnP service")
	flag.StringVar(&settings.FritzBox.UserName, "username", "", "The user for the FRITZ!Box UPnP service")
	flag.StringVar(&settings.FritzBox.Password, "password", "", "The password for the FRITZ!Box UPnP service")

Jumping counter on connection loss

Because my FritzBox currently frequently loses the DSL Connection (thanks 1and1), I started monitoring it with this tool.

However, the gateway_wan_bytes_received and gateway_wan_bytes_sent counters show an odd behaviour:

Screen Shot 2020-04-18 at 13 04 28

Prometheus counters should never jump between two levels โ€“ only ever reset and rise again. This yields the rate of this metric unusable, because it suggests a throughput of over 25MB/s, which is far higher than the 6MB/s = 50MBit/s my connection can handle

Manual way to set ip of fritzbox

Is there an manual way to set the ip of the fritzbox via docker variable or so ?

This error I get because I using a other dns server which can not resolve fritz.box.

cannot load services: could not load root element: could not get igddesc.xml: Get http://fritz.box:49000/igddesc.xml: dial tcp: lookup fritz.box on 1.1.1.1:53: no such host

Raspberry Pi: exec user process caused "exec format error"

Hi,

I'm using the docker image 'mxschmitt/fritzbox_exporter'. In a linux VM everything is just plain fine.
When I use the same docker-compose on my Raspberry Pi I get:
standard_init_linux.go:211: exec user process caused "exec format error"

Any clue how to solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.