Consume WebLogic Server RESTFul Management Services with ELK

Posted by Dirk Nachbar on Wednesday, March 22, 2017
In several of my projects for Oracle WebLogic Server and Oracle Fusion Middleware Environments a main topic is the monitoring.
Oracle provides with the Oracle Enterprise Manager Cloud Control are really powerful solution to monitor Oracle WebLogic Server and Oracle Fusion Middleware Environments, but the disadvantage is the huge license cost for the necessary Management Packs for Oracle WebLogic / Fusion Middleware. Moreover in many small to midrange sized environments the Oracle Enterprise Manager Cloud Control can be an overkill and due to the license costs for the Management Packs a no-go.

There are several solutions on the market, some commercial and some open source, for Oracle WebLogic Server Monitoring.

I will show you a short test case, how to consume Oracle WebLogic Server RESTFul Management Services with the so called ELK Stack (Elasticsearch / Logstash / Kibana). How to setup the ELK stack, just check Google or the documentation on elastic.co https://www.elastic.co/guide/en/elastic-stack/current/index.html

My environment is as follows:

  • Ubuntu 16.04 server named "monitoring" which is hosting my ELK Stack
  • Oracle Enterprise Linux named "wls12212" which is hosting my Oracle WebLogic Server with a Domain called demo_domain
    • AdminServer running on Port 7001
On the ELK server monitoring add a Logstash configuration file wls-rest.conf under /etc/logstash/conf.d
For this I will use the Input Plugin http_poller (see https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http_poller.html)

input {
  http_poller {
    urls => {
      test1 => {
        method => get
        # define the RESTFul Management Service URL
        url => "http://wls12212:7001/management/wls/latest/servers"
        headers => {
          Accept => "application/json"
        }
        # Define the Basic Authentication against the WebLogic Server
        auth => {
          user => "weblogic"
          password => "welcome01"
        }
      }
    }
    request_timeout => 30
    # poll every 60 seconds the metrics
    interval => 60
    # Set the Codec to json
    codec => "json"
    metadata_target => "http_poller_metadata"
  }
}

output {
  # Output to elasticsearch
  elasticsearch { hosts => ["localhost:9200"] }
  # Output to stdout
  stdout { codec => rubydebug }
}


Now we can start our logstash process on the ELK server monitoring

/opt/logstash/bin/logstash -f /etc/logstash/conf.d/wls-rest.conf
Settings: Default pipeline workers: 1
Pipeline main started
{
                   "items" => [
        [0] {
                   "heapFreeCurrent" => 188998424,
                   "heapSizeCurrent" => 374341632,
                "usedPhysicalMemory" => 3520323584,
                  "jvmProcessorLoad" => 0,
                            "health" => {
                "state" => "ok"
            },
            "activeHttpSessionCount" => 0,
                 "activeThreadCount" => 11,
                              "name" => "DemoAdminServer",
                             "state" => "running"
        },
        [1] {
                   "heapFreeCurrent" => 275771456,
                   "heapSizeCurrent" => 401080320,
                "usedPhysicalMemory" => 3520323584,
                  "jvmProcessorLoad" => 0,
                            "health" => {
                "state" => "ok"
            },
            "activeHttpSessionCount" => 0,
                 "activeThreadCount" => 8,
                              "name" => "DemoMS1",
                             "state" => "running"
        },
. . .
. . .


Now we can check in Kibana the Indices under Settings:



and define our Visualization under Visualize:




With this really simple configuration you can consume all available Metrics within the WebLogic RESTFul Management Services via ELK Stack just by defining the url in the http_poller configuration, visualise them, create dashboard and with the Output Plugins in Logstash (https://www.elastic.co/guide/en/logstash/current/output-plugins.html) you can even define notifications through Email, Nagios, Zabbix and so on ...