oracle / weblogic-monitoring-exporter

WebLogic Monitoring Exporter exposes metrics and monitoring data through REST APIs for consumption by other tools (e.g. Prometheus)
Universal Permissive License v1.0
105 stars 80 forks source link

Deploy on multiple Managed Servers #368

Open augeivv opened 9 months ago

augeivv commented 9 months ago

I think the moitoring exporter is great. However, we have a fundamental problem. However, we would like to deploy it in a classic weblogic domain in which the administration port is activated. According to the documentation, the REST port must then be specified. The whole thing also works for a single managed server. However, if I want to deploy the whole thing on all managed servers, the administration port differs per server. This means that I would have to adjust the configuration several times per server and then also deploy the application several times. Is there an easier way to do this, where the port can be determined dynamically or something like that?

Thank you very much

russgold commented 9 months ago

The REST port only needs to be specified if it is different from the port on which you are contacting the exporter. Under most conditions, it would be the same, so you don't need to specify it.

The most common in which it is not the same is when you have a load balancer in the middle, which will redirect requests to different ports that the one on the load balancer.

augeivv commented 9 months ago

@russgold I already understood that at this point. However, we use the administration port in our Weblgic domain. This means that we have the following structure as an example:

The application is accessible under the 10001 port. However, the rest of the API is under 30001. If I now also want to deploy the exporter on the Managed-Server-2, I have to adjust the configuration and make it available as a second deployment in the domain. And for the Managed-Server-3 as well. And for the fourth ... I find this situation very unfortunate. That's why I'm looking for a better solution.

augeivv commented 8 months ago

Hello @russgold, is there any news on this topic yet?

russgold commented 7 months ago

@augeivv That sounds as though it would need an enhancement to the syntax. Do you have some ideas on what would work? A single configuration would need some way to tell which port is used where.

Do you have an Oracle support person who could look at your application? I don't understand why each server would need its own port numbers.

augeivv commented 7 months ago

@russgold To the first question: I could imagine that a query of the ServerRuntime could be built into the Monitoring Exporter. The Monitoring Exporter should use the Administration URL for the query.

This is available in the ServerRuntime under 'getAdministrationURL()'. https://docs.oracle.com/middleware/12212/wls/WLAPI/weblogic/management/runtime/ServerRuntimeMBean.html#getAdministrationURL--

When the administration port is activated, the operation returns the URL that the server and its clients use for administrative connections. If this is not active, it returns the default channel URl.

To the second question: We would like to use the monitoring exporter for our classic WLS installations as well. So not in the Kubernetes world. There is a weblogic domain with several managed servers installed on a Linux VM. Each managed server provides its services on its own port. As two managed servers cannot work on the same port. In addition, the administration port is active in the domain. This means that the rest api of the weblogic is accessible on an administration channel and not on the default channel.

Furthermore, what exactly do you mean by "your application"?

russgold commented 7 months ago

I meant, how you have set up your servers so that each one needs its own port numbers. My understanding was that one usually used the same port numbers on different servers.

augeivv commented 7 months ago

Multiple weblogic server instances can also be run on the same server. Nowhere is it defined that each instance must be run on different servers. It must only be ensured that they work on different ports so that they can start at all. I'll look for the exact description in the documentation again. And add it here...

In the domain, a separate listen port can be set for each weblogic instance. The setting can be found in the Administration Console as follows. expand Environment and select Servers. On the Servers page, click the name of the server. Select Configuration > General.

augeivv commented 2 months ago

hello @russgold ,

I noticed last week that Weblogic 14.1.2 has the secure production mode as default. This means that the administration port will soon be active. For this reason I wanted to ask again if there is any news about this?

mriccell commented 1 week ago

hello @augeivv Is your domain running in Kubernetes with the WebLogic Kubernetes Operator or are the WL servers running in VMs? Could you run one or more servers in the same VM?

russgold commented 1 week ago

The most obvious solution is not to use the REST_PORT setting and simply access the exporters on the admin ports. Then you would not need a different configuration for each server. Did you try that? If so, what happened?

augeivv commented 1 week ago

hello @mriccell & @russgold our domain is running in VMs. We usually run multiple servers in the same VM.

If I do not specify the rest port, I get a "Not authorized" back.

In my opinion, the port from the current request is used for the internal call of the rest-api to determine the metrics. https://github.com/oracle/weblogic-monitoring-exporter/blob/2a366a37f0b89d2771141a49973a621585051292/wls-exporter-core/src/main/java/com/oracle/wls/exporter/ServletInvocationContext.java#L41

If the administration port is active on the domain, the exporter is accessible on a different port than the rest-api.

Is there a way to simply access the exporter via the admin ports? In my case, the exporter cannot be accessed via the admin port.

russgold commented 1 week ago

In the usual setup, you would indeed access the exporter via the admin port, if that is enabled.

But I have only worked with two setups - the normal WLS system, in which each server is on a different host, or in Kubernetes with the Weblogic Kubernetes Operator (the easiest choice).

Can you describe your environment? The JVM is a VM, but I am guessing that's not what you mean, here - and you're not using Kubernetes, either?

kemalunel commented 1 week ago

Also I'm having an issue like that. I deployed exporter to one of my cluster in wl server but it could not call api to get metrics. it causes, can't see metrics page. I see 404

mriccell commented 1 week ago

We will open an enhancement on the monitoring exporter so that the exporter can be accessed via the admin port when serverhave have different admin ports configured (and of course enabled) because the servers are running on the same VM.

russgold commented 1 week ago

@kemalunel To be clear, you can reach the main page of the exporter app, but when you hit the metrics link, you get a 404? There is also a messages link; what happens when you try that?

kemalunel commented 1 week ago

@kemalunel To be clear, you can reach the main page of the exporter app, but when you hit the metrics link, you get a 404? There is also a messages link; what happens when you try that?

Yes I'm able to connect to main page but when I try to upload config file over browser or try to reach metrics and message path, I'm getting the same error 404.

Those clusters are running on different ports if you compare with admin server. I'm suspecting that wls-exporter cannot use api feature of weblogic.

augeivv commented 1 week ago

@russgold our environment looks as follows. we have a weblogic domain on a host (vm) with several managed servers (jvm). each managed server use different ports for listen, ssl listen and admin port. we do not use kubernetes here. because we also want metrics for our classic installation.

kemalunel commented 1 week ago

Ok I've fixed 404 error when I try to reach /metrics path with enabling Restful services features on Domain > Advance configuration. but now, when I try to reach metrics page, it asks me username and password.How to deal with that because I'll add this endpoint to prometheus config

russgold commented 1 week ago

@kemalunel you can add username / password to your Prometheus configuration. WLS requires them to report internal data.

russgold commented 1 week ago

@augeivv We didn't consider such a configuration when creating the exporter. We're going to look at an enhancement to handle that more easily.

augeivv commented 5 days ago

@russgold It would be great if there was a solution for this. Thank you very much.