如何向普通用户显示我的服务器的当前响应时间

发布于 2024-08-24 21:07:34 字数 821 浏览 2 评论 0原文

抱歉,我不太确定提出这个问题的正确方法,所以请耐心等待...

我们有一个 Web 应用程序,在数据中心(不是在我们的办公室)的一组服务器上运行 我们希望能够以某种方式向我们的客户/用户“宣传”我们的服务器的可用性或响应时间全天都符合标准。

我被要求提出一个标准指标,我们可以轻松地在登录屏幕上做广告,显示当前每 x 分钟检查一次的“标准响应时间”。

我的想法是,我需要捕获诸如从服务器(在我们的办公室、亚马逊等)到其中一台数据中心服务器的跟踪路由结果之类的结果,并提出红色/黄色/绿色类型的登录屏幕的通知程序,让用户知道我们的测试正在正常响应,如果他们遇到延迟问题,则可能是他们的网络或互联网连接问题。我们有很多农村地区的客户,网络连接很差,我们试图让他们知道任何缓慢的情况可能是他们的问题,而不是我们的问题。

我有 LAMP 堆栈可以使用,但这也可以是其他系统,只要它可以用结果更新主服务器即可。

我已经有了可用的 pingdom 报告,但这有时比人们想要阅读的要多一些。

关于我能做什么有什么想法吗?

解决方案

我最终采用了 Tim 的 PEAR Net_Ping 想法。我使用了以下方法:

$ping->setArgs(array('count' => 6));
$results = $ping->ping('x.x.x.x');
$avgPing = $results->_round_trip['avg'];

获取服务器 6 次 ping 的平均值。然后,我将结果存储在数据库中,并能够显示最近 5 次检查的平均值,以了解健康状况。我们将看看客户是否喜欢它。

Sorry, I'm not really sure of the right way to ask this one so bear with me...

We have a web application that runs on a set of servers at a data center (not in our offices)
We want to be able to somehow 'advertise' to our clients/users that the availability or response time of our servers has met a standard throughout the day.

I am being asked to come up with a standard metric that we can easily advertise on our login screen that shows current "standard response time" checked every x minutes.

My thinking is that I need to capture something like the results of a traceroute from a server (either in our office, amazon, etc..) to one of the data center servers and come up with a Red/Yellow/Green type of a notifier for the login screen to let the user know that our tests are responding normally and if they are having delay issues it could be their network or connection to the internet. We have lots of clients in rural areas that have poor connectivity and we are trying to let them know any slowness might be on their end, not ours.

I've got the LAMP stack to work with, but this could also be some other system all together as long as it can update the main server with the results.

I already have pingdom reports that are available, but that's a bit more than people want to read sometimes.

Any ideas on what I can do?

Resolution:

I ended up going with Tim's PEAR Net_Ping idea. I used the following:

$ping->setArgs(array('count' => 6));
$results = $ping->ping('x.x.x.x');
$avgPing = $results->_round_trip['avg'];

To get the avg of 6 pings to the server. I then stored the result in a DB and was able to show the avg of the last 5 checks to give an idea of health. We'll see how clients like it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故事和酒 2024-08-31 21:07:34

如果您关心的只是网络延迟(而不是服务器负载等),为什么不服务器对一组已知良好的主机执行 ping 操作。然后向用户报告平均 ping 时间(使用不同响应范围的色标)。

然后,您还可以 ping 用户的 IP 并显示“状态”,因为目标是说明“滞后”在哪里。

这似乎比从外部服务器进行延迟检查更好、更简单(至少对我来说)。

要执行实际的 ping,您可以使用 cron 作业并使用 php 脚本处理结果,或者使用 ping 库。 PEAR 的 Net_Ping 没有维护,但可以工作。

对于比 ping 更复杂的事情,您可以获取一些页面(或图像),然后计算获取时间/响应大小。如果带宽负载是潜在问题,这可能是一个更好的指标(这是“速度测试”站点背后的基本概念)。

If all you care about is network latency (not something like server load), why not ping from the server to a set of known good hosts. Then report the average ping time to the user (using a color scale for different response ranges).

Then additionally you could ping the user's IP and show that 'status', since the goal is to illustrate where the 'lag' is.

This seems better and simpler than doing the latency check from an external server (at least to me).

To do the actual ping, you could use a cron job and process the results with a php script, or use a ping library. PEAR's Net_Ping isn't maintained, but does work.

For something more complex than ping, you could fetch some pages (or images), then calculate the fetch time/response size. That maybe a better indicator if bandwidth load is a potential issue (this is the essential concept behind 'speed test' sites).

稀香 2024-08-31 21:07:34

网络监控应用程序,例如 NagiosOpenNMS 将为您提供几乎所有您可能需要的统计信息,并且至少 Nagios 已经有了 网络界面。我相信 OpenNMS 也可以,但它需要 Tomcat。

我只使用过 Nagios,那是很多年前的事了(对于区域拨号 ISP,每天都会有很多电话)。我不得不抓取网络界面并借用一些它生成的图形图像来供我自己显示,但通过 cron 每小时自动化很容易。如果它没有某种附加组件来简化现在的流程(如果没有合适的 API),我会感到惊讶。

A network monitoring app like Nagios or OpenNMS would give you most any statistic you could need, and at least Nagios already has a web interface. I believe OpenNMS does as well, but it requires Tomcat.

I've only worked with Nagios and that was many years ago (for a regional dial-up ISP, many of those phone calls every day). I had to scrape the web interface and borrow a few of its generated graph images for my own display, but it was easy enough to automate hourly via cron. I'd be surprised if it doesn't have some sort of add-on to make the process simpler now, if not a proper API.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文