DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.83k stars 1.19k forks source link

[yaml] Agent reports invalid yaml #1587

Closed aaronjwhiteside closed 6 years ago

aaronjwhiteside commented 6 years ago

Output of the info page (if this is a bug)

Getting the status from the agent.

==============
Agent (v6.1.2)
==============

  Status date: 2018-04-13 00:43:53.901227 UTC
  Pid: 343
  Python Version: 2.7.14
  Logs: 
  Check Runners: 1
  Log Level: info

  Paths
  =====
    Config File: /etc/datadog-agent/datadog.yaml
    conf.d: /etc/datadog-agent/conf.d
    checks.d: /etc/datadog-agent/checks.d

  Clocks
  ======
    NTP offset: -0.000657569 s
    System UTC time: 2018-04-13 00:43:53.901227 UTC

  Host Info
  =========
    bootTime: 2018-04-11 00:51:39.000000 UTC
    kernelVersion: 4.9.75-25.55.amzn1.x86_64
    os: linux
    platform: debian
    platformFamily: debian
    platformVersion: 9.4
    procs: 73
    uptime: 171831
    virtualizationRole: guest
    virtualizationSystem: xen

  Hostnames
  =========
    ec2-hostname: ip-10-70-4-121.dv.yapstone.com
    hostname: i-0f410813af785d1a3
    instance-id: i-0f410813af785d1a3
    socket-fqdn: ip-10-70-4-121
    socket-hostname: ip-10-70-4-121

=========
Collector
=========

  Running Checks
  ==============
    cpu
    ---
      Total Runs: 33
      Metrics: 6, Total Metrics: 192
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    disk
    ----
      Total Runs: 33
      Metrics: 136, Total Metrics: 4488
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    docker
    ------
      Total Runs: 33
      Metrics: 51, Total Metrics: 1683
      Events: 0, Total Events: 2
      Service Checks: 1, Total Service Checks: 33

    file_handle
    -----------
      Total Runs: 33
      Metrics: 1, Total Metrics: 33
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    http_check
    ----------
      Total Runs: 33
      Metrics: 4, Total Metrics: 132
      Events: 0, Total Events: 0
      Service Checks: 2, Total Service Checks: 66
      Warning: Skipping SSL certificate validation for https://172.17.0.3:8443/user-profile-manage/health based on configuration

    io
    --
      Total Runs: 33
      Metrics: 130, Total Metrics: 4200
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    load
    ----
      Total Runs: 33
      Metrics: 6, Total Metrics: 198
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    memory
    ------
      Total Runs: 33
      Metrics: 14, Total Metrics: 462
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    network
    -------
      Total Runs: 33
      Metrics: 32, Total Metrics: 1056
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

    ntp
    ---
      Total Runs: 33
      Metrics: 1, Total Metrics: 33
      Events: 0, Total Events: 0
      Service Checks: 1, Total Service Checks: 33

    uptime
    ------
      Total Runs: 33
      Metrics: 1, Total Metrics: 33
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0

  Config Errors
  ==============
    jmx
    ---
      yaml: line 6: found character that cannot start any token

========
JMXFetch
========

  Initialized checks
  ==================
    no checks

  Failed checks
  =============
    no checks

=========
Forwarder
=========

  CheckRunsV1: 33
  IntakeV1: 5
  RetryQueueSize: 0
  Success: 71
  TimeseriesV1: 33

  API Keys status
  ===============
    https://6-1-2-app.agent.datadoghq.com,*************************c64e7: API Key valid

==========
Logs Agent
==========

  Logs Agent is not running

=========
DogStatsD
=========

  Checks Metric Sample: 13235
  Event: 3
  Events Flushed: 3
  Number Of Flushes: 33
  Series Flushed: 9323
  Service Check: 495
  Service Checks Flushed: 513
  Dogstatsd Metric Sample: 133

Describe what happened: for the following configuration file: jmx.yaml:

ad_identifiers:
    - user-profile

init_config:

instances:
  - host: %%host%%
    port: 9999

The DD agent reports line 6 as invalid, which is the instances: line, however I cannot find anything invalid about it.

00000000  61 64 5f 69 64 65 6e 74  69 66 69 65 72 73 3a 0a  |ad_identifiers:.|
00000010  20 20 20 20 2d 20 75 73  65 72 2d 70 72 6f 66 69  |    - user-profi|
00000020  6c 65 0a 0a 69 6e 69 74  5f 63 6f 6e 66 69 67 3a  |le..init_config:|
00000030  0a 0a 69 6e 73 74 61 6e  63 65 73 3a 0a 20 20 2d  |..instances:.  -|
00000040  20 68 6f 73 74 3a 20 25  25 68 6f 73 74 25 25 0a  | host: %%host%%.|
00000050  20 20 20 20 70 6f 72 74  3a 20 39 39 39 39 0a     |    port: 9999.|
0000005f
[ AGENT ] 2018-04-13 00:35:29 UTC | INFO | (file.go:69 in Collect) | File Configuration Provider: searching for configuration files at: /etc/datadog-agent/conf.d
[ AGENT ] 2018-04-13 00:35:29 UTC | WARN | (file.go:181 in collectEntry) | /etc/datadog-agent/conf.d/jmx.yaml is not a valid config file: yaml: line 6: found character that cannot start any token

Describe what you expected: There are no tabs and the first 6 lines are a carbon copy of another configuration file I was working on that doesn't have an issue being loaded, yet somehow this one is special..

Steps to reproduce the issue: Try to run with the provided

Additional environment details (Operating System, Cloud provider, etc):

Linux ip-10-70-4-121 4.9.75-25.55.amzn1.x86_64 #1 SMP Fri Jan 5 23:50:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
xvello commented 6 years ago

Hi @aaronjwhiteside ,

A run through an online yaml validator confirms the issue is most probably with the %%host%% token containing special characters. It must then be quoted, like so: "%%host%%"