سؤال

I have a situation where I need to write an application to monitor that a 3g router is up and running, as sometimes the 3g connection isn't stable. I have to ensure the bandwidth usage doesn't go over the limit.

I am not sure what is the best way to monitor the 3g connection status with the minimum usage of the bandwidth of the 3g connection. Any good suggestion?

هل كانت مفيدة؟

المحلول

If ping is not blocked, you can simply do ping -c 10 8.8.8.8 | grep -oE "[0-9]* received" | sed "s/ received//g". If the connection is up, you should get nonzero (>7 for any reasonably good connection) value.

نصائح أخرى

Any reasonable quality router should have an SNMP service which can be polled to check the status of each interface, and the amount of traffic over each interface.

If your router has this, it's pretty trivial to write what you need in a variety of scripting languages. I've used the Perl Net::SNMP library for this sort of stuff in the past.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top