New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkable#ProcessCheckResult(): don't overwrite check source #8158
Conversation
Before
After
|
aeb0a00
to
a8d2983
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also test this with a service? Seems to only work for hosts:
curl -skSu root:icinga -H 'Accept: application/json' 'https://localhost:5665/v1/actions/process-check-result' -d '{ "type": "Service", "filter": "host.name==\"master-1\" && service.name==\"icinga-health\"", "exit_status": 0, "plugin_output": "Hello World", "check_source": "foo", "pretty": true }' && curl -skSu root:icinga -H 'Accept: application/json' 'https://localhost:5665/v1/objects/services/master-1!icinga-health?pretty=1'
{
"results": [
{
"code": 200.0,
"status": "Successfully processed check result for object 'master-1!icinga-health'."
}
]
}
{
"results": [
{
"attrs": {
"__name": "master-1!icinga-health",
[...]
"last_check": 1611578640.206652,
"last_check_result": {
"active": false,
"check_source": "master-1",
"command": null,
"execution_end": 1611578640.206652,
"execution_start": 1611578640.206652,
"exit_status": 0.0,
"output": "Hello World",
"performance_data": [],
"schedule_end": 1611578640.206652,
"schedule_start": 1611578640.206652,
"state": 0.0,
"ttl": 0.0,
"type": "CheckResult",
"vars_after": {
"attempt": 1.0,
"reachable": true,
"state": 0.0,
"state_type": 1.0
},
"vars_before": {
"attempt": 1.0,
"reachable": true,
"state": 0.0,
"state_type": 1.0
}
},
[...]
"name": "master-1!icinga-health",
"type": "Service"
}
]
}
|
Ok, looks like the issue is not necessarily host vs. service. But something strange is going on here. 1843 service results are processed and all of them show the correct output in the API (freshly chosen for that command), however only 1730 show the proper check source:
|
Looks like the pattern could be that it doesn't work for services created by apply rules. |
All of my services are created via apply rules. Have you tried to rebase locally? |
No, I've been testing on the PR branch as is. But I found out what happened: it's not apply rules but the command endpoint (there's just significant overlap between the two in my test setup). For these, the check source will still be overwritten just a few lines later: icinga2/lib/icinga/checkable-check.cpp Lines 126 to 128 in a8d2983
So maybe just put both of these ifs into a new |
... set by passive check results. refs #7948
a8d2983
to
c3eba7e
Compare
... set by passive check results.
fixes #7948