arevindh / pihole-speedtest

Pihole Speedtest Mod
https://arevindh.github.io/pihole-speedtest/
MIT License
218 stars 22 forks source link

Scheduled Tests Fail to Run & Invalid Date error in Speedtest Log table #154

Closed town3r closed 4 months ago

town3r commented 5 months ago

Hi there!

I'm back, reinstalled the plugin yesterday after the install/update script was updated.

It seemed to be working correctly, but I failed to notice the scheduled tests were not either running successfully, or failing to be detected by the plugin.

I did notice that the Run Test Now option does not seem to work w/ my installation.

The Speedtest Log table is also showing Invalid date under the Test time column.

image

image

Any idea what could be occurring?

The few tests that do show up were ran via the Test Pihole Speedtest from command line command:

sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh"

arevindh commented 5 months ago

@town3r

  1. which browser are you using?
  2. Are there any logs on the browser console?
town3r commented 5 months ago

Ahh good call.

Those Invalid date values seem to only show up on Safari.

iOS iPadOS macOS

I don't have safari installed on my windows machine.

town3r commented 5 months ago

Seeing one warning error message in the Dev Console:

[Warning] 
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. 
moment construction falls back to js Date(), which is not reliable across all browsers and versions. 
Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info. (moment.min.js, line 1)

Arguments: 
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 2024-01-22 12:24:56 CST, _f: undefined, _strict: undefined, _locale: [object Object]
@http://192.168.1.10/admin/scripts/vendor/moment.min.js:1:3266
Nt@http://192.168.1.10/admin/scripts/vendor/moment.min.js:1:21610
Pt@http://192.168.1.10/admin/scripts/vendor/moment.min.js:1:22166
render@http://192.168.1.10/admin/scripts/pi-hole/js/speedresults.js:51:45
@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:43:471
@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:37:234
F@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:42:186
Ka@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:50:96
R@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:41:450
@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:74:398
k@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:60:486
success@http://192.168.1.10/admin/scripts/vendor/datatables.min.js:61:195
c@http://192.168.1.10/admin/scripts/vendor/jquery.min.js:2:28332
fireWith@http://192.168.1.10/admin/scripts/vendor/jquery.min.js:2:29073
l@http://192.168.1.10/admin/scripts/vendor/jquery.min.js:2:80056
@http://192.168.1.10/admin/scripts/vendor/jquery.min.js:2:82500
ipitio commented 5 months ago

Thanks for getting the new update! The invalid date in the log is fixed in https://github.com/arevindh/AdminLTE/pull/84

I'll need your help to figure out why the speedtests aren't running even though calling speedtest.sh directly works. Update from my repo then do the following.

curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s up

Now run pihole -a -sn and about a minute or two later check the web interface to see if a test ran. Did it?

And for the scheduled ones, could you show me the output of these two commands:

systemctl status pihole-speedtest.timer
systemctl status pihole-speedtest

The timer should always be active (waiting), and the service should be inactive (dead) unless a scheduled test is running.

town3r commented 5 months ago

Sorry for the delay @ipitio & thank you for helping figure this out. :)

Updated via your repo.

Which seems to have resolved the date issue.

image

Two tests ran: image

But then the pihole-Speedtest.timer command seems to freeze and fail to run correctly? Looks like the pihole-Speedtest-timer is waiting but the command gets stuck on on lines 1-7/7 (END)` image

town3r commented 5 months ago

Here's the output for systemctl status pihole-speedtest

image

town3r commented 5 months ago

Doesn't look like either of those commands added Speedtest results to the Speedtest Log

ipitio commented 5 months ago

Oh yeah, to get out of the (END) thing you have to press ctrl+c.

So the run test now button works now, or was that using pihole -a -sn?

Those commands are just to check whether the schedule is active, the speedtest script itself adds results to the log. Are scheduled tests running?

town3r commented 5 months ago

Huzzah

Looks like it's working again. :)

Both the Start a test now option and the hourly tests. 🥳

image

ipitio commented 5 months ago

@town3r could you update from my repo again (using the pipe-to-bash, not the button in settings) and let me know if everything still works for you. I've made a few more changes..

town3r commented 5 months ago

Looks like it's still working!

Including the run test now button.

Did you move the graph below total queries & client activity or had it always been at the bottom.

It was in the middle previously right? lol

Anything else I should look out for?

town3r commented 5 months ago

Does this link work for anyone?

https://c.speedtest.net/speedtest-servers-static.php

ipitio commented 5 months ago

Yeah I reorganized/revamped settings, allowing any number of hours or days to be input, moved the chart down, and made a bunch of little fixes.

What do you think of having the chart under the other two? I moved it because it seemed, to me, to interrupt the stacked bar charts, considering it's either not stacked or not a bar chart. Did you like it better between?

That link returns XML so doesn't work in iOS Safari. I'm not sure what the new Safaris can do, but maybe you can download the page (which should download the XML). I could probably do something about this..

town3r commented 5 months ago

What do you think of having the chart under the other two? I moved it because it seemed, to me, to interrupt the stacked bar charts, considering it's either not stacked or not a bar chart. Did you like it better between?

I like it! I had just gotten used to it being in the middle.

That link returns XML so doesn't work in iOS Safari. I'm not sure what the new Safaris can do, but maybe you can download the page (which should download the XML). I could probably do something about this..

Good catch, had to use a safari extension for it to show up as not blank.

ipitio commented 5 months ago

If you wanna review the latest changes before they get merged, now would be a good time to update using my repo again :)

town3r commented 5 months ago

Updated! Searching for any changes :D

town3r commented 5 months ago

Oh nice! That show closest server box is 🔥

town3r commented 5 months ago

Hmm the results in the Server list seem to be kinda random or off compaired to running speedtest -L.

Oh duh, it's just pulling w/e is outputted on https://c.speedtest.net/speedtest-servers-static.php

Which for me only lists one server in my city, where speedtest -L lists 5 in my city and a good number of additional options close by.

Not to go totally off the rails, do you think you could make it so hitting Show closes servers triggers speedtest -L being ran instead of pulling from speedtest-servers-static.php?

arevindh commented 5 months ago

Hmm the results in the Server list seem to be kinda random or off compaired to running speedtest -L.

Oh duh, it's just pulling w/e is outputted on https://c.speedtest.net/speedtest-servers-static.php

Which for me only lists one server in my city, where speedtest -L lists 5 in my city and a good number of additional options close by.

Not to go totally off the rails, do you think you could make it so hitting Show closes servers triggers speedtest -L being ran instead of pulling from speedtest-servers-static.php?

Can you try https://www.speedtest.net/api/js/servers?engine=js&limit=10&https_functional=true

town3r commented 5 months ago

Those look much better

ipitio commented 5 months ago

Alright, I updated it to use that link, you should have all your servers now. I'd use speedtest -L but it seems to have a bug when called from a php environment that causes it to fail.

Actually, I do use it, and since it's failing, it's failing over to the link.

town3r commented 5 months ago

Amazing! Looks much better now. :)

arevindh commented 5 months ago

Amazing! Looks much better now. :)

Changes merged, can you check if everything is fine?

town3r commented 5 months ago

I'm getting this after first attempt at the reinstall mod under settings:

Thanks for using Speedtest Mod!
Script by @ipitio

Wed Jan 31 14:42:48 CST 2024

Restoring Pi-hole...
HEAD is now at be05b0f6 v5.21 (#2860)
HEAD is now at a2772d43 Merge pull request #83 from ipitio/master
Updating Pi-hole...
  [i] Update local cache of available packages...
  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.4.33
  [i] Checking for git...
  [✓] Checking for git
  [i] Checking for iproute2...
  [✓] Checking for iproute2
  [i] Checking for dialog...
  [✓] Checking for dialog
  [i] Checking for ca-certificates...
  [✓] Checking for ca-certificates

  [i] Checking for updates...
  [i] Pi-hole Core: up to date
fatal: HEAD does not point to a branch

  Error: Remote revision could not be obtained, please contact Pi-hole Support
  Additional debugging output:
HEAD detached at v5.21.1
nothing to commit, working tree clean
Installing Mod...
HEAD is now at eacbe336 we're already at the latest tag
Previous HEAD position was eacbe336 we're already at the latest tag
HEAD is now at a8687511 Merge branch 'arevindh:master' into speedOverTimeChart
HEAD is now at 17cb5839 Merge pull request #84 from ipitio/master
Previous HEAD position was 17cb5839 Merge pull request #84 from ipitio/master
HEAD is now at a2772d43 Merge pull request #83 from ipitio/master
cp: cannot stat '/opt/mod_pihole/advanced/Scripts/speedtestmod': No such file or directory
Process Aborting...
HEAD is now at 6bf07e2a higher
Previous HEAD position was 6bf07e2a higher
HEAD is now at 17cb5839 Merge pull request #84 from ipitio/master
Please try again or try manually.
town3r commented 5 months ago

And now these after attempting @ipitio update script and then yours @arevindh

image

ipitio commented 5 months ago

I have a fix submitted for that. Right now you can run the script with "un" to uninstall, then without args or with "up" to install

town3r commented 5 months ago

image

town3r commented 5 months ago

Any idea what's causing these errors when trying to update?

image

town3r commented 5 months ago

Tried to uninstall and reinstall but it fails.

image

town3r commented 5 months ago

I went through the manual uninstall steps and found the Web Interface still shows as VDEV (Head, V5.21.3)

I think everything else uninstalled correctly.

Ope pihole -r restored it back to default.

arevindh commented 5 months ago

I think there is some issue with curl command

try this sudo apt install gnutls-bin

town3r commented 5 months ago

image

ipitio commented 5 months ago

That seems to be related to the fatal error, I think, which #157 should fix

town3r commented 4 months ago

Nice! Any idea when the fixes will be pushed out? 😄

ipitio commented 4 months ago

I guess now haha

town3r commented 4 months ago

I think it worked. Other than the error from Pihole directly.

image

ipitio commented 4 months ago

Huh I guess I didn't fix it, but now I have a better idea of why that happens. To test my hypothesis, could you update using my dev repo? If I'm right, you won't encounter the issue because it doesn't pin admin to a tag for dev purposes.

curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s up
ipitio commented 4 months ago

I think #159 should fix it.

town3r commented 4 months ago

Two issues currently.

  1. Unable to update the Testing interval value to anything but 0 resulting in no tests running.

  2. Unable to update.

image

town3r commented 4 months ago

I'll try uninstalling and reinstalling the mod fresh.

town3r commented 4 months ago

No dice.

Screenshot 24

ipitio commented 4 months ago

Ooh a new error, I'll get right on that.

What exactly happens with the testing interval? You try setting it to some positive value, but when hitting confirm it goes back to 0?

town3r commented 4 months ago

Yup!

When the Mod was installed, anything other than 0 entered in that field after saving and the auto refresh of the page, it would be back to 0.

Didn't see anything pop-up in the recent logs when clicking the button.

ipitio commented 4 months ago

Could you try installing the mod from my repo? I have verbose logging enabled there so I can see where exactly that error happens.

curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash

I also can't reproduce the testing interval issue; what does the "show status" say after you try changing the interval?

town3r commented 4 months ago

Fresh install via your repo seems to work successfully.

The testing interval issue also seems to be gone as well. Schedule is inactive is what it used to say.

Where now it's active w/ a count don to next run.

ipitio commented 4 months ago

That's interesting. Well, since it's working for you now let's wait till sid merges my latest PRs and see if it still doesn't work for you then.

town3r commented 4 months ago

Once merged, should I uninstalled, and then reinstall fresh from his repo?

Could switching between the two repos when running the upgrade command be breaking things?

ipitio commented 4 months ago

You should be able to just upgrade with the script in sid's repo. Upgrading, uninstalling, even switching repos should be transparent.

The only difference in sid's repo is a check for the latest release so that you don't get any yet-untagged changes that may/may not work. I suspect it's this check that could be causing issues but not sure.

town3r commented 4 months ago

Got this after seeing the update was pushed early this morning.

image

ipitio commented 4 months ago

@town3r If the following works for you, I'll merge the PR.

curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s up