Closed mcktr closed 4 years ago
Example:
./check_fritz -H 192.168.178.1 -p *** -m downstream_max -w 115 -c 116
CRITICAL - Max Downstream: 114.11 Mbit/s, Downstream SyncGroup 'sync_dsl': 114.11 Mbit/s | 'downstream_max_sync_dsl'=114.110000;115.000000;116.000000;; 'downstream_max'=114.110000;115.000000;116.000000;;
./check_fritz -H 192.168.178.1 -p *** -m upstream_max
OK - Max Upstream: 34.96 Mbit/s, Upstream SyncGroup 'sync_dsl': 34.96 Mbit/s | 'upstream_max_sync_dsl'=34.957000;;;; 'upstream_max'=34.957000;;;;
@uclara Can you have a look on this new PR please? :-) Freshly build binaries can be found here: https://github.com/mcktr/check_fritz/actions/runs/133478648
I changed the downstream_max
and upstream_max
functions to query all sync groups and calculate a combined max downstream/upstream value. The single values for each sync group will also be printed and is made available via PerformanceData to import it in a graphing tool like Grafana.
For now I wish you a nice weekend. ;-)
@mcktr I installed the version you build 9 days ago. It's funny to see the combination of different sync groups, but I don't understand for what it should be used. I tested with my FRITZ!Box 6591 Cable/FRITZ!OS: 07.13.
check_fritz reports for Max Downstream:
check_fritz reports for Max Upstream:
I use the LAN port to connect the FRITZ!Box to my LAN, and the Cable port ti connect to Vodafone Kabel/Deutschland. The sum of both ports does't make sense from my point of view and should be at least optional. Perhaps it is useful for scenarios in which two Internet uplinks are used in parallel, e.g. DSL or Cable + LTE USB stick, but I'm not sure that they can be used in parallel, but rather as active / passive. In this case, the sum would bring very little.
In my opinion it would be better to configure the sync groups individually as a service than in combination.
But maybe I didn't quite understand what you wanted to do with it :-)
PS: It is also interesting that sync_lan0 is asymmetrical and displays 1024 Mbit/s in the downstream and only 99.999 Mbit/s in the upstream. Maybe lan0 is not the ethernet interface to the LAN, but is it a virtual interface to the cable modem?
I'll take a look at my remaining FRITZ! Boxes with your test code in the next few days, maybe I'll find something ...
Ulli
@uclara The problem here is that there is no way (that I know of) to query a sync group via an permanent identifier. There is an ongoing number or the name that you can use to identify the sync group, both can change after a reboot, update or even on a reconnect. Using one of of this as an identifier and a change happens this would mess with the configured service in your monitoring solution.
How about an additional parameter to set a ignore list of sync groups that will be skipped when querying?
Did you notice any other issues in this regard with your other Fritz!Box devices?
Thanks! Michael
@mcktr the idea sounds good, maybe with a similar tool like the "getSecurityPort" that was used with check_tr64_fritz to get the port number for the FRITZ!Box. In that way everybody can see what's available via the API and configure what's needed. Maybe the default behaviour should stay as it is today in the stable version.
Otherwise, I have unfortunately found nothing else, because at the moment I am struggling with the configuration of the services for the various FRITZ! Boxes. I would like to show related services together under the host. I can remember that something was possible in Nagios by using a second attribute for sorting. You could use a number to arrange the order of the services as you like - is that also possible with Icinga2?
PS: I use Consol Labs OMD with Icinga2 as core and Thruk as frontend
@mcktr the idea sounds good, maybe with a similar tool like the "getSecurityPort" that was used with check_tr64_fritz to get the port number for the FRITZ!Box.
Thanks for that suggestion @uclara, but is such a tool really necessary if we went with a ignore list for sync groups? You can run the check plugin once and see all sync groups, now you can set the appropriate ignore list entries. Nonetheless this should be well documented.
In that way everybody can see what's available via the API and configure what's needed. Maybe the default behaviour should stay as it is today in the stable version.
The default behavior in the current stable version does not respect cable sync groups since on a cable connection you have two sync groups. If you are lucky and the cable sync group has the id 0 you'll get the correct down-/upstream, if the lan sync group has id 0 you'll get wrong values. Im also not happy with changing the default behavior but I see no other way to implement this in a sane way other than with this PR. If the sync group had permanent identifiers this would be more less complicated to find a sane solution, but they haven't. :-(
I would like to show related services together under the host. I can remember that something was possible in Nagios by using a second attribute for sorting. You could use a number to arrange the order of the services as you like - is that also possible with Icinga2?
Sorry I don't know Nagios or Thruk only Icinga Web 2. In Icinga Web 2 you have a host overview, if you click on the host you have the services related to this host in alphabetical order.
Best regards Michael
@mcktr: I agree with you. Maybe it would be possible to get in contact with AVM developers in the future to exchange ideas and suggestions regarding their FRITZ!OS API. Unfortunately I haven't any contacts ...
Regarding the sorting of the services I will get a try to Icinga Web 😄
Ulli
Hello @uclara,
sorry that my response is so late. I had a couple of personal things to sort out. I'll try to be more active again from now on.
I implemented the mentioned ignore list for sync groups, can you may give it a try to see if this fits your needs? :-)
An example:
.\check_fritz -H 192.168.178.1 -p secret -m upstream_max --ignoresyncgroups "sync_dsl,cable_lan"
The --ignoresyncgroups
sets the sync groups you don't want to consider in the final output. You can find freshly build binaries here: https://github.com/mcktr/check_fritz/actions/runs/232521527
I'm looking forward to your feedback.
Best regards Michael
just downloaded the latest version. My Fritzbox 6591 is running Fritz!OS 7.21 now. When running
check_fritz -H
goroutine 1 [running]: main.isInIgnoreList(0x0, 0xc00000a1b0, 0xa, 0x1) D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:86 +0x2d main.CheckUpstreamMax(0xc000139c50, 0xc000139c10, 0xc000139c00, 0xc000139c20, 0xc000139c40, 0x0, 0x0, 0x0, 0xc000139bd0, 0xc000139c30, ...) D:/a/check_fritz/check_fritz/cmd/check_fritz/check_upstream.go:80 +0xc36 main.checkMain(0xc000090c80, 0xc0000a7400, 0x18) D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:194 +0x5c0 github.com/urfave/cli/v2.(App).RunContext(0xc000084600, 0x8c20e0, 0xc0000b0188, 0xc0000e2000, 0xb, 0x10, 0x0, 0x0) C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:315 +0x712 github.com/urfave/cli/v2.(App).Run(...) C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:215 main.main() D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:334 +0xb4b
<?xml version="1.0"?>
<?xml version="1.0"?>
panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x7716fd]
goroutine 1 [running]: main.isInIgnoreList(0x0, 0xc0000a6820, 0xa, 0x1) D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:86 +0x2d main.CheckUpstreamMax(0xc000165c50, 0xc000165c10, 0xc000165c00, 0xc000165c20, 0xc000165c40, 0x0, 0x0, 0x0, 0xc000165bd0, 0xc000165c30, ...) D:/a/check_fritz/check_fritz/cmd/check_fritz/check_upstream.go:80 +0xc36 main.checkMain(0xc00004ec80, 0xc000005500, 0x18) D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:194 +0x5c0 github.com/urfave/cli/v2.(App).RunContext(0xc00003af00, 0x8c20e0, 0xc00000a1e0, 0xc00010c000, 0xc, 0x10, 0x0, 0x0) C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:315 +0x712 github.com/urfave/cli/v2.(App).Run(...) C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:215 main.main() D:/a/check_fritz/check_fritz/cmd/check_fritz/main.go:334 +0xb4b
if I add the -ignoresysncgroups parameter, the panic disappears, but the values given are not correct (6433 Mbits instead of about 50 MBits for example)
Hi @dirkpauli
first of all thanks for testing this PR! I fixed the issue with the nil pointer dereference, this was indeed a programming mistake.
Can you please re-test the fixed version? You can find the fixed version here: https://github.com/mcktr/check_fritz/actions/runs/256111155
if I add the -ignoresysncgroups parameter, the panic disappears, but the values given are not correct (6433 Mbits instead of about 50 MBits for example)
Can you please share the exact plugin call and the exact plugin output here? (hide credentials nonetheless)
Thanks! Michael
sorry, nothing available to download, can you please re-provide the new build?
Thanks
Dirk
Gesendet: Dienstag, 15. September 2020 um 19:39 Uhr Von: "Michael Insel" notifications@github.com An: "mcktr/check_fritz" check_fritz@noreply.github.com Cc: "dirkpauli" dpauli@gmx.net, "Mention" mention@noreply.github.com Betreff: Re: [mcktr/check_fritz] Query all sync groups on downstream_max/upstream_max (#83)
Hi @dirkpauli
first of all thanks for testing this PR! I fixed the issue with the nil pointer dereference, this was indeed a programming mistake.
Can you please re-test the fixed version? You can find the fixed version here: https://github.com/mcktr/check_fritz/actions/runs/256111155
if I add the -ignoresysncgroups parameter, the panic disappears, but the values given are not correct (6433 Mbits instead of about 50 MBits for example)
Can you please share the exact plugin call and the exact plugin output here? (hide credentials nonetheless)
Thanks! Michael
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
sorry, oversaw that I was'nt logged on.
check_fritz -H
<?xml version="1.0"?>
OK - 0.00% Downstream utilization (0.00 Mbit/s of 6792.21 Mbits) | 'downstream_usage'=0.000019;;;0.000000;100.000000`
@dirkpauli This PR is about the methods upstream_max
and downstream_max
can you run these methods?
that makes no difference at all, anyway: check_fritz -H -u -p --modelgroup cable -m downstream_max -d
<?xml version="1.0"?>
<?xml version="1.0"?>
OK - Max Downstream: 6792.21 Mbit/s, Downstream SyncGroup 'sync_cable': 6792.21 Mbit/s, Downstream SyncGroup 'sync_lan0': 0.00 Mbit/s | 'downstream_max_sync_cable'=6792.208872;;;; 'downstream_max_sync_lan0'=0.000000;;;; 'downstream_max'=6792.208872;;;;
Can you please show me the graphs from the Fritz!Box interface?
here we go:
Thanks @dirkpauli! I really appreciate your help! :+1:
I think I now know whats going on here. The methods downstream_max
, downstream_usage
and the upstream equivalents uses the following information to calculate the max up-/downstream.
<Newmax_ds>849026109</Newmax_ds>
<Newmax_us>793700759</Newmax_us>
It seems to be that this information is not the max link upstream/downstream, but the max measured upstream/downstream. I can see the same behavior on my DSL Fritz!Box. Still, I don't have a clue why the values are that high on your Fritz!Box.
I need to change the information source for the mentioned functions to use the correct value for upstream/downstream. This will take some time, I'll look into it over the weekend. Can you come back on monday and have a look for an update here? :-)
you're welcome.
Regarding your assumption: I don't think that those values are related to the measured up/downstream. I just made a test producing heaviy load (until the maximum capacity) on the downstream. The scales in the diagram changed to show the download rate. however, the number returned from your tool remained the same and so did the upload value.
just to let you know to avoid searching at the wrong place...
Regards
Dirk
Gesendet: Donnerstag, 24. September 2020 um 21:59 Uhr Von: "Michael Insel" notifications@github.com An: "mcktr/check_fritz" check_fritz@noreply.github.com Cc: "dirkpauli" dpauli@gmx.net, "Mention" mention@noreply.github.com Betreff: Re: [mcktr/check_fritz] Query all sync groups on downstream_max/upstream_max (#83)
Thanks @dirkpauli! I really appreciate your help! 👍
I think I now know whats going on here. The methods downstream_max, downstream_usage and the upstream equivalents uses the following information to calculate the max up-/downstream.
´´´
It seems to be that this information is not the max link upstream/downstream, but the max measured upstream/downstream. I can see the same behavior on my DSL Fritz!Box. Still, I don't have a clue why the values are that high on your Fritz!Box.
I need to change the information source for the mentioned functions to use the correct value for upstream/downstream. This will take some time, I'll look into it over the weekend. Can you come back on monday and have a look for an update here? :-)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi @dirkpauli,
thanks for the input. Can you do me a favor and run the following script? The script has two purposes, 1: It should output all available TR-064 services (meaning list all available information sources we can query using the TR-064 protocol), 2: output the information from one specific TR-064 service called WANDSLInterfaceConfig
.
#!/usr/bin/env bash
HOSTNAME="fritz.box"
PORT="49443"
USERNAME="dslf-config"
while getopts h:p:u:P:U:s:a:x: OPTNAME; do
case "${OPTNAME}" in
h)
HOSTNAME="${OPTARG}"
;;
p)
PORT="${OPTARG}"
;;
u)
USERNAME="${OPTARG}"
;;
P)
PASSWORD="${OPTARG}"
;;
U)
url="${OPTARG}"
;;
s)
service="${OPTARG}"
;;
a)
action="${OPTARG}"
;;
x)
xmlVar="${OPTARG}"
;;
*)
echo "fetch_tr64_data.sh -h <HOST> -p <PORT> -u <USER> -P <PASSWORD> -U <URL> -s <SERVICE> -a <ACTION> -x <xmlVar>"
exit 0
;;
esac
done
echo ""
echo ""
echo "${HOSTNAME}"
echo "${PORT}"
echo "${USERNAME}"
echo "${url}"
echo "${service}"
echo "${action}"
echo "${xmlVar}"
echo ""
echo ""
queryResult=$(curl "https://${HOSTNAME}:${PORT}/tr64desc.xml" \
-k \
-s \
-u "${USERNAME}:${PASSWORD}" \
--anyauth \
-H "Content-Type: text/xml; charset='utf-8'" \
)
echo "${queryResult}"
echo ""
echo ""
queryResult=$(curl "https://${HOSTNAME}:${PORT}/upnp/control/${url}" \
-k \
-s \
-u "${USERNAME}:${PASSWORD}" \
--anyauth \
-H "Content-Type: text/xml; charset='utf-8'" \
-H "SOAPACTION: urn:dslforum-org:service:${service}:1#${action}" \
-d "<?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:${action} xmlns:u='urn:dslforum-org:service:${service}:1'> ${xmlVar} </u:${action}> </s:Body> </s:Envelope>"
)
echo "${queryResult}"
Just copy this script on your Linux host and save it as script.sh
for example, afterwards run this command to make it executable:
chmod +x script.sh
Now you can run the script:
./script.sh -P yourpassword -U "wandslifconfig1" -s "WANDSLInterfaceConfig" -a "GetInfo"
Please use the same values for -U
-s
-a
since this tells the script which TR-064 service should be called. You can use -h
to define your Fritz!Box address, -u
for your user and -P
is your password.
Please share the whole output here. If you are worried about exposing sensitive information to the public you can email me directly using my GitHub email, should be visible on the left side if you are logged in.
I already found a way how to query the correct value using a DSL Fritz!Box. With this step I'll verify if this would also work on a cable Fritz!Box.
Thanks a lot!
Best regards Michael
192.168.200.1 49443 test wandslifconfig1 WANDSLInterfaceConfig GetInfo
<?xml version="1.0"?>
<?xml version="1.0"?>
</s:Fault> </s:Body> </s:Envelope>
Closed in favor of #97
Changes the downstream_max and upstream_max method to query all found sync groups to ensure a correct calculated max down-/up-stream value.
ToDo
fixes #72