Skip to content
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

Returncode is null on destination when value is 0 (zero) #1217

Open
Juanma-Segura opened this issue Oct 22, 2024 · 0 comments
Open

Returncode is null on destination when value is 0 (zero) #1217

Juanma-Segura opened this issue Oct 22, 2024 · 0 comments
Labels

Comments

@Juanma-Segura
Copy link

At the moment of recieving the XML dictionary on destination with tag status this tag is empty when its value is zero.

This is an example of void tag status parsed to JSON:

{
	"@type": "service",
	"servicename": "CPU Usage",
	"hostname": "my.servername.local",
	"state": null,
	"output": "OK: Percent was 2.82 % | percent=2.82%;60;80;"
}

And this is the original message:

<QueryDict: {'token': ['SUPERSECRETTOKEN'], 'XMLDATA': ['<?xml version="1.0" ?><checkresults><checkresult type="service"><servicename>CPU Usage</servicename><hostname>my.servername.local</hostname><state/><output>OK: Percent was 2.01 % | \'percent\'=2.01%;60;80;</output></checkresult></checkresults>'], 'cmd': ['submitcheck']}>

Taking a look at the code, the value "is lost" at the moment of converting the dictionary into a xml. I would like to know if it is the desired behaviour or if it's an uncontrolled side effect.

In the second case, the problem could be solved just adding strict conversion to string at line 69 of the file agent/passive/nrpd.py. Of course I'll be glad to make the PR for this if you would like to.

Many thanks in advance.

@ne-bbahn ne-bbahn added the 3.X.X label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants