0

我正在评估将 collectl 用作系统监控工具。我需要通过套接字公开数据。我发现 collectl 有一个 -A 选项,可以将数据发送到套接字。但是我找不到有关如何执行此操作的任何具体细节。我相信配置应该在 /etc/collectl.conf 中完成

谁能提供有关如何配置 collectl 以通过套接字连接提供数据的想法?

(如果你能推荐任何其他符合上述要求的方便的系统监控工具,那也很好。简单的设置能力有点重要,因为这个过程需要自动化)

4

1 回答 1

0

Getting collectl data through a socket is real easy. If you run collectl with -Aserver, it comes up in server mode, which means it listens for connections and when it receives one it started sending its output over that connection until it breaks. Since it continues to listen for connections, it can actually take to multiple clients. To test this feature, run collectl -Aserver in one window and in another, run "/usr/share/collectl/util/client.pl address-of-collectl-server" and you'll immediately start seeing output. You can run the client in as many windows or on as many other systems as you like.

The other mode collectl runs in is as a client. You give it an address to talk to like this: "collectl -Aaddress" and when it starts connects to that address and starts sending its output there. This is the way colmux works.

As for the type of output, if you do nothing more, collectl will send the same text over the socket that it would normally send to the terminal. On the other hand you can specify 'line output' with --export lexpr and if that's not good enough you can write your own export module. Just start with lexpr as a model and hack away to get virtually any form of output you like.

Hope this helps...

-mark

于 2016-02-23T16:38:55.183 回答