Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OECC demo #3

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions examples/OECC/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# OpenEdge Command Center #

edselg marked this conversation as resolved.
Show resolved Hide resolved
### Requirements
* Ubuntu Linux 22.04
* OpenEdge media:
* PROGRESS_OE_12.8.3_LNX_64.tar.gz
* PROGRESS_OECC_SERVER_1.3.0_LNX_64.tar.gz
edselg marked this conversation as resolved.
Show resolved Hide resolved
* PROGRESS_OECC_AGENT_1.3.0_LNX_64.bin
* Reponse file for OpenEdge installation:
* response_12.8.3.ini
* Products:
* OE Adv. Ent. RDBMS
* 4GL Development System
* Progress ProdAS for OE

**Notes:**
* You can use the OpenEdge-Samples/examples/OECC/files/response_12.8.3.ini file as a template and specify the control codes in the file.

### Components
* Ubuntu Virtual Machine
* OpenEdge Database
edselg marked this conversation as resolved.
Show resolved Hide resolved
* PAS for OpenEdge
* OpenEdge Command Center agent
* Docker
edselg marked this conversation as resolved.
Show resolved Hide resolved
* OpenEdge Command Center server
* MongoDB
* Prometheus
* Grafana

![Components](./diagram.png)

### Steps
1. Create /files directory used for the installation files.
edselg marked this conversation as resolved.
Show resolved Hide resolved
~~~
sudo mkdir -p /files
sudo chown $USER /files
~~~

2. Copy the OpenEdge media files and the response file to /files.

3. Clone the OpenEdge-Samples repo:
edselg marked this conversation as resolved.
Show resolved Hide resolved
~~~
cd
git clone https://github.com/progress/OpenEdge-Samples.git
~~~

4. Run 'setup.sh' from the OECC directory. Script uses "sudo" to perform administrator tasks.
~~~
cd ~/OpenEdge-Samples/examples/OECC
./setup.sh
~~~

5. Test the configuration.
~~~
./test.sh
~~~

6. Access OpenEdge Command Center via a web browser:
* http://<host-machine>:8000
* Use admin/admin to login

7. Access the PAS for OpenEdge instance via a web browser:
* http://<host-machine>:8810
* http://<host-machine>:8810/web/customer.p

8. Access Prometheus via a web browser:
* http://<host-machine>:9090
* Use DB_ in the Expression field to query for metrics for the OpenEdge database
* Use PASOE_ in the Expression field to query for metrics for PAS for OpenEdge

6. Access Grafana via a web browser:
* http://<host-machine>:3000
* Use admin/admin to login

Notes:
* The setup script, adds /etc/rc.local to start the configuration on startup of the machine. You can also use "./start.sh" and "./stop.sh" to manually start and stop the configuration.

### Creating a Dasboard in Grafana
edselg marked this conversation as resolved.
Show resolved Hide resolved

**Steps**

1. Click on DATA SOURCES then on Prometheus to create a data source with the following values:
* Prometheus server URL: http://prometheus:9090
* Prometheus is a reference to a service in the docker-compose.yaml file and can be used as a hostname.
* Scroll down and click on Save & Test

2. Click on Home then on DASHBOARDS to create a dashboard.
3. Click on Add visualization to add a visualization for an OpenEdge database metric.
* Select Prometheus as the data source.
* Click on "Select metric" and click on Open.

![Selecting a Metric #1](./selecting_a_metric1.png)

* Search for "DB_" and select the BufferHits metric from the list.

![Selecting a Metric #2](./selecting_a_metric2.png)

* Click on Run queries.
* Click on Time series to change the visualization to use a Gauge.
* Change the Panel Title to "Buffer Hits"
* Scroll down and change the Unit in "Standard options" to Misc / Pecent (0-100).
* Scroll down and click on the Red dot for the Threshold to use Green.
* Click on the Green dot for Base to use Orange.
* Click on Apply.

![Visualization](./bufferhits_visualization.png)

4. Click on Add / Visualization (on toolbar) to add a visualization for a PASOE metric.
* Click on "Select metric" and click on Open.
* Search for "getrequests" and select the getRequests metric from the list.
* Click on Run queries.
* Change the Panel Title to "Get Requests".
* Click on Apply.
5. Click on the "Save dashboard" button (floppy disk icon on toolbar) to save the dashboard.

![Dashboard](./openedge_dashboard.png)

Notes:
* Examples of Grafana dashboards can be found at https://grafana.com/grafana/dashboards/
Binary file added examples/OECC/bufferhits_visualization.png
edselg marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/OECC/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions examples/OECC/diagram.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title Using OpenTelemetry in OpenEdge

participantgroup Virtual Machine
participant Sports2020#lightblue
participant oepas1#lightblue
participant "OECC Agent" as OECCAgent#lightgreen
end
participantgroup Docker
participant "OpenTelemetry Collector" as Collector#lightgreen
participant Prometheus#lightblue
participant Grafana#orange
end
actor User

Sports2020<-OECCAgent: ""
oepas1<-OECCAgent: ""
OECCAgent->Collector: ""
note over OECCAgent#yellow:Agent post metrics to collector
Prometheus->Collector: ""
Grafana->Prometheus: ""
User->Grafana: ""
29 changes: 29 additions & 0 deletions examples/OECC/docker/collector-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
receivers:
otlp:
protocols:
grpc:
http:
cors:
allowed_origins:
- http://*
- https://*

exporters:
logging:
logLevel: debug
prometheus:
endpoint: "0.0.0.0:9464"

processors:
batch:

service:
telemetry:
logs:
level: "debug"
pipelines:
metrics:
receivers: [otlp]
exporters: [logging, prometheus]
processors: [batch]

61 changes: 61 additions & 0 deletions examples/OECC/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
volumes:
mongodb-data:
oecc-data:
prometheus-data:
grafana-data:

services:
# MongoDB
mongodb:
restart: always
image: mongo:4.4-rc-focal
ports:
- 27017:27017
volumes:
- mongodb-data:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin

# OpenEdge Command Center Server
oecc:
restart: always
image: oecc
build: ./oecc
ports:
- 8000:8000
volumes:
- oecc-data:/oecc/data
depends_on:
- "mongodb"

# Collector
collector:
restart: always
image: otel/opentelemetry-collector-contrib:0.53.0
command: ["--config=/conf/collector-config.yaml"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
- "9464:9464"
- "4317:4317"
- "4318:4318"

# Prometheus
prometheus:
restart: always
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
ports:
- "9090:9090"

# Grafana
grafana:
restart: always
image: grafana/grafana:latest
ports:
- 3000:3000
volumes:
- grafana-data:/var/lib/grafana
14 changes: 14 additions & 0 deletions examples/OECC/docker/oecc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:focal
# FROM centos:7

RUN mkdir -p /usr/oecc /oecc/data/conf
ADD ./PROGRESS_OECC_SERVER_1.3.0_LNX_64.tar.gz /usr/oecc
COPY ./start.sh /usr/oecc
COPY db-config.json firstuser-config.json /oecc/data/conf/
COPY server-config.json /usr/oecc/conf/
RUN cp /usr/oecc/orig/system-config.json.orig /oecc/data/conf/system-config.json
RUN chmod +x /usr/oecc/oeccserver
RUN chmod +x /usr/oecc/start.sh

CMD [ "/usr/oecc/start.sh" ]

15 changes: 15 additions & 0 deletions examples/OECC/docker/oecc/db-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"dbHostNameAndPort": "mongodb:27017",
"srvRecord": false,
"connectOptions": {
"autoIndex": true,
"connectTimeoutMS": 10000,
"socketTimeoutMS": 45000,
"auth": {
"user": "admin",
"password": "admin"
},
"authSource": "admin"
},
"tls": false
}
8 changes: 8 additions & 0 deletions examples/OECC/docker/oecc/firstuser-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"firstName": "admin",
"lastName": "admin",
"userName": "admin",
"email": "EMAIL_ADDRESS",
"password": "admin",
"description": ""
}
13 changes: 13 additions & 0 deletions examples/OECC/docker/oecc/server-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"_comment": "Provide complete path for key and certificate files if 'isServerSecured' is set to true",
"nodeId": "",
"hostName": "",
"port": 8000,
"dataDir": "/oecc/data",
"security": {
"isServerSecured": false,
"key": "",
"certificate": "",
"intermediateCerts": []
}
}
15 changes: 15 additions & 0 deletions examples/OECC/docker/oecc/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cd /usr/oecc

trap 'exit 0' SIGTERM

export PATH=/usr/oecc/node/bin:$PATH
export NODE_PATH=/usr/oecc/console/node_modules
export NODE_ENV=production
exec node ./console/dist/server.js

# ./oeccserver start
# sleep 30
# ls -l
# tail --pid=`cat ./oeccserver.pid` -f `ls -ltr | awk '{ print $9 }' | tail -1`
10 changes: 10 additions & 0 deletions examples/OECC/docker/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
global:
scrape_interval: 30s # Default is every 1 minute.

scrape_configs:
- job_name: 'collector'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['collector:9464']

33 changes: 33 additions & 0 deletions examples/OECC/files/customer.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
USING Progress.Json.ObjectModel.JsonObject.

CREATE WIDGET-POOL.

{src/web2/wrap-cgi.i}

DEFINE TEMP-TABLE ttCustomer LIKE Customer.
DEFINE DATASET dsCustomer FOR ttCustomer.

RUN process-web-request.

PROCEDURE outputHeader :
output-content-type ("application/json":U).
END PROCEDURE.

PROCEDURE process-web-request :
DEFINE VARIABLE oJsonObject AS Progress.Json.ObjectModel.JsonObject NO-UNDO.
DEFINE VARIABLE lChar AS LONGCHAR NO-UNDO.
RUN outputHeader.

EMPTY TEMP-TABLE ttCustomer.
FOR EACH Customer WHERE Customer.CustNum < 3110 NO-LOCK:
CREATE ttCustomer.
BUFFER-COPY Customer TO ttCustomer.
END.

oJsonObject = NEW JsonObject().
oJsonObject:READ(DATASET dsCustomer:HANDLE).

lChar = oJsonObject:GetJsonText().
{&OUT-LONG} lChar.

END PROCEDURE.
Loading