api failed with service_descriptions contained spec chars

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
axvers
Posts: 65
Joined: Tue Jan 08, 2019 8:31 pm

api failed with service_descriptions contained spec chars

Post 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")
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: api failed with service_descriptions contained spec char

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
axvers
Posts: 65
Joined: Tue Jan 08, 2019 8:31 pm

Re: api failed with service_descriptions contained spec char

Post by axvers »

OK. Thank you!
Locked