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

whitespace in hostname render API unable to get labels #12

Open
cklagenberg opened this issue Sep 12, 2019 · 0 comments
Open

whitespace in hostname render API unable to get labels #12

cklagenberg opened this issue Sep 12, 2019 · 0 comments

Comments

@cklagenberg
Copy link

Hi

If there is whitespace in "<NAGIOS_DISP_HOSTNAME>" variable in pnp4nagios serivce xml file, I get XML file not found when posting to the labels endpoint.

API endpoints for host and service works.
If the "<NAGIOS_DISP_HOSTNAME>" variable is changed so it fits the "<NAGIOS_HOSTNAME>" variable in the pnp4nagios service XML file it works and I can get a fine graph in Grafana.

Hope it makes sense.

I am not sure that this issue is related to the API controller it self. I don't know PHP but it seems to be the most logical place to start looking for any bugs?
Also, I know whitspace can be a pain, but since it is supported in the Nagios Core I guess it should also be working in pnp4nagios api interface. I can also add that viewing graphs in pnp4nagios works fine with whitespace's in hostnames.

OK example with curl:
LiveU_diskplads.xml:
<NAGIOS_DISP_HOSTNAME>AP3100_LiveU1</NAGIOS_DISP_HOSTNAME>

curl -s -H "Content-Type: application/json" -X POST -d '
{
"host":"AP3100_LiveU1",
"service":"LiveU_diskplads"
}' http://127.0.0.1/pnp4nagios/index.php/api/labels

{"labels":[{"name":"Liveu","label":"disk","service":"LiveU_diskplads","hostname":"AP3100_LiveU1"}]}

BAD example with curl:
LiveU_diskplads.xml:
Fail when <NAGIOS_DISP_HOSTNAME>AP3100 LiveU1</NAGIOS_DISP_HOSTNAME>

curl -s -H "Content-Type: application/json" -X POST -d '
{
"host":"AP3100_LiveU1",
"service":"LiveU_diskplads"
}' http://127.0.0.1/pnp4nagios/index.php/api/labels

{"error":
"XML file "/usr/local/pnp4nagios/var/perfdata/AP3100 LiveU1/LiveU_diskplads.xml" not found.
<a href="http://docs.pnp4nagios.org/faq/6">Read FAQ online</a>"}

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

No branches or pull requests

1 participant