I'm running a Solaris server to serve PHP through Apache. What tools can I use to measure the bandwidth my server is currently using? I use Google analytics to measure traffic, but as far as I know, it ignores file size. I have a rough idea of the average size of the pages I serve, and can do a back-of-the-envelope calculation of my bandwidth usage by multiplying page views (from Google) by average page size, but I'm looking for a solution that is more rigorous and exact.
我正在运行Solaris服务器以通过Apache提供PHP服务。我可以使用哪些工具来衡量我的服务器当前使用的带宽?我使用Google分析来衡量流量,但据我所知,它会忽略文件大小。我粗略了解我所服务的网页的平均大小,并且可以通过将页面浏览量(来自Google)乘以平均页面大小来对我的带宽使用情况进行背面计算,但我正在寻找一个更严谨,更准确的解决方案。
Also, I'm not trying to throttle anything, or implement usage caps or anything like that. I'd just like to measure the bandwidth usage, so I know what it is.
此外,我不是想扼杀任何东西,或实施使用上限或类似的东西。我只想测量带宽使用情况,所以我知道它是什么。
An example of what I'm after is the usage meter that Slicehost provides in their admin website for their users. They tell me (for another site I run) how much bandwidth I've used each month and also divide the usage for uploading and downloading. So, it seems like this data can be measured, and I'd like to be able to do it myself.
我所追求的一个例子是Slicehost在其管理员网站中为其用户提供的使用率表。他们告诉我(我运行的另一个站点)我每个月使用了多少带宽,并且还分配了上传和下载的使用量。所以,似乎可以测量这些数据,我希望自己能够做到这一点。
To put it simply, what is the conventional method for measuring the bandwidth usage of my server?
简单来说,测量服务器带宽使用的传统方法是什么?
2 个解决方案
#1
This depends on your setup. If you have a (near-)dedicated physical interface for your web server you could gather stats straight from the interface.
这取决于您的设置。如果您的Web服务器具有(近)专用物理接口,则可以直接从界面收集统计信息。
Methods to do this could include SNMP (try net-snmp) or "ifconfig", combined with RRDTool or simple logging to flat files.
执行此操作的方法可能包括SNMP(try net-snmp)或“ifconfig”,结合RRDTool或简单记录到平面文件。
An alternative is using the Apache log, which could look like this:
另一种方法是使用Apache日志,它可能如下所示:
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET / HTTP/1.1" 200 1456
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET /apache_pb.gif HTTP/1.1" 200 2326
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET /favicon.ico HTTP/1.1" 404 303
192.168.101.155 - - [17/Apr/2005:20:39:42 -0700] "GET /index.html.ca HTTP/1.1" 200 1663
192.168.101.155 - - [17/Apr/2005:20:39:42 -0700] "GET /apache_pb.gif HTTP/1.1" 304 -
192.168.101.155 - - [17/Apr/2005:20:39:43 -0700] "GET /favicon.ico HTTP/1.1" 404 303
192.168.101.155 - - [17/Apr/2005:20:40:01 -0700] "GET /apache_pb.gif HTTP/1.1" 304 -
192.168.101.155 - - [17/Apr/2005:20:40:09 -0700] "GET /apache_pb.gift HTTP/1.1" 404 306
192.168.101.155 - - [17/Apr/2005:20:40:09 -0700] "GET /favicon.ico HTTP/1.1" 404 303
The last number is the amount of bytes transferred, excluding the header(!). See Apache Log Docs.
最后一个数字是传输的字节数,不包括标题(!)。请参阅Apache Log Docs。
#2
I am just guessing, but I think the usual approach is to use the same tools and services that are used to deliver QoS features. QoS == Quality of Service. Somewhere on the server itself, or on the network routers around the server, there will be services enabled that measure the size of the packets flowing out of your server. These same services can be used to limit the amount of bandwidth for customers that need to have such limitations enforced. I have not heard of an application that can be run on your server that measures bandwidth. I think it should be possible to create such an app, but that's not the usual way that such measurements are collected. I suspect this answer will end up not being solaris-specific.
我只是猜测,但我认为通常的方法是使用用于提供QoS功能的相同工具和服务。 QoS ==服务质量。在服务器本身的某个位置或服务器周围的网络路由器上,将启用服务来测量流出服务器的数据包的大小。这些相同的服务可用于限制需要强制执行此类限制的客户的带宽量。我还没有听说过可以在您的服务器上运行的测量带宽的应用程序。我认为应该可以创建这样的应用程序,但这不是收集此类测量的常用方法。我怀疑这个答案最终不会是针对solaris的。
#1
This depends on your setup. If you have a (near-)dedicated physical interface for your web server you could gather stats straight from the interface.
这取决于您的设置。如果您的Web服务器具有(近)专用物理接口,则可以直接从界面收集统计信息。
Methods to do this could include SNMP (try net-snmp) or "ifconfig", combined with RRDTool or simple logging to flat files.
执行此操作的方法可能包括SNMP(try net-snmp)或“ifconfig”,结合RRDTool或简单记录到平面文件。
An alternative is using the Apache log, which could look like this:
另一种方法是使用Apache日志,它可能如下所示:
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET / HTTP/1.1" 200 1456
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET /apache_pb.gif HTTP/1.1" 200 2326
192.168.101.155 - - [17/Apr/2005:20:39:19 -0700] "GET /favicon.ico HTTP/1.1" 404 303
192.168.101.155 - - [17/Apr/2005:20:39:42 -0700] "GET /index.html.ca HTTP/1.1" 200 1663
192.168.101.155 - - [17/Apr/2005:20:39:42 -0700] "GET /apache_pb.gif HTTP/1.1" 304 -
192.168.101.155 - - [17/Apr/2005:20:39:43 -0700] "GET /favicon.ico HTTP/1.1" 404 303
192.168.101.155 - - [17/Apr/2005:20:40:01 -0700] "GET /apache_pb.gif HTTP/1.1" 304 -
192.168.101.155 - - [17/Apr/2005:20:40:09 -0700] "GET /apache_pb.gift HTTP/1.1" 404 306
192.168.101.155 - - [17/Apr/2005:20:40:09 -0700] "GET /favicon.ico HTTP/1.1" 404 303
The last number is the amount of bytes transferred, excluding the header(!). See Apache Log Docs.
最后一个数字是传输的字节数,不包括标题(!)。请参阅Apache Log Docs。
#2
I am just guessing, but I think the usual approach is to use the same tools and services that are used to deliver QoS features. QoS == Quality of Service. Somewhere on the server itself, or on the network routers around the server, there will be services enabled that measure the size of the packets flowing out of your server. These same services can be used to limit the amount of bandwidth for customers that need to have such limitations enforced. I have not heard of an application that can be run on your server that measures bandwidth. I think it should be possible to create such an app, but that's not the usual way that such measurements are collected. I suspect this answer will end up not being solaris-specific.
我只是猜测,但我认为通常的方法是使用用于提供QoS功能的相同工具和服务。 QoS ==服务质量。在服务器本身的某个位置或服务器周围的网络路由器上,将启用服务来测量流出服务器的数据包的大小。这些相同的服务可用于限制需要强制执行此类限制的客户的带宽量。我还没有听说过可以在您的服务器上运行的测量带宽的应用程序。我认为应该可以创建这样的应用程序,但这不是收集此类测量的常用方法。我怀疑这个答案最终不会是针对solaris的。