收集和Nginx插件无法正常工作

sre*_*dni 4 nginx collectd

我的collectd配置看起来像:

LoadPlugin nginx
...
<Plugin "nginx">
    URL "http://localhost:8080/nginx_status?auto"
</Plugin>
Run Code Online (Sandbox Code Playgroud)

Nginx conf看起来像:

server {
  listen 8080;
  index index.html index.htm;
  server_name localhost;
  root  /var/www/default/;

  location / {
    try_files $uri $uri/ /index.html;
  }

  location /nginx_status {
    stub_status on;
    access_log   off;
    allow 127.0.0.1;
    deny all;
  }
}
Run Code Online (Sandbox Code Playgroud)

当我执行

$ curl http://localhost:8080/nginx_status?auto
Run Code Online (Sandbox Code Playgroud)

它输出:

Active connections: 1 
server accepts handled requests
 56 56 322 
Reading: 0 Writing: 1 Waiting: 0 
Run Code Online (Sandbox Code Playgroud)

但是当开放石墨时,没有nginx图可用.Collectd和Nginx重启了很多次.有什么建议?

sre*_*dni 14

最终解决了.打开logfile插件后:

LoadPlugin logfile

<Plugin logfile>
    LogLevel info
    File "/var/log/collectd.log"
    Timestamp true
</Plugin>
Run Code Online (Sandbox Code Playgroud)

我发现没有安装nginx插件:

[2014-10-14 06:30:59] plugin_load: Could not find plugin "nginx" in /usr/lib64/collectd
[2014-10-14 06:30:59] Found a configuration for the `nginx' plugin, but the plugin isn't loaded or didn't register a configuration callback.
Run Code Online (Sandbox Code Playgroud)

只需执行(AMI):

$ sudo yum install collectd-nginx
Run Code Online (Sandbox Code Playgroud)

一切都很完美