According to your advice, I wrote my extension with JAX-RS. It worked until
I tried with guacamole 1.0.0. Since then, I got an error 500 with the
following content:
{"message":"Unexpected internal
error","translatableMessage":{"key":"Unexpected internal
error","variables":null},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
Logs give:
ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: null
for uri: http://localhost/guacamole/api/ext/prometheus/metrics
DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
com.sun.jersey.api.NotFoundException: null for uri:
http://localhost/guacamole/api/ext/prometheus/metrics
what I'm concerned about is that with guacamole 0.9.14 when I tried to
access /api/ext endpoint, I had a 405 error. With guacamole 1.0.0 I
get an error 500 with the following logs:
ERROR o.a.g.rest.RESTExceptionMapper - An internal error occurred, but
did not contain an error message. Enable debug-level logging for
details.
DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected error in REST endpoint.
javax.ws.rs.WebApplicationException: null
I compiled my extension with java 1.6 and 1.7. It runs with TomCat 8.5.
Thanks
Le ven. 14 déc. 2018 à 19:36, Mike Jumper <[email protected]> a écrit :
> On Fri, Dec 14, 2018 at 7:58 AM tucky kong <[email protected]> wrote:
>
>> Hello,
>>
>> I try to write an extension to export Prometheus metrics with the
>> Promtheus Java client library and
>> I am stuck with the exporting part[1].
>>
>> I need my Guacamole extension to serve a `MetricsServlet` which extends
>> an `HttpServlet`[2].
>>
>> To do so, I tried to extend extend a `ServletModule` that implements the
>> Listener interface with an override of the `configureServlets` method which
>> contains the following code:
>>
>> ```
>> serve("/metrics").with(new MetricsServlet());
>> ```
>>
>> Unfortunately, the `configureServlets` method doesn't seems to be called
>> and Tomcat does not find the `/metrics` path.
>>
>
> A ServletModule will not be automatically loaded by Guacamole. The API
> that Guacamole provides for extensions to add their own endpoints, etc.
> leverages JAX-RS:
>
> http://guacamole.apache.org/doc/gug/guacamole-ext.html#ext-rest-resources
>
> http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#getResource--
>
> http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/UserContext.html#getResource--
>
> Does the library you're trying to use provide support for JAX-RS? If so,
> you could expose a REST resource that serves what you're looking for. That
> would be supported by the Guacamole extension API.
>
> - Mike
>
>
--
Philippe