Как добавить больше мониторов в heartbeat.yml? - PullRequest
0 голосов
/ 14 октября 2019

Я пробую Uptime функцию в Кибане. Я скачал Heartbeat и запустил его с настройками по умолчанию. Это работает хорошо.

Однако, когда я попытался добавить больше мониторов в heartbeat.monitors в heartbeat.yml. Я сталкиваюсь с ошибкой.

Ниже приведено значение по умолчанию, и оно работает нормально.
haertbeat.yml

# Configure monitors inline
heartbeat.monitors:
- type: http

  # List or urls to query
  urls: ["http://localhost:9200"]

  # Configure task schedule
  schedule: '@every 10s'

  # Total test connection and data exchange timeout
  #timeout: 16s  

Однако, когда я добавляю следующее, я получаю сообщение об ошибке.

# Configure monitors inline
heartbeat.monitors:
- type: http

  # List or urls to query
  urls: ["http://localhost:9200"]

  # Configure task schedule
  schedule: '@every 10s'

  # Total test connection and data exchange timeout
  #timeout: 16s  
- type: icmp                       <------ When I try to add tcp or icmp,
   schedule: '@every 10s'          <------ I get an error. I am doing something
   hosts: ["localhost"]            <------  wrong. How can I add more monitors?
PS C:\Program Files\Heartbeat> Start-Service heartbeat
Start-Service : Service 'heartbeat (heartbeat)' cannot be started due to the following error: Cannot start service heartbeat on computer '.'.
At line:1 char:1
+ Start-Service heartbeat
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
+ FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

Когда я стираю то, что хотел добавить, он отлично работает. Как я могу добавить больше мониторов в heartbeat.yml?

1 Ответ

1 голос
/ 14 октября 2019

Я твердо уверен, что проблема с отступами в файле YAML.

Посмотрите на свой монитор icmp:

- type: icmp                       <------ When I try to add tcp or icmp,
   schedule: '@every 10s'          <------ I get an error. I am doing something
   hosts: ["localhost"]            <------  wrong. How can I add more monitors?

Есть пробелы перед настройками schedule и hosts,

Теперь посмотрите на монитор по умолчанию:

heartbeat.monitors:
- type: http

  # List or urls to query
  urls: ["http://localhost:9200"]

  # Configure task schedule
  schedule: '@every 10s'

  # Total test connection and data exchange timeout
  #timeout: 16s  

Выровняйте настройки точно под полем type и запустите его снова.

...