Sign inSign up

groundworkdevelopment/groundwork

By groundworkdevelopment

Updated 3 days ago

Groundwork API server

Image
0

10K+

groundworkdevelopment/groundwork repository overview

Groundwork Monitor Server - Version 8

The Groundwork Monitor Server Version 8 is a microcontainer port of the previous Groundwork 7 JBoss solution. With this new microcontainer deployment, we are streamlining the GMS with the goal of a true microservice solution. We have removed JOSSO and JBoss. The new project is now housed here in GitHub. Thanks to valiant efforts from Randy, we kept all version history from subversion, forked from:

http://geneva/groundwork-professional/branches/MONITOR-PLATFORM-FORK-8.0.0/monitor-platform/enterprise-foundation 7/7/2018 using git svn.

To get started, follow the instructions below ...

Getting Started

  1. Install:

    • Java 8
    • Postgres
    • Maven (mvnvm)
    • Influx DB
  2. Check it out

    https://github.com/gwos/groundwork.git 
    
  3. Build it

    cd groundwork
    mvn clean install
    

Postgres Database

Install Postgres - recommend version 9.6.9 or higher
See instructions add bottom for One Time Postgres Setup

To tear down and repopulate production database:

cd collage/database
mvn -P production -DskipTests=false test

To tear down and repopulate test database:

cd collage/database
mvn -P test -DskipTests=false test

Environment Variables

GROUNDWORK_CONFIG - directory holding Groundwork configuration property files

Recommended Dev value: src/main/config

GROUNDWORK_OUT where perfData is written by the RRDPerfDataWriter. Will also be used for other output as required.

Recommended Dev value: /tmp

MAVEN_OPTS - maven runtime configuration

Recommended Dev value: "-server -Xmx512m -Djava.net.preferIPv4Stack=true"

Developers should set these variables as an environment variables, or pass them into java as command line

SERVER_PORT - the server port number, default 8080

SERVER_ADDRESS - the server address, default localhost

GWOS_DB_URL - the Postgres database URL

GWOS_DB_USERNAME - the Postgres database username

GWOS_DB_PASSWORD - the Postgres database password

GWOS_INFLUX_URL - the InfluxDB database URL

Influx DB

Install InfluxDB for Linux:

> wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.0.x86_64.rpm
> sudo dnf install influxdb-1.6.0.x86_64.rpm
> sudo systemctl enable influxdb.service
> sudo systemctl start influxdb.service
> sudo systemctl status influxdb.service

Install on Mac:

brew update
brew install influxdb

# To have launchd start influxdb now and restart at login:
brew services start influxdb

# Or, if you don't want/need a background service you can just run:
influxd -config /usr/local/etc/influxdb.conf

Install on Windows:

https://dl.influxdata.com/influxdb/releases/influxdb-1.6.0_windows_amd64.zip
unzip influxdb-1.6.0_windows_amd64.zip
# TODO: how to start as service, maybe better to run in docker

GW8 dev setup, (retains data for 1 week):

> influx
Connected to http://localhost:8086 version 1.6.0
InfluxDB shell version: 1.6.0
> create database groundwork
> create retention policy groundwork_dev on groundwork duration 1w replication 1 default
> show databases
name: databases
name
----
_internal
groundwork
> quit

Query GW8 time series data, (measurement === service description):

> influx
Connected to http://localhost:8086 version 1.6.0
InfluxDB shell version: 1.6.0
> use groundwork
Using database groundwork
> show measurements
name: measurements
name
----
local_load
local_memory
> select * from local_load
name: local_load
time                Linux Servers Load Load_cr Load_wn hostname
----                ------------- ---- ------- ------- --------
1532708415000000000 true          5.5  10      5       localhost
1532708417000000000 true          7.6  10      5       localhost
1532708418000000000 true          4    10      5       localhost
1532708475000000000 true          6.3  10      5       localhost
1532708478000000000 true          0.1  10      5       localhost
1532708480000000000 true          5.7  10      5       localhost
> quit

RRDTool

Install RRD for Linux:

> sudo dnf install rrdtool

OpenTSDB, (HBase)

HBase

https://hbase.apache.org/book.html#quickstart

Download Mirror: https://www.apache.org/dyn/closer.lua/hbase/ Download: stable -> hbase-1.2.6.1-bin.tar.gz

Install HBase for Linux:

> tar xzvf hbase-1.2.6.1-bin.tar.gz
> sed -i -e '/^<configuration>/a\
  <property>\
    <name>hbase.rootdir</name>\
    <value>file://'"${PWD}"'/hbase-data</value>\
  </property>\
  <property>\
    <name>hbase.zookeeper.property.dataDir</name>\
    <value>'"${PWD}"'/zookeeper-data</value>\
  </property>\
  <property>\
    <name>hbase.unsafe.stream.capability.enforce</name>\
    <value>false</value>\
  </property>' hbase-1.2.6.1/conf/hbase-site.xml

Start HBase:

hbase-1.2.6.1/bin/start-hbase.sh

Check Integrated Zookeeper:

> telnet localhost 2181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
stats

Stop HBase:

hbase-1.2.6.1/bin/stop-hbase.sh

OpenTSDB

http://opentsdb.net/docs/build/html/installation.html#id1

Download: https://github.com/OpenTSDB/opentsdb/releases/download/v2.3.1/opentsdb-2.3.1.tar.gz

Install OpenTSDB for Linux:

> tar -xvzf opentsdb-2.3.1.tar.gz
> cd opentsdb-2.3.1
> mkdir build
> cp -r third_party build
> build.sh
> export HBASE_HOME=${HOME}/installs/hbase/hbase-1.2.6.1
> env COMPRESSION=NONE src/create_table.sh
> mkdir cache
> cp src/opentsdb.conf .
> sed -i -e '/^tsd.network.port =/s/= *$/= 4242/' opentsdb.conf
> sed -i -e '/^tsd.http.staticroot =/s/= *$/= build\/staticroot/' opentsdb.conf
> sed -i -e '/^tsd.http.cachedir =/s/= *$/= cache/' opentsdb.conf
> sed -i -e '/^#tsd.core.auto_create_metrics =/s/^#//;s/false/true/' opentsdb.conf
> cat >> opentsdb.conf <<EOF

# --------- TEST CONFIGURATION ----------
# Whether or not to allow deleting data points from storage during query time,
# default is false
tsd.http.query.allow_delete = true

# Whether or not to enable incoming chunk support for the HTTP RPC, default is
# false.
tsd.http.request.enable_chunked = true

# The maximum request body size to support for incoming HTTP requests when
# chunking is enabled, default is 4096.
tsd.http.request.max_chunk = 1048576
EOF
> mkdir logs
> sed -i -e '/<file>/s/\/var\/log\/opentsdb/logs/' src/logback.xml

Start OpenTSDB, (stop using ^C):

> opentsdb-2.3.1/build/tsdb tsd

Unit Tests

cd collage
mvn test -DskipTests=false
cd collagefeeder
mvn test -DskipTests=false
cd collagenet
mvn test -DskipTests=false
cd collagerest/collagerest-common
mvn test -DskipTests=false
cd collagerest-server
mvn test -DskipTests=false
cd security/ldap-aggregator
mvn test -DskipTests=false

The Unit Tests do not have Code Coverage Reports

Occasionally, you may have to reset the test database if a test fails and the DB becomes out of sync. To do so, execute:

cd collage/database
mvn -P test -DskipTests=false test

TODO: these tests are disabled due to nagiostats script installation missing:

  • TestStatisticsService - testGetApplicationStatisticTotals
  • HostClientTest - testHostLookupFull
  • HostGroupClientTest - testHostGroupLookupDeep
  • ApplicationTypeClientTest - testLookupApplicationType

Integration Tests - Suite A

This is the older test suite. Test Suite A has better code coverage. The disadvantage is you need to reset the data with every run

# refresh production database
# make sure when you run this that gw-server or any other connections to postgres are down
cd collage/database
mvn -P production -DskipTests=false test
# startup groundwork server
cd gw-server
java -DGROUNDWORK_CONFIG=src/main/config -DGROUNDWORK_OUTPUT=/tmp -Djava.net.preferIPv4Stack=true -jar target/gw-server-8.0.0-SNAPSHOT.jar
# populate seed data and run suite A integration tests
cd collagerest/collagerest-client
mvn install -P integration-test -DskipTests=false 

Test Suite A is NOT hooked into Code Coverage Reports

TODO: these tests are disabled due to NoMa ActionProperty scripting having not been ported/packaged:

  • NotificationClientTest - all

Integration Tests - Suite B

Test Suite B has less tests than Suite A, its a work in progress One advantage to Suite B is that it does not require data setup process It attempts to remove all data at test suite startup

Test Suite B is hooked into Code Coverage Reports

# start up the server 
cd gw-server
java -DGROUNDWORK_CONFIG=src/main/config -DGROUNDWORK_OUTPUT=/tmp -Djava.net.preferIPv4Stack=true -jar target/gw-server-8.0.0-SNAPSHOT.jar

# run the integration tests in another shell
cd collagerest/collagerest-client     
mvn integration-test -P integration

TODO: these tests are disabled due to nagiostats script installation missing:

  • HostIt - testLookupDepthFullWithServices

Running

After building,

cd gw-server
java -DGROUNDWORK_CONFIG=src/main/config -DGROUNDWORK_OUTPUT=/tmp -Djava.net.preferIPv4Stack=true -jar target/gw-server-8.0.0-SNAPSHOT.jar

Run from IDE

  1. open GroundworkServerApp.java
  2. right click on file, choose Run or Debug

To run with remote debug from command line:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -DGROUNDWORK_CONFIG=src/main/config -DGROUNDWORK_OUTPUT=/tmp -Djava.net.preferIPv4Stack=true -jar target/gw-server-8.0.0-SNAPSHOT-shaded.jar

Postgres Database One Time Setup

This is a one time setup required after installing Postgres:

su - postgres
psql
postgres=# \password postgres
postgres=# create user collage with password 'gwrk';
postgres=# CREATE DATABASE gwcollagedb OWNER=collage;
postgres=# GRANT ALL PRIVILEGES ON DATABASE gwcollagedb to collage;

Edit pg_hba.conf may be required to allow incoming connections to databases:

 vi /var/lib/pgsql/data/pg_hba.conf
 (vi /usr/local/var/postgres/pg_hba.conf on mac)
local   all             all                                     md5
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

Restart Postgres (Linux):

systemctl restart postgresql.service

Restart Postgres (Mac):

brew services stop postgresql
brew services start postgresql

Client/API Passwords, (unencrypted/unhashed)

  • RESTAPIACCESS: nNPNxL8gxkCt4iiRaChU
  • RESTAPIACCESSREADER: EQ2Ki029ZNkNNu3NQRxE
  • REMOTEAPIACCESS: f8Wav6Crexgha6nS2C67
  • gdma: gdma
  • user: user, (portal proxy)

Tag summary

Content type

Image

Digest

sha256:7246e8056

Size

311.6 MB

Last updated

3 days ago

docker pull groundworkdevelopment/groundwork:9.1.0-GA