I use SiliconDust’s HDHomerun Primes for my DVR needs at home. The prime model lets you connect a cablecard from your cable provider, and access the full range of channels, and not just the few local channels that come through ClearQAM (assuming you have one of the few providers that even offer those anymore).
As with most cable providers, on top of the cablecard, my provider toss in a tuning adapter that is required to access the full range of channels. That takes what used to be just a single network device in the case of a simple ClearQAM tuner, to a 3 device setup, wherein any failure will cause random channels to fail to complete loss of recording abilities. Tuning adapters in particular are quite fail-happy. I tend to need to restart mine about once or twice a month.
After a particularly bad string of recording/tuning failures, I decided that something needed to be done. I use PRTG’s free license to monitor my home network, so I started looking at that first to see what was needed to write a plugin. Fortunately for me, PRTG plugins can be Powershell, and just need to return a simple XML value in order to handle logging and alerting.
Unfortunately, the HDHomerun devices do not use an accessible API, so I had to go back to the drawing board. I ended up using curl to grab and parse the network page for the site for the details that I wanted to track. Since the pages are simple HTML, results are pulled almost instantly, and I’ve not seen any negative impact from pulling reports every minute.
For starters, I wanted to validate that the tuner was actually responding and serving the page. Why not start with the basics? On the off-chance the page doesn’t respond, it’ll throw an error, and depending on how you have your PRTG set up, you can get an email for that.
Then, working my way down the failure points, I wrote the needed code to track the cablecard status. If the cablecard shows anything but working, it’ll kick back an error. While this is an issue that I’ve only see happen once, it wouldn’t be a complete monitoring solution if I disregarded the risk potential. Unfortunately, this wasn’t one that I wanted to test, since the last time I removed a card, I had to sit on the phone with support so that they could re-pair it with the tuner. That being said, it should work as expected.
The final (and most expected) failure point is the tuning resolver. These boxes have a tendency to just randomly crash or stop responding, causing random channels to not show up or not be found. Frustratingly, in most cases, there aren’t even any LED changes to show that they have failed. Thankfully, the HDHomerun is able to tell when they go down, and the pages will update with failures if it loses contact with them. If the script detects anything wrong, it’ll bounce back a failure, and (if configured), you’ll get an email with failure details.
Deciding to err on the side of overkill, I also added some statistics reporting as well. So the script will monitor the signal strength/quality of each tuner individually, as well the cablecard signal quality/strength. It makes it easier to verify any sort of quality issues, as well as just being an interesting thing to track.
Installation of the script is just a matter of adding it to your plugins directory, and adding a custom/exe sensor in PRTG. It takes three parameters:
Enter the IP address of the tuner you’re tracking here.
Put a 0 if this is a plain tuner, and a 1 if it is a Prime/CableCard tuner
Put the number of tuners that you have. 2 generally for plain, and 3 for Prime
The script for monitoring the cablecard and tuning resolver statuses is separate from the main script, so make sure you include that one as well.
That script only has the parameter of -IPAddress.
You can download these scripts from Github here.