question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Agent Check script no longer works since datadog-agent 7.38.0

See original GitHub issue

I got the output: (*1)

❯ sudo -u dd-agent -- datadog-agent check custom_dd_agent_status
error: OS version not found in agent metadata cache
=========
Collector
=========

  Running Checks
  ==============

    custom_dd_agent_status (1.5.0)
    ------------------------------
      Instance ID: custom_dd_agent_status:65b6fde3b310d187 [ERROR]
      Configuration Source: file:/etc/datadog-agent/conf.d/custom_dd_agent_status.yaml
      Total Runs: 1
      Metric Samples: Last Run: 0, Total: 0
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 0, Total: 0
      Average Execution Time : 150ms
      Last Execution Date : 2022-08-13 16:47:03 JST / 2022-08-13 07:47:03 UTC (1660376823000)
      Last Successful Execution Date : Never
      Error: Extra data: line 1 column 5 (char 4)
      Traceback (most recent call last):
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/base.py", line 1120, in run
          self.check(instance)
        File "/etc/datadog-agent/checks.d/custom_dd_agent_status.py", line 125, in check
          agent_status_data = self.get_status()
        File "/etc/datadog-agent/checks.d/custom_dd_agent_status.py", line 46, in get_status
          status = json.loads(out)
        File "/opt/datadog-agent/embedded/lib/python3.8/json/__init__.py", line 357, in loads
          return _default_decoder.decode(s)
        File "/opt/datadog-agent/embedded/lib/python3.8/json/decoder.py", line 340, in decode
          raise JSONDecodeError("Extra data", s, end)
      json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)

Check has run only once, if some metrics are missing you can try again with --check-rate to see any other metric if available.

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

  • OS(/etc/os-release): Amazon Linux 2
  • CPU Arch(arch): x86_64

Steps to reproduce the issue:

  1. clone https://github.com/sogaoh/datadog-agent-status-metricize/

  2. configure Custom Agent Check, place the check script custom_dd_agent_status.py

  3. (re)start datadog-agent

  4. run script

    • sudo -u dd-agent -- datadog-agent check custom_dd_agent_status

Describe the results you received:

(*1)

Describe the results you expected:


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

  Running Checks
  ==============

    custom_dd_agent_status (1.5.0)
    ------------------------------
      Instance ID: custom_dd_agent_status:65b6fde3b310d187 [OK]
      Configuration Source: file:/etc/datadog-agent/conf.d/custom_dd_agent_status.yaml
      Total Runs: 1
      Metric Samples: Last Run: 11, Total: 11
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 0, Total: 0
      Average Execution Time : 96ms
      Last Execution Date : 2022-08-13 16:50:41 JST / 2022-08-13 07:50:41 UTC (1660377041000)
      Last Successful Execution Date : 2022-08-13 16:50:41 JST / 2022-08-13 07:50:41 UTC (1660377041000)


Check has run only once, if some metrics are missing you can try again with --check-rate to see any other metric if available.

Additional information you deem important (e.g. issue happens only occasionally):

  • OK on Agent 7.37.1 - Commit: 3c29612 - Serialization version: v5.0.22 - Go version: go1.17.11
  • ERROR on Agent 7.38.0 above

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sarah-wittcommented, Sep 12, 2022

Hi @sogaoh that’s great to hear! This PR addressed the issue: https://github.com/DataDog/datadog-agent/pull/13117

1reaction
sarah-wittcommented, Sep 12, 2022

Hi @sogaoh, agent 7.39.0 was released today, please let us know if this has resolved your issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Agent Troubleshooting
Agent Troubleshooting. If you have not yet installed the Datadog Agent, go to the dedicated Agent integration page for installation instructions.
Read more >
Custom Agent Check
In this example, the custom check sends a value of 1 for the metric hello.world . The configuration file includes no real information...
Read more >
Agent Version differences
The only change from Agent v6 is that this version only includes support for Python 3 for integrations and custom checks. See the...
Read more >
Datadog Windows Agent User
Important: Since the account is modified during installation to restrict its privileges, including login privileges, make sure it is not a 'real' user ......
Read more >
Agent Check Status
The following command shows the status of the Datadog Agent. sudo systemctl status datadog-agent. If the Agent failed to start, and no further...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found