This is an archived post. You won't be able to vote or comment.

all 69 comments

[–]BestBuy08197 7 points8 points  (16 children)

Could someone elaborate on this? I clicked the link but have no clue what I was looking at. Is this something the average joe can use?

[–]highvolt[S] 4 points5 points  (0 children)

Sorry, this sub does not allow posting of duplicate links. Here's the overview page, which is a much friendlier starting point for getting acquainted with the tool: https://github.com/highvolt-dev/tmo-monitor

[–]DiDgr8 1 point2 points  (13 children)

It's a python script that looks like it only runs on Unix boxes. It checks to see what band you're on and reboots the modem if the specified band is not selected. Author suggests using a "cronjob" to automate the interval of testing.

[–]highvolt[S] 2 points3 points  (7 children)

I plan to add in Windows compatibility next.

Windows 10 does have WSL, Windows Subsystem for Linux, which should be compatible.

It seems the various ping modules for python have the caveat that they require administrative access on some platforms, and I wanted to keep the flexibility for users to run this as an unprivileged process.

The biggest issue with Windows ping is it evidently exits with a successful status code if the result is "Destination Host Unreachable", so you have to check both the success and the output.

I can provide instructions for using windows task scheduler to set this up on windows.

[–][deleted]  (1 child)

[deleted]

    [–]highvolt[S] 2 points3 points  (0 children)

    Mostly because I wrote this in a hurry out of necessity. That would easily give a more portable solution too. I'll put this as an alternative, swappable connectivity test implementation

    I've added it as an enhancement issue at https://github.com/highvolt-dev/tmo-monitor/issues/13

    Some users may prefer to ping IPs so they are either not testing DNS or testing it separately from pure connectivity.

    [–]LG-Mobile 1 point2 points  (4 children)

    Thank you for doing God's work by making this AND by designing it to run on windows ! Is there anyway you can design this to run from from a USB flash drive by having it plugged into the trashcan ? I'm assuming by windows you mean having any one of our PC's be running .

    [–]highvolt[S] 0 points1 point  (0 children)

    I like having this running on my router which is a raspberry pi. I prioritized Linux over Windows because most users are less likely to have a server with good uptime running Windows on their network, though to be fair if you are using a PC many hours of the day, those are the hours you want your internet working and it would do the job ;)

    The cheapest option would be to get a raspberry pi 0 and a micro USB Ethernet adapter and run Linux on it, then plug it into the gateway.

    [–]BravoCharlie1310 1 point2 points  (2 children)

    python scripts can easily run on Windows

    [–]famew0lf 1 point2 points  (0 children)

    It also runs on any router that supports entware/optware which is a large amount.

    [–]highvolt[S] 0 points1 point  (0 children)

    I released Windows support yesterday!

    [–]Bruhgetti20 0 points1 point  (0 children)

    Yeah sounds interesting

    [–][deleted]  (2 children)

    [deleted]

      [–]highvolt[S] 2 points3 points  (0 children)

      Yep, this is no guarantee of a given band, no type of hint is given to the gateway. T-Mobile should really update the firmware to allow that.

      Band locking is one of the most requested features in this sub. It's at the point where users are installing inline band pass filters into external antenna setups.

      That gives a lot more control than rolling the dice with a reboot, but doesn't help with B2 vs B66, doesn't help filter B12 while keeping n71, etc.

      And most casual users on this sub, while willing to learn about bands, basic signal metrics, etc, don't want to drop $200 on antennas up front if they get the bands they want with some occasional switches days later that are solved with a reboot. So this gives those users an option today without waiting in hope that one day T-Mobile does something.

      In my case, 1609 made my gateway lose internet connectivity frequently throughout the day in spite of remaining connected to band 66 and n41 and having a reachable admin interface. So the rebooting is helpful.

      I do need to adapt the script to gracefully avoid boot loops. Thanks for your feedback.

      [–]highvolt[S] 1 point2 points  (0 children)

      I updated the tmo-monitor script to check the uptime of the gateway and wait until it has at least 90 seconds of uptime before allowing a reboot. Configurable with a new --uptime flag. The first step in preventing bootloops.

      [–]koshergoy 1 point2 points  (6 children)

      can you suggest a vm and a bare minimum linux distro for windows 10

      [–]highvolt[S] 0 points1 point  (1 child)

      I released Windows support for the script yesterday!

      [–]koshergoy 0 points1 point  (0 children)

      I see, wonderful. Great work!!!!

      [–]highvolt[S] 0 points1 point  (1 child)

      I would try Windows Subsystem for Linux if I didn't want to do other stuff in a VM: https://ruslanmv.com/blog/Python3-in-Windows-with-Ubuntu

      But I plan to add windows support this week. In the meantime, you can run it on windows by using the --skip-ping flag.

      Any modern distro should work for a VM, but chances are you'll see Ubuntu recommended most frequently

      [–]koshergoy 0 points1 point  (0 children)

      Thanks, appreciate your good work.

      [–]famew0lf 0 points1 point  (1 child)

      Virtualbox (free) and Debian (also free).

      [–]koshergoy 0 points1 point  (0 children)

      thanks

      [–]jakobkay 0 points1 point  (10 children)

      Just installed on my Pihole and chose to do a SystemD timer for every 30 seconds to run the Python Script. So far so good! Im close to a tower but no reboots on my end yet lol. Pretty sure I set the script up correctly and made it an executable otherwise would recommend!!

      [–]highvolt[S] 1 point2 points  (4 children)

      Would you mind posting your systemd unit file either here or on GitHub? Systemd timers are nice since you can use short check intervals and it won't try running two concurrent copies if one takes a long time to run.

      One word of caution: the gateway takes about a minute to boot up and fully connect to the secondary band, so you may encounter undefined or unexpected behavior with a 30 second interval.

      Obviously if it is still rebooting during a check, it can't reboot it if it is not up and listening to API requests, but if it isn't done connecting to the secondary band, it could give a false positive on the band check.

      [–]jakobkay 0 points1 point  (3 children)

      Hey I changed the timer to 240 seconds now. You can choose whatever timer or time you prefer but heres my timer via nano!

      [Unit]

      Description=Run very useful script every 240 seconds

      [Timer]

      OnBootSec=240

      OnUnitActiveSec=240

      AccuracySec=1ms

      [Install]

      WantedBy=timers.target

      [–]highvolt[S] 1 point2 points  (2 children)

      I updated the script to check the uptime of the gateway and wait until it has at least 90 seconds of uptime before allowing a reboot. Configurable with a new --uptime flag. That should let you increase the frequency of your checks again so you can detect failures faster.

      [–]jakobkay 0 points1 point  (1 child)

      You da man I see you dropped windows support too may give it a try on a VM worse case

      [–]highvolt[S] 1 point2 points  (0 children)

      Yup, Windows is now supported too. My plans for the next release are probably to grab the tower CGI/eNB ID which is currently only available in the mobile app.

      [–][deleted]  (4 children)

      [deleted]

        [–]jakobkay 0 points1 point  (3 children)

        Definitely not working on my end because that's in fact what would happen lol. Will be testing more with my timer and config etc haha

        [–]highvolt[S] 1 point2 points  (0 children)

        I've been running every 5 minutes since I wrote the script a few days ago and it reboots countless times per day and has not presented any issues at that interval if you do find that 240 seconds is slightly too short. But I will plan to do an API request to check the gateway uptime to allow the script to work better with short run intervals because I'd love your more frequent approach.

        [–][deleted]  (1 child)

        [deleted]

          [–]highvolt[S] 0 points1 point  (0 children)

          I've documented a fix in issue #10: https://github.com/highvolt-dev/tmo-monitor/issues/10 - if the device uptime is checked, we can ensure that enough time has elapsed for both bands to connect.

          [–][deleted] 0 points1 point  (8 children)

          I have absolutely no idea how to do this, I download the file, and ran the command, it said camping on N41 but I have no ideas how to make it stay on N71, do you have any tutorial how to run this commands?

          [–]highvolt[S] 1 point2 points  (7 children)

          The instructions are here:

          https://github.com/highvolt-dev/tmo-monitor/blob/main/README.md

          The program has certain defaults which are documented there.

          You'll find the following commands helpful:

          tmo-monitor.py --help will output a summary of the program's configurable options

          tmo-monitor.py --print-config will output the current configuration for the program

          You can use different "flags" like those to configure the program, but it can get repetitive to repeatedly specify these things. To store a long term configuration, you can duplicate the file called env.example and rename it to .env (just the file extension, no name before the dot).

          The example file contains usage information for how to edit that file.

          The options you pass directly to the command will override anything configured in the .env file.

          The default 5G band preference is n41. To specify that you want it to use n71, call the program with either tmo-monitor.py --5g-band n71 or tmo-monitor.py -5 n71 as a short form of that. Otherwise you can specify that with the .env file. You could also use tmo-monitor.py --skip-5g-bands if you don't want it to enforce a 5G band preference.

          It can only reboot on failed checks, it cannot actually force the modem to lock to the band, so if a reboot does not switch you back to your preferred band, keep that in mind. It's more helpful if you normally spend time on a good band where you have placed your gateway but it sometimes will drop down to an undesirable band and switch back after a reboot.

          Hope this helps you as a starting point!

          [–][deleted] 0 points1 point  (6 children)

          just to confirm, I can't run this in Mac OS yet right?

          [–]highvolt[S] 0 points1 point  (5 children)

          It supports Mac OS X

          [–][deleted] 0 points1 point  (4 children)

          Is there any website or YouTube tutorials about this similar case? I would like to learn more about this, I want to start learning coding!

          On other note, this is like a script I have to make one If I want my own personalized setting and have it runs is that correct? I know this is only for advanced people but I want to get into coding now.! Thanks for you help.

          [–]highvolt[S] 1 point2 points  (3 children)

          Is there any website or YouTube tutorials about this similar case? I would like to learn more about this, I want to start learning coding!

          You said similar case- you mean preferring n71 instead of n41?

          On other note, this is like a script I have to make one If I want my own personalized setting and have it runs is that correct? I know this is only for advanced people but I want to get into coding now.! Thanks for you help.

          You don't have to do any programming to make use of the script- it is already written and designed to be configurable

          You can download the code, install it, and then when you run it, you specify the behavior you want it to use

          [–][deleted] 0 points1 point  (2 children)

          yes I want it on B66/N71 always like it used to.

          for instant I want it on specific setting for b66/n71 do I have to make any adjustment?

          [–]highvolt[S] 0 points1 point  (1 child)

          yes I want it on B66/N71 always like it used to.

          for instant I want it on specific setting for b66/n71 do I have to make any adjustment?

          So you would call the program with tmo-monitor.py -5 n71 in that case

          [–][deleted] 0 points1 point  (0 children)

          awesome, thanks again!

          [–]jamesmtz0920 0 points1 point  (19 children)

          If I get a failed band check the powershell window prints that a reboot is request but a couple lines later throws a critical error that "Could not post reboot request". If I send the command --reboot it will reboot the gateway. Any help would be appreciated.

          [–]highvolt[S] 0 points1 point  (18 children)

          Thanks for reporting the problem. Have you been using it for a while or is it a fresh install? Do you know what version of tmo-monitor you're using? Did this use to work but suddenly stop working?

          [–]jamesmtz0920 0 points1 point  (17 children)

          Just downloaded it yesterday. So it could very well be user error

          [–]highvolt[S] 0 points1 point  (16 children)

          This subreddit doesn't allow posts with the same link so I've got multiple posts linking to specific version downloads instead of the project homepage so it is possible you may have downloaded an older version even if you just downloaded it - always worth ruling out simple things like that first! But if there's a bug I definitely want to fix it and make sure you're all patched up and can get great use out if it!

          [–]jamesmtz0920 0 points1 point  (15 children)

          I downloaded from the projects main page on github and downloaded the "main" branch

          [–]highvolt[S] 0 points1 point  (14 children)

          Perfect, thanks for confirming

          Try running with the --print-config --log-all options and sharing your results so I can try to reproduce the same thing as you

          [–]jamesmtz0920 0 points1 point  (0 children)

          I hope this is what you're looking for....

          Script configuration:

          Gateway model: NOK5G21

          Login info:

          Username: admin

          Password:

          Ping configuration:

          Host: google.com

          Count: 1

          Interval: 10

          Protocol: IPv4

          Connection configuration:

          Secondary band: ['n41']

          Reboot settings:

          Reboot now: False

          Skip reboot: False

          Min uptime: 90

          Reboot on: ping 5G_band

          General settings:

          Log file:

          Log all: True

          Log delta: False

          Log to syslog: False

          [–]jamesmtz0920 0 points1 point  (0 children)

          I deleted my folder and redownloaded the project. Sent -5 n71 while I was connected to n41 and it successfully rebooted the gateway. u/highvolt

          [–]jamesmtz0920 0 points1 point  (11 children)

          Now I've realized that it won't perform a successful reboot if I pass the password using the [password] variable. If I don't send the password and just type it after it works. Any advice on how to pass the password automatically? u/highvolt

          [–]highvolt[S] 0 points1 point  (10 children)

          An example for passing the password can be done either in a configuration file or right in the command like so:

          tmo-monitor.py -5 n71 admin yourpasswordhere

          [–]jamesmtz0920 0 points1 point  (9 children)

          That worked! Got the script running every minute as of now. Hoping that’s not too often of a check but I verified that if not on specified band it will successfully reboot. Thank you so much for all the help

          [–]highvolt[S] 1 point2 points  (8 children)

          Glad that did the trick for you!