简体   繁体   English

检查3g路由器正常运行的最佳方法是什么?

[英]What is the best way to check a 3g router is up and running?

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. 我遇到一种情况,我需要编写一个应用程序来监视3g路由器是否已启动并正在运行,因为有时3g连接不稳定。 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. 我不确定以最少的3g连接带宽使用率监视3g连接状态的最佳方法是什么。 Any good suggestion? 有什么好的建议吗?

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. 任何质量合理的路由器都应具有SNMP服务,可以对其进行轮询以检查每个接口的状态以及每个接口上的通信量。

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. 过去,我已经将Perl Net::SNMP库用于此类工作。

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" 如果未阻止ping,则只需执行ping -c 10 8.8.8.8 | grep -oE "[0-9]* received" | sed "s/ received//g" ping -c 10 8.8.8.8 | grep -oE "[0-9]* received" | sed "s/ received//g" ping -c 10 8.8.8.8 | grep -oE "[0-9]* received" | sed "s/ received//g" . 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. 如果连接已建立,则应获得非零值(对于任何合理良好的连接,该值均> 7)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM