Skip to content

Conversation

@sunryeokkim
Copy link

What does this PR do?

Previously, when a ping command returned a non-zero exit code, the check raised a CheckException, causing the entire check run to fail. This behavior made the Agent mark the check as ERROR, even for normal network conditions such as a host being temporarily unreachable.

Review checklist

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests

Additional Notes

Testing
• Verified on Linux (RHEL 9) — correct behavior for both reachable and unreachable hosts.
• Verified on Windows Server 2022 — correct behavior for both reachable and unreachable hosts.
• Both environments report accurate service check statuses and metrics, with no false-positive response times.

@sunryeokkim sunryeokkim self-assigned this Oct 29, 2025
@sunryeokkim
Copy link
Author

@jstanton617 Could you please review this PR when you have a chance?
This update refines PingCheck error handling and has passed validation on Linux and Windows.

@sunryeokkim sunryeokkim requested a review from masafm November 11, 2025 05:45
Copy link

@masafm masafm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you reviewed or updated the test cases to align with this change?

# Real execution error (e.g. missing binary, permission, DNS failure)
# The service check is marked CRITICAL, and the check itself raises an error.
self.log.info("%s check error (%s)", host, e)
self.service_check(self.SERVICE_CHECK_NAME, AgentCheck.CRITICAL, custom_tags, message=str(e))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not exactly a correction, but wouldn’t AgentCheck.UNKNOWN instead of AgentCheck.CRITICAL be more appropriate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants