Skip to content

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Giraldo authored and Carlos Giraldo committed Aug 31, 2018
1 parent a9ace96 commit 43053ec
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 63 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This is a custom metricbeat that monitor weblogic domains. Capture information a
- Datasource health and statistics
- Applications health and statistics

*Tested with version 6.3.2 of elasticsearch and kibana*

## Configuration

### Enable RESTful Management Services
Expand All @@ -22,8 +24,6 @@ This is a custom metricbeat that monitor weblogic domains. Capture information a

### Download Release

[https://github.com/carlgira/weblogicbeat/releases](https://github.com/carlgira/weblogic-beat/releases)

### Run

To run Weblogicbeat with debugging output enabled, run:
Expand All @@ -34,6 +34,10 @@ To run Weblogicbeat with debugging output enabled, run:

### Kibana

Install

./kibana-plugin install https://github.com/fbaligand/kibana-enhanced-table/releases/download/v0.7.1/enhanced-table-0.7.1_6.3.2.zip

It includes a set of visualizations and one dashboard for weblogic monitoring. Import the file [kibana-weblogic-dashboard-export.json](kibana-weblogic-dashboard-export.json)

![](docs/kibana-dashboard.png)
Expand All @@ -44,13 +48,13 @@ Sample configuration file

```
weblogicbeat:
period: 10s
period: 60s
host: http://localhost:7001
username: weblogic
password: welcome1
servername: server1
datasources: ["EssDS", "EssDS"]
applications: ["StuckThreadForFree", "otherapp"]
datasources: ["EssDS", "EDNDataSource"]
applications: ["ESSAPP", "sample-app"]
```
- period: How often an event is sent to the output
- host: Admin host and port
Expand Down Expand Up @@ -119,3 +123,9 @@ https://blog.dbi-services.com/using-weblogic-12c-restful-management-for-monitori

- Monitoring Domain Resources
https://docs.oracle.com/middleware/1221/wls/WLRUR/examples.htm#WLRUR203

- Weblogic monitoring exporter
https://github.com/oracle/weblogic-monitoring-exporter

- Jolokia
https://jolokia.org/
4 changes: 2 additions & 2 deletions _meta/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ weblogicbeat:
username: weblogic
password: welcome1
servername: server1
datasources: ["EssDS"]
applications: ["ESSAPP"]
datasources: ["EssDS", "EDNDataSource"]
applications: ["ESSAPP", "sample-app"]
49 changes: 42 additions & 7 deletions _meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
title: weblogicbeat
description:
fields:
- name: server
- name: wb_server
type: string
required: true
description: >
PLEASE UPDATE DOCUMENTATION
- name: metric_type
- name: wb_metric_type
type: string
required: true
description: >
Expand Down Expand Up @@ -42,11 +42,6 @@
required: true
description: >
PLEASE UPDATE DOCUMENTATION
- name: srv_jvmProcessorLoad
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: srv_health
type: string
required: false
Expand Down Expand Up @@ -137,3 +132,43 @@
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_overloadRejectedRequestsCount
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_pendingUserRequestCount
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_executeThreadTotalCount
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_stuckThreadCount
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_throughput
type: float64
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_hoggingThreadCount
type: int
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_state
type: string
required: false
description: >
PLEASE UPDATE DOCUMENTATION
- name: th_symptoms
type: string
required: false
description: >
PLEASE UPDATE DOCUMENTATION
73 changes: 52 additions & 21 deletions beater/weblogicbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func (bt *Weblogicbeat) Run(b *beat.Beat) error {
// APPLICATIONS STATUS
bt.ApplicationStatusEvent()

// THREAD STATUS
bt.ThreadStatusEvent()

counter++
}
}
Expand All @@ -91,7 +94,7 @@ func (bt *Weblogicbeat) ServerStatusEvent() {
SetHeader("Accept", "application/json").
SetHeader("X-Requested-By", "weblogicbeat").
SetBasicAuth(bt.config.Username, bt.config.Password).
Get(bt.config.Host + "/management/weblogic/latest/domainRuntime/serverRuntimes/" + bt.config.ServerName + "/JVMRuntime?links=none&fields=heapSizeCurrent,heapFreeCurrent,heapFreePercent,heapSizeMax,processCpuLoad")
Get(bt.config.Host + "/management/weblogic/latest/domainRuntime/serverRuntimes/" + bt.config.ServerName + "/JVMRuntime?links=none&fields=heapSizeCurrent,heapFreeCurrent,heapFreePercent,heapSizeMax")

if err_server_jvm != nil {
bt.SendErrorEvent(bt.config.ServerName, "server_status", fmt.Sprintf("%v", err_server_jvm))
Expand All @@ -101,25 +104,18 @@ func (bt *Weblogicbeat) ServerStatusEvent() {
json_server_jvm, _ := gabs.ParseJSON([]byte(resp_server_jvm.String()))
server_jvm := json_server_jvm.Data().(map[string]interface{})

processCpuLoad := server_jvm["processCpuLoad"]

if processCpuLoad == nil {
processCpuLoad = 0
}

server_status_event := beat.Event{
Timestamp: time.Now(),
Fields: common.MapStr{
"server": bt.config.ServerName,
"metric_type": "server_status",
"srv_name": server["name"],
"srv_state": server["state"],
"srv_heapFreeCurrent": int(server_jvm["heapFreeCurrent"].(float64) / 1000000),
"srv_heapSizeCurrent": int(server_jvm["heapSizeCurrent"].(float64) / 1000000),
"srv_heapSizeMax": int(server_jvm["heapSizeMax"].(float64) / 1000000),
"srv_jvmProcessorLoad": server_jvm["processCpuLoad"],
"srv_symptoms": fmt.Sprintf("%v", server_health["symptoms"]),
"srv_health": server_health["state"],
"wb_server": bt.config.ServerName,
"wb_metric_type": "server_status",
"srv_name": server["name"],
"srv_state": server["state"],
"srv_heapFreeCurrent": int(server_jvm["heapFreeCurrent"].(float64) / 1000000),
"srv_heapSizeCurrent": int(server_jvm["heapSizeCurrent"].(float64) / 1000000),
"srv_heapSizeMax": int(server_jvm["heapSizeMax"].(float64) / 1000000),
"srv_symptoms": fmt.Sprintf("%v", server_health["symptoms"]),
"srv_health": server_health["state"],
},
}
bt.client.Publish(server_status_event)
Expand Down Expand Up @@ -158,8 +154,8 @@ func (bt *Weblogicbeat) DatasourceStatusEvent() {
datasource_status_event := beat.Event{
Timestamp: time.Now(),
Fields: common.MapStr{
"server": bt.config.ServerName,
"metric_type": "datasource_status",
"wb_server": bt.config.ServerName,
"wb_metric_type": "datasource_status",
"ds_name": datasource,
"ds_state": dsinfo["state"],
"ds_enabled": dsinfo["enabled"],
Expand Down Expand Up @@ -212,8 +208,8 @@ func (bt *Weblogicbeat) ApplicationStatusEvent() {
application_status_event := beat.Event{
Timestamp: time.Now(),
Fields: common.MapStr{
"server": bt.config.ServerName,
"metric_type": "application_status",
"wb_server": bt.config.ServerName,
"wb_metric_type": "application_status",
"app_name": application,
"app_componentName": comp["componentName"],
"app_state": comp["status"],
Expand All @@ -229,6 +225,41 @@ func (bt *Weblogicbeat) ApplicationStatusEvent() {
}
}

func (bt *Weblogicbeat) ThreadStatusEvent() {
resp_thread_status, err_thread_status := resty.R().
SetHeader("Accept", "application/json").
SetHeader("X-Requested-By", "weblogicbeat").
SetBasicAuth(bt.config.Username, bt.config.Password).
Get(bt.config.Host + "/management/weblogic/latest/domainRuntime/serverRuntimes/" + bt.config.ServerName + "/threadPoolRuntime?links=none&fields=overloadRejectedRequestsCount,pendingUserRequestCount,executeThreadTotalCount,healthState,stuckThreadCount,throughput,hoggingThreadCount")

if err_thread_status != nil {
bt.SendErrorEvent(bt.config.ServerName, "thread_status", fmt.Sprintf("%v", err_thread_status))
return
}

json_thread_status, _ := gabs.ParseJSON([]byte(resp_thread_status.String()))
threads := json_thread_status.Data().(map[string]interface{})
thread_health := threads["healthState"].(map[string]interface{})

thread_status_event := beat.Event{
Timestamp: time.Now(),
Fields: common.MapStr{
"wb_server": bt.config.ServerName,
"wb_metric_type": "thread_status",
"th_overloadRejectedRequestsCount": threads["overloadRejectedRequestsCount"],
"th_pendingUserRequestCount": threads["pendingUserRequestCount"],
"th_executeThreadTotalCount": threads["executeThreadTotalCount"],
"th_stuckThreadCount": threads["stuckThreadCount"],
"th_throughput": threads["throughput"],
"th_hoggingThreadCount": threads["hoggingThreadCount"].(float64),
"th_state": thread_health["state"],
"th_symptoms": fmt.Sprintf("%v", thread_health["symptoms"]),
},
}
bt.client.Publish(thread_status_event)
logp.Info("Server status - event sent")
}

func (bt *Weblogicbeat) SendErrorEvent(serverName string, metricType string, err string) {
error_event := beat.Event{
Timestamp: time.Now(),
Expand Down
Binary file modified docs/1723957.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/kibana-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 43053ec

Please sign in to comment.