Thruk REST API. Escape forward slash

87 views
Skip to first unread message

jiltsovs

unread,
Oct 17, 2019, 3:05:36 AM10/17/19
to Thruk
Hello!
How to escape forward slash for service name  in Thruk REST API?

For example:
/usr/bin/thruk r -b 6786d -d "name=COMMENT_DTLN" -d "value=none" "/services/Hostname/GigabitEthernet0/18/cmd/change_custom_svc_var"

returns  "unknown rest path"



Sven Nierlein

unread,
Oct 17, 2019, 3:08:51 AM10/17/19
to th...@googlegroups.com, jiltsovs
Hi,

it has to be url encodeded, in your case / can be encoded as %25

Cheers,
Sven

On 17.10.19 9:05, jiltsovs wrote:
> Hello!
> How to escape forward slash for service name  in Thruk REST API?
>
> For example:
> /usr/bin/thruk r -b 6786d -d "name=COMMENT_DTLN" -d "value=none" "/services/Hostname/GigabitEthernet0*/*18/cmd/change_custom_svc_var"
>
> returns  "unknown rest path"
>

jiltsovs

unread,
Oct 21, 2019, 4:17:34 AM10/21/19
to Thruk
Hello, Sven!
I replaced / to %2F
This works fine.
Thank you!


четверг, 17 октября 2019 г., 10:08:51 UTC+3 пользователь Sven Nierlein написал:

jiltsovs

unread,
Oct 14, 2021, 11:01:06 AM10/14/21
to Thruk
Hi!
After upgrading to  Version 2.44.3 problem with Thruk REST API commands rises again.
Encoding forward slash with %2F doesn't work. In Version 2.40 commands work fine.
Request:
Response:
<html>

<head>
    <title>404 Not Found</title>
</head>

<body>
    <h1>Not Found</h1>
    <p>The requested URL /thruk/r/sites/7215e/services/localhost/Simple\test\service-1/2/3 -
        Service/cmd/acknowledge_svc_problem was not found on this server.</p>
</body>

</html>


понедельник, 21 октября 2019 г. в 11:17:34 UTC+3, jiltsovs:

Sven Nierlein

unread,
Oct 18, 2021, 8:50:07 AM10/18/21
to th...@googlegroups.com, jiltsovs
Hi,

i made some tests and it seems to be related to the apache option:
http://httpd.apache.org/docs/2.4/en/mod/core.html#allowencodedslashes
Adding "AllowEncodedSlashes NoDecode" to the apache config seems to work.
You might need to add it to the vhost as well. I will update the apache
example configuration.

Cheers,
Sven


Am 14.10.21 um 17:01 schrieb jiltsovs:
> --
> You received this message because you are subscribed to the Google Groups "Thruk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to thruk+un...@googlegroups.com <mailto:thruk+un...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/thruk/deb7f887-7ca5-4ca9-9ca8-80167bb025acn%40googlegroups.com <https://groups.google.com/d/msgid/thruk/deb7f887-7ca5-4ca9-9ca8-80167bb025acn%40googlegroups.com?utm_medium=email&utm_source=footer>.

jiltsovs

unread,
Oct 19, 2021, 6:53:49 AM10/19/21
to Thruk
Hi,
it was.
After adding  "AllowEncodedSlashes NoDecode" all works fine.
Thank you!

понедельник, 18 октября 2021 г. в 15:50:07 UTC+3, Sven Nierlein:
Reply all
Reply to author
Forward
0 new messages