Page 1 of 1

api failed with service_descriptions contained spec chars

Posted: Mon Sep 02, 2019 3:56 am
by axvers
(Need to abbreviate some word for the title limits.)

API always works fine until we XPUT a service whose service description contained "/", ":" and " " (space).

Here's the problem:

This is the service shown on Nagios XI looks like:

Code: Select all

"20001-Serial0/0:0 Status"
This is the part message of same service by XGET via API

Code: Select all

{
  ...
  "service_description": "20001-Serial0\/0:0 Status",
  ...
}
What I want is to update this service's check_interval via API.

Here is command:

Code: Select all

curl -k -XPUT 'https://<NXI_IP>/nagiosxi/api/v1/config/service/<config_name>/20001-Serial0%2F0%3A0%20Status?apikey=<mykey>&pretty=1&check_interval=10&retry_interval=2&max_check_attempts=2'
Return message:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /nagiosxi/api/v1/config/service/<config_name>/20001-Serial0/0:0 Status was not found on this server.</p>
</body></html>

Why would this "20001-Serial0%2F0%3A0%20Status" not match "20001-Serial0/0:0 Status" in API?


Could you help me test it?

I am pretty sure that it is not config_name wrong or other issue, because I can XPUT (update) other services whose description NOT contained those "need-to-be-urlencoded" characters. (e.g. "10004-PING")

Re: api failed with service_descriptions contained spec char

Posted: Tue Sep 03, 2019 10:14 am
by lmiltchev
We are aware of the issue. The put commands won't work with special characters in the URL path as these characters are decoded "at the apache level". We do have an internal task already for fixing the issue in Nagios XI 5.7.

Re: api failed with service_descriptions contained spec char

Posted: Wed Sep 04, 2019 10:26 pm
by axvers
OK. Thank you!