Hello All,

I am trying to send the runtime of a scala job as a metric to pushgateway 
running on another server. The pushgateway URL is like 
https://pushgateway.de/pushgateway which redirects to :9091/metrics. I am 
using the below code where I am passing the URL, username and password from 
the docker run command.
----------------------------------------------------------------------------------------
val pg = new PushGateway(hostname) 
val username = sys.env("PROMETHEUS_USERNAME") 
val password = sys.env("PROMETHEUS_PASSWORD") 
pg.setConnectionFactory(pg.setConnectionFactory(new 
BasicAuthHttpConnectionFactory(username, password)) pg.pushAdd(registry, 
jobName)
pg.pushAdd(registry, jobName)

-----------------------------------------------------------------------------------------

When I run this code I get the below error

Exception in thread "main" java.net.UnknownHostException: https
at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at io.prometheus.client.exporter.PushGateway.doRequest(PushGateway.java:243)
at io.prometheus.client.exporter.PushGateway.pushAdd(PushGateway.java:156)


I curled the URL and I am able to do it. Could you please let me know how 
can I resolve this issue?

Regards,
Pradeep

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/d8531e89-b27c-492e-b934-83650e74c8e7n%40googlegroups.com.

Reply via email to