zabbix-template-speedtest icon indicating copy to clipboard operation
zabbix-template-speedtest copied to clipboard

Add Timeout of 5m to zbx-speedtest.sh

Open elekgeek opened this issue 4 years ago • 12 comments

This change is originally proposed by someone else @garbled1 but it was on the wrong file but still I believe this change should be applied to all scripts, nevertheless to speed things up, I just proposed the same exact change to avoid forcing people looking up why this script hangs and no longer works.

elekgeek avatar Jun 25 '20 14:06 elekgeek

sure, let me read your script and see how I will do that correctly concerning the timeout. I assume also zabbix template has to be changed as well, am I correct?

elekgeek avatar Jun 25 '20 15:06 elekgeek

Yeah probably, ideally the timeout would be a macro à la {#SPEEDTEST_TIMEOUT}. I forgot about that part.

pschmitt avatar Jun 25 '20 15:06 pschmitt

Quick note: I just checked on a vanilla install of OpenWRT 19.03 -> timeout isn't installed by default. This needs to be mentioned in the dependencies section of the README.

Sorry for dumping all these change requests on you like this, I'm really not trying to be a dick. Thanks for your interest in this particular piece of software and your work on this PR 🙏

pschmitt avatar Jun 25 '20 16:06 pschmitt

I noticed that timeout 5m doesn't solve the hanging issue, I checked when I arrived home ps aux | grep zbx-speedtest.sh has been running for the last 2 hours.

I should find the actual reason behind this failure first.

elekgeek avatar Jun 25 '20 19:06 elekgeek

  1. I found that the user should be zabbix rather than zabbix-agent in zabbix-speedtest.service.

  2. I don't believe that adding {$SPEEDTEST_TIMEOUT} is necessary to zabbix template template_speedtest.xml and zbx-speedtest.sh. I ran time speedtest --accept-license --accept-gdpr -f json for 50Mbps line 10 times, the average was 26.5 seconds, so having timeout 1m in zbx-speedtest.sh is more than enough to avoid speedtest troubles. Add to it is that the real value that matters is OnCalendar=*:0/x in zabbix-speedtest.timer, this value should never be less than 2 minutes, the same value of 2 minutes limitation applies to {$UPDATE_INTERVAL} that is mentioned in pt. 3, and this has to be reflected in README.

  3. The more important thing was I added {$UPDATE_INTERVAL} macro to zabbix template, and replaced 5m value for Update interval with {$UPDATE_INTERVAL} so it is only once place where you have to change update interval for all items based on the value of OnCalender in the zabbix-speedtest.timer

If you agree on these changes let me know so I create complete pull request for all related files.

elekgeek avatar Jun 27 '20 13:06 elekgeek

  1. I found that the user should be zabbix rather than zabbix-agent in zabbix-speedtest.service.

This is distro-specific. To really make this work everywhere I guess I'll have to implement an install.sh script. Anyway: this is out of scope for this PR.

  1. The real value that matters is OnCalendar=*:0/x

You are correct. This is definitely the better approach.

I ran time speedtest --accept-license --accept-gdpr -f json for 50Mbps line 10 times, the average was 26.5 seconds, so having timeout 1m in zbx-speedtest.sh is more than enough to avoid speedtest troubles

Not everybody has a 50Mb line... I won't merge a timeout of 1m. That's just too low IMHO.

  1. The more important thing was I added {$UPDATE_INTERVAL} macro to zabbix template, and replaced 5m value for Update interval with {$UPDATE_INTERVAL} so it is only once place where you have to change update interval for all items based on the value of OnCalender in the zabbix-speedtest.timer

👍

pschmitt avatar Jul 02 '20 06:07 pschmitt

I am new to this pull request thing to be honest, and it's making me more nervous when I say this is the first time I do a pull request :) anyway, just let me know what you need from me, and I will try to do the best I can.

elekgeek avatar Jul 02 '20 09:07 elekgeek

man I re-read this discussion, this discussion should never be in a pull request :)

elekgeek avatar Jul 02 '20 11:07 elekgeek

No harm done. Not all of it was off-topic ;)

pschmitt avatar Jul 02 '20 14:07 pschmitt

@elekgeek you still on this? or should I discard this PR?

pschmitt avatar Nov 21 '20 22:11 pschmitt

I did the mods locally, let me check what I did tomorrow, and will get back to you

On Sun, Nov 22, 2020, 12:43 AM Philipp Schmitt [email protected] wrote:

@elekgeek https://github.com/elekgeek you still on this? or should I discard this PR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pschmitt/zabbix-template-speedtest/pull/12#issuecomment-731647700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5THD62L2MWYAF7QETM32DSRA7BLANCNFSM4OIOLGOQ .

elekgeek avatar Nov 21 '20 23:11 elekgeek

Untitled

pschmitt avatar Nov 26 '20 08:11 pschmitt