繁体   English   中英

sensu-client check-memory示例工作正常

[英]sensu-client check-memory sample work working

我正努力让感觉工作。

以下是sensu-client.log

ubuntu@ip:~$ sudo tail -f  /var/log/sensu/sensu-client.log 
{"timestamp":"2016-09-27T16:07:37.628182-0400","level":"info","message":"completing checks in progress","checks_in_progress":[]}
{"timestamp":"2016-09-27T16:07:38.128912-0400","level":"info","message":"closing client tcp and udp sockets"}
{"timestamp":"2016-09-27T16:07:38.129275-0400","level":"warn","message":"stopping reactor"}
{"timestamp":"2016-09-27T16:07:39.224377-0400","level":"warn","message":"loading config file","file":"/etc/sensu/config.json"}
{"timestamp":"2016-09-27T16:07:39.224487-0400","level":"warn","message":"loading config files from directory","directory":"/etc/sensu/conf.d"}
{"timestamp":"2016-09-27T16:07:39.224528-0400","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/check_mem.json"}
{"timestamp":"2016-09-27T16:07:39.224573-0400","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/check_mem.json","changes":{}}
{"timestamp":"2016-09-27T16:07:39.224618-0400","level":"warn","message":"applied sensu client overrides","client":{"name":"localhost","address":"127.0.0.1","subscriptions":["test","client:localhost"]}}
{"timestamp":"2016-09-27T16:07:39.230963-0400","level":"warn","message":"loading extension files from directory","directory":"/etc/sensu/extensions"}
{"timestamp":"2016-09-27T16:07:39.231048-0400","level":"info","message":"configuring sensu spawn","settings":{"limit":12}}

/etc/sensu/client.json包含

{
"rabbitmq": {
    "host": "ipaddressofsensuserver",
    "port": 5672,
    "user": "username",
    "password": "password",
    "vhost": "/sensu"
  },
  "api": {
    "host": "localhost",
    "port": 4567
  },
  "checks": {
    "test": {
      "command": "echo -n OK",
      "subscribers": [
        "test"
      ],
      "interval": 60
    },
    "memory-percentage": {
      "command": "check-memory-percent.sh -w 50 -c 70",
      "interval": 10,
      "subscribers": [
        "test"
      ]
     }
  },
  "client": {
    "name": "localhost",
    "address": "127.0.0.1",
    "subscriptions": [
      "test"
    ]
  }
}

我已将check-memory-present.sh复制到/etc/sensu/conf.d文件夹中

我希望日志文件每10秒运行一次check-memory-percent 我在这里错过了什么?

Sensu客户端无法完全独立于服务器运行,但它可以安排自己的运行检查并通过传输将其发送到服务器(在本例中为RabbitMQ)。 您必须添加"standalone": true才能使检查配置生效,然后重新启动sensu-client服务。

因此,文件/etc/sensu/conf.d/check_mem.json应该类似于:

"checks": {
  "memory-percentage": {
    "command": "/etc/sensu/conf.d/check-memory-percent.sh -w 50 -c 70",
    "interval": 10,
    "standalone": true
  }
}

请记住也要从/etc/sensu/client.json删除该块,因为如果您多次定义相同的检查名称,可能会得到意外的结果。

在Client.json中,在“client”下,您需要添加订阅。 就像在这里的例子。 它应该与您的支票的“订户”定义相匹配。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM