Custom Agent Check script no longer works since datadog-agent 7.38.0
See original GitHub issueI 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:
-
clone https://github.com/sogaoh/datadog-agent-status-metricize/
-
configure Custom Agent Check, place the check script
custom_dd_agent_status.py
-
(re)start datadog-agent
-
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:
- Created a year ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @sogaoh that’s great to hear! This PR addressed the issue: https://github.com/DataDog/datadog-agent/pull/13117
Hi @sogaoh, agent
7.39.0
was released today, please let us know if this has resolved your issue.