February 9, 2017 at 9:51 pm

Back in December, I bought the Netgear GS108E gigabit managed switch for my flat’s home network (£25 at the time of writing). It lives in a random cupboard along with my servers and internet router, and so far it has served me very well. However, it’s cheap. The web interface certainly shows off it’s cheapness with limited options and information. The switch also provides no SNMP data, which makes monitoring devices and traffic fairly difficult using tools like PRTG or Munin.

I needed a solution to see what devices were absorbing bandwidth in my flat. Having a horrible 3.5mbps internet connection (thanks BT for your insistence to not upgrade infrastructure in a busy growing residential area in a major city), one device can very quickly suck up bandwidth and it’s always difficult to pinpoint who’s guzzling data. I had set up the port connections so so my room was on port 4, wifi was on port 8 and the living room was on port 7, so I had some way of setting QoS port rules and throttle the ports, but I still had no way of easily monitoring the bandwidth consumption. The only bit of information the switch gives me through the GUI is bytes sent and received.

Hmm, I can use that information. PRTG has a sensor API and a python interpreter.

The switch provides a limited amount of port traffic information, but it’s useful enough!

The final result, I wrote a small python script to scrape this information from the switch and create a custom sensor for PRTG. The script authenticates with the web interface and stores the auth cookie for future use (the switch will only allow a certain number of active sessions at one time). The script then loads the port_statistics.html page allowing me to scrape the bytes sent and received. I load the page twice over a recorded time period, do some maths to convert the difference in bytes into a kbps value, and get a nice readable kbps value.

The script also creates a child class of CustomSensorResult (found in the PRTG paepy library). While the class is incredibly useful and sped up my development time by not having to worry about crafting a json response, it was missing the ability to define size and time units as documented in the PRTG API.

An example of the custom sensor information displayed in PRTG

Is it perfect, definitely not. While the script functions, it’s not the most elegantly written thing in the world and can be tidied up heavily. The switch is also not exactly fast to respond to requests, and during testing the script did timeout occasionally or give me really bizarre results, so caching data is certainly needed.  Debugging with PRTG is also a challenge, as I’ve not yet found a way of seeing any python error dumps within the GUI.

I’ve missed building little useful scripts like this. It was good fun to build this and develop my python knowledge (and get out my python book to figure out how to properly work with parent classes), and I certainly need to do this more often.

If you find this script useful with any compatible Netgear ProSafe GS switch, please star the git repository or drop me a tweet @mattyribbo. It’s always nice to know that someone found something I wrote handy.

February 9, 2017 at 9:51 pm | Blog, Programming | No comments

January 3, 2015 at 8:35 pm


If anyone has ordered stuff through Amazon and have had to deal with a disgrace of a courier service on a constant basis, then you have my deepest sympathies. If you’ve not, let me explain how utterly crap they are by sharing my previous experiences.

April last year, I ordered a pair of vans shoes. Amazon Logistics were tasked to deliver the item to my workplace. They make the delivery the next day at a reasonable time, but not to the right place. Instead of my office, they managed to deliver it and other campus deliveries to one of the on-campus accommodation offices instead. Apparently the delivery driver just dumped a pile of parcels and walked off. I end up going in the next day to collect the parcel, but it’s disappeared, lost in my university’s internal mail system. Two calls to Amazon customer services and they send me a new pair out, nearly two weeks later. You could blame my university’s mail system for losing the parcel completely, but it was the pure laziness of a Logistics driver who caused the problems. Both me and the University complained about this.

October last year, I ordered two WD Red hard drives. Amazon Logistics were the courier of choice once again, ordered Wednesday, out for delivery on Thursday to my work place. They thought delivering at 6pm to an office was a smart idea (You would have thought a parcel labelled “University of the West of England” would have given it away), but they didn’t even attempt to ring the bell at the door or look inside to see that there were still people working. They attempt again on Friday but just plain failed to turn up. After another heated phone call to Amazon customer support, they offered me an extra month of Prime and then delivered to my home address, but they weren’t willing to deliver until Monday. So much for using the weekend to set everything up.

This week, my housemate Dave used my Amazon account to order a smoothie maker. Simple enough, dispatch Friday and be here today (Saturday). Amazon Logistics were once again selected to make some sort of attempt at a delivery. At the same time I had some cheap speakers and a HDMI cable also dispatched on the same day. At 12:32pm, DPD arrive with my speakers. At 8pm today, I still have nothing from Amazon Logistics. I ring them up and give them a piece of my mind once again, demanding they mark on my account in capitals “DO NOT USE AMAZON LOGISTICS”.

I’ve not even mentioned the several times Logistics have sent out next day deliveries, only for them to not bother the day they’re due for delivery and end up delivering two or three days later than asked. What am I paying Prime for Amazon if they can’t be bothered to give me next day delivery.

There’s also the countless times Amazon Logistics have been tasked in delivering stuff ordered by my workplace, and fail to deliver on time or deliver at all.

Amazon Logistics are hopeless. They’re an abomination, disorganised, unaccountable and useless. They make Yodel look good (Yodel make the deliveries on time, just always to the wrong address it seems). Amazon Logistics needs to be shaken up and reorganised, or just cease to exist. Use other couriers like DPD. They are fantastic, always appear when they say they will. Why can’t you do that Amazon. Explain?! Even Royal Mail is a better substitute.

If you want more bed-time reading of how poor Amazon Logistics are, here’s a whole forum thread of complaints on Amazon’s own forums.

January 3, 2015 at 8:35 pm | Rant | No comments

July 6, 2014 at 3:42 pm

Back in October, I was involved with a different kind of charity fundraising event – a 25 hour gaming marathon. The event, ‘Ctrl Alt Donate’, was run by one of my trusted friends Tig to raise money for Bristol Children’s Royal Hospital. Last Friday, £700 worth of toys and games were donated to the Hospital, a fantastic result!

Pile of gifts donated from funds generated by Ctrl Alt Donate

Pile of gifts donated from funds generated by Ctrl Alt Donate

If I rewind the clock days before the event on November 2nd 2013, I can remember me frantically trying to sort out internet access for the event. You’d think getting an internet connection was trivial but there’s a whole load of red tape to jump through with the university’s IT systems, making sure that computers were secure, security considerations, and so on and so on. It also didn’t help that there was an IT maintenance and shutdown weekend. It was looking unlikely to be able to get the provision, but days before the event, a breakthrough occurred, we had internet!

To see the toys finally appearing and being donated on Friday was a nice feeling, and to get a mention from Tig in the press release was really kind of him and I thank him for that.

But then this post on our Facebook group was made by Tig:

We need to do more for the hospital. What we’ve managed to do is huge but I had no idea just how much help they need. The quote that hurt me the most today was “what we do is still seen by many as being a luxury, rather than a key part of a child’s treatment”

What the event did was fantastic and raised a lot of money, there’s no doubt. However after hearing what Tig experienced on Friday, I think that just spurs the next Ctrl Alt Donate to be even bigger! Roll on Saturday 25 October.

July 6, 2014 at 3:42 pm | Blog | No comments

Next Page »