0

我的 sensu-client 在启动(全新安装)期间失败,/var/log/sensu/sensu-client.log尽管我添加LOG_LEVEL=debug/etc/default/sensu. 我在其他 sensu 客户端(复制的 ssl 证书)上使用了类似的 client.json 和 rabbitmq.json 配置文件(在 /etc/sensu/conf.d 中)。

   $ sudo service sensu-client start
    [FAILED] sensu-client[  OK  ]

以下是 sensu-client 日志

$ tail -f /var/log/sensu/sensu-client.log 
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/daemon.rb:187:in `setup_transport'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:412:in `start'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:19:in `block in run'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:18:in `run'
        from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/bin/sensu-client:10:in `<top (required)>'
        from /opt/sensu/bin/sensu-client:23:in `load'
        from /opt/sensu/bin/sensu-client:23:in `<main>'
^C

这是默认配置

$ cat /etc/default/sensu 
EMBEDDED_RUBY=false
LOG_LEVEL=debug

即使重新启动我的 RHEL7 也无济于事,请参阅下面的日志

Mar 25 13:09:24 nms02w sensu-client: Starting sensu-client[  OK  ]#015[FAILED]
Mar 25 13:09:24 nms02w systemd: sensu-client.service: control process exited, code=exited status=1
Mar 25 13:09:24 nms02w systemd: Unit sensu-client.service entered failed state.
Mar 25 13:09:24 nms02w systemd: sensu-client.service failed.

添加更多日志:

 systemctl status sensu-client.service
● sensu-client.service - LSB: Sensu monitoring framework client
   Loaded: loaded (/etc/rc.d/init.d/sensu-client)
   Active: failed (Result: exit-code) since Fri 2016-03-25 13:09:24 EDT; 1h 47min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 948 ExecStart=/etc/rc.d/init.d/sensu-client start (code=exited, status=1/FAILURE)

Mar 25 13:09:21 nms02w systemd[1]: Starting LSB: Sensu monitoring framework client...
Mar 25 13:09:21 nms02w runuser[983]: pam_unix(runuser:session): session opened for user sensu by (uid=0)
Mar 25 13:09:24 nms02w sensu-client[948]: [38B blob data]
Mar 25 13:09:24 nms02w systemd[1]: sensu-client.service: control process exited, code=exited status=1
Mar 25 13:09:24 nms02w systemd[1]: Failed to start LSB: Sensu monitoring framework client.
Mar 25 13:09:24 nms02w systemd[1]: Unit sensu-client.service entered failed state.
Mar 25 13:09:24 nms02w systemd[1]: sensu-client.service failed.
4

1 回答 1

0

我对旧版本的 sensu 也有同样的问题:0.20.3-1 此处描述的完整错误消息:

/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:859:in `open_udp_socket': no datagram socket (RuntimeError)
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:859:in `open_datagram_socket'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:355:in `setup_sockets'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:413:in `start'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:19:in `block in run'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/lib/sensu/client/process.rb:18:in `run'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.20.3/bin/sensu-client:10:in `<top (required)>'
from /opt/sensu/bin/sensu-client:23:in `load'
from /opt/sensu/bin/sensu-client:23:in `<main>'

问题是`open_udp_socket': no datagram socket (RuntimeError)这意味着 udp 套接字已经在使用,并且 sensu-client 无法绑定它。好的,您总是可以尝试找到使用套接字的暂停进程:

root@xxx- /etc/sensu/conf.d/checks $ netstat -ntulp|grep 3030 
udp     0      0 127.0.0.1:3030   0.0.0.0:*                           603/sudo
root@xxx- /etc/sensu/conf.d/checks $ kill -9 603

之后,sensu-client 将正确启动。

root@xxx- /etc/sensu/conf.d/checks $ /etc/init.d/sensu-client start
 * Starting sensu-client                                [ OK ]

亲切的问候

于 2017-03-20T15:51:41.543 回答