Add script for running just monitoring services in containers

This commit is contained in:
Andrew Guibert 2019-09-11 11:59:37 -05:00
parent fd0deadb4d
commit 3d4eed8f52
3 changed files with 100 additions and 0 deletions

View File

@ -16,6 +16,12 @@ Builds all microservice applications and deploys them to locally running liberty
Any code changes that are made in an eclipse environment with auto-build enabled will automatically publish content to the loose application, meaning no server restarts should be required between code changes.
To start the monitoring services, you must have Docker installed. They can be started with:
```
./startMonitoring.sh
```
To stop all liberty servers, issue the command:
```

View File

@ -0,0 +1,50 @@
# config file version
apiVersion: 1
# list of datasources that should be deleted from the database
deleteDatasources:
- name: Prometheus
orgId: 1
# list of datasources to insert/update depending
# whats available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: direct
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://localhost:9090
# <string> database password, if used
password:
# <string> database user, if used
user:
# <string> database name, if used
database:
# <bool> enable/disable basic auth
basicAuth: false
# <string> basic auth username
basicAuthUser: admin
# <string> basic auth password
basicAuthPassword: admin
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault: true
# <map> fields that will be converted to json and stored in json_data
jsonData:
graphiteVersion: "1.1"
tlsAuth: false
tlsAuthWithCACert: false
# <string> json object of data that will be encrypted.
secureJsonData:
tlsCACert: "..."
tlsClientCert: "..."
tlsClientKey: "..."
version: 1
# <bool> allow users to edit datasources from the UI.
editable: true

44
startMonitoring.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
LOCAL_HOST=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
echo "This hostname is: $LOCAL_HOST"
PROM_LOCAL_CONFIG=`pwd`/build/monitoring/prometheus-local
mkdir -p $PROM_LOCAL_CONFIG
rm $PROM_LOCAL_CONFIG/prometheus.yml 2> /dev/null
echo "Building local config file prometheus config at: $PROM_LOCAL_CONFIG"
sed \
-e "s/'game:/'$LOCAL_HOST:/g" \
-e "s/'player:/'$LOCAL_HOST:/g" \
-e "s/'auth:/'$LOCAL_HOST:/g" \
-e "s/'frontend:/'$LOCAL_HOST:/g" \
monitoring/prometheus/prometheus.yml > \
$PROM_LOCAL_CONFIG/prometheus.yml
echo "Starting prometheus"
docker stop lb-prometheus 2> /dev/null
docker run \
--name lb-prometheus \
--rm \
-d \
-p 9090:9090 \
-v $PROM_LOCAL_CONFIG:/etc/prometheus \
prom/prometheus:v2.4.0
echo "Starting grafana"
docker stop lb-grafana 2> /dev/null
docker run \
--name lb-grafana \
--rm \
-d \
-p 3000:3000 \
-e GF_INSTALL_PLUGINS=flant-statusmap-panel \
-v `pwd`/monitoring/datasource-local:/etc/grafana/provisioning/datasources \
-v `pwd`/monitoring/dashboardList:/etc/grafana/provisioning/dashboards \
-v `pwd`/monitoring/grafanaDashboardConfig:/var/lib/grafana/dashboards \
grafana/grafana:5.2.4
echo "########################################################"
echo "Metrics dashboard available at http://localhost:3000"
echo "Log in with user=admin password=admin"
echo "########################################################"