Skip to content
Snippets Groups Projects
Commit cb8c8a24 authored by MJB's avatar MJB
Browse files

deployment of clmcservice and aggregator

parent 6ae1daf4
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,7 @@ Vagrant.configure("2") do |config|
when 'test-runner'
instance_config.vm.provision :shell, :path => "clmctest/services/pytest/install.sh"
when 'clmc-service'
instance_config.vm.provision :shell, :path => "scripts/clmc-service/install.sh"
instance_config.vm.provision :shell, :path => "scripts/clmc-service/install.sh", :args => "#{host["influxdb_url"]} #{host["database_name"]} #{host["report_period"]}"
else
# specific service install
instance_config.vm.provision :shell, :path => "clmctest/services/#{host["service_name"]}/install.sh", env: {"REPO_ROOT" => "/vagrant"}
......
#!/usr/bin/python3
"""
## © University of Southampton IT Innovation Centre, 2018
## Copyright University of Southampton IT Innovation Centre, 2018
##
## Copyright in this software belongs to University of Southampton
## IT Innovation Centre of Gamma House, Enterprise Road,
......@@ -37,8 +37,8 @@ class Simulator(object):
Simulator used to generate E2E measurements.
"""
DATABASE = 'E2EMetrics' # default database name
DATABASE_URL = 'http://203.0.113.100:8086' # default database url
DATABASE = 'CLMCMetrics' # default database name
DATABASE_URL = 'http://172.40.231.51:8086' # default database url
TICK = 1 # a simulation tick represents 1s
SIMULATION_LENGTH = 120 # simulation time in seconds
......
......@@ -34,6 +34,9 @@ hosts:
- guest: 9080
host: 9080
ip_address: "172.40.231.51"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
report_period: 25
- name: ipendpoint1
cpus: 1
memory: 2048
......
......@@ -27,6 +27,20 @@
# Force fail on command fail (off for now as virtualenvwrapper install fails)
# set -euo pipefail
echo "Configuring CLMC service"
# Get command line parameters
if [ "$#" -ne 3 ]; then
echo "Error: illegal number of arguments: "$#
echo "Usage: install.sh INFLUX_URL DATABASE_NAME REPORT_PERIOD"
exit 1
fi
INFLUX_URL=$1
DATABASE_NAME=$2
REPORT_PERIOD=$3
# Define tickstack software versions
INFLUX_VERSION=1.5.2
INFLUX_CHECKSUM=42fede7b497bdf30d4eb5138db218d1add986fca4fce4a8bcd9c7d6dabaf572a
......@@ -121,7 +135,7 @@ fi
# navigate to the clmc-webservice - and check
echo "----> Moving to CLMC webservice"
cd /vagrant/src/clmc-webservice
cd /vagrant/src/clmcwebservice
if [ $? -ne 0 ] ; then
echo "Failed: could not find clmc-webservice"
exit 1
......@@ -129,7 +143,7 @@ fi
# install the service
echo "----> Installing CLMC web service"
pip3 install .
pip3 install .
if [ $? -ne 0 ] ; then
echo "Failed: installing clmc-webservice"
exit 1
......@@ -143,4 +157,17 @@ if [ $? -ne 0 ] ; then
exit 1
else
echo "CLMC service started."
fi
\ No newline at end of file
fi
while ! nc -z localhost 9080
do
echo "Waiting for clmc service port 9080 to be ready on localhost..."
sleep 5
done
JSON="{\"aggregator_report_period\": ${REPORT_PERIOD}, \"aggregator_database_name\": \"${DATABASE_NAME}\", \"aggregator_database_url\": \"${INFLUX_URL}\"}"
curl -H 'Content-Type: application/json' -X PUT -d "${JSON}" http://localhost:9080/aggregator/config
JSON="{\"action\": \"start\"}"
curl -H 'Content-Type: application/json' -X PUT -d "${JSON}" http://localhost:9080/aggregator/control
......@@ -51,6 +51,7 @@ class Aggregator(object):
"""
# initialise a database client using the database url and the database name
print("Creating InfluxDB Connection")
url_object = urlparse(database_url)
while True:
try:
......@@ -82,6 +83,8 @@ class Aggregator(object):
Performs the functionality of the aggregator - query data from both measurements merge that data and post it back in influx every 5 seconds.
"""
print("Running aggregator")
current_time = int(time())
while not self._stop_flag.is_set():
......@@ -94,12 +97,16 @@ class Aggregator(object):
network_delays = {}
while True:
try:
print("Query for network delays")
result = self.db_client.query(
'SELECT mean(latency) as "net_latency", mean(bandwidth) as "net_bandwidth" FROM "E2EMetrics"."autogen"."network_delays" WHERE time >= {0} and time < {1} GROUP BY path, source, target'.format(
'SELECT mean(latency) as "net_latency", mean(bandwidth) as "net_bandwidth" FROM "{0}"."autogen"."network_delays" WHERE time >= {1} and time < {2} GROUP BY path, source, target'.format(self.db_name,
boundary_time_nano, current_time_nano))
break
except:
except Exception as e:
print("Exception getting network delay")
print(e)
sleep(self.RETRY_PERIOD)
for item in result.items():
......@@ -116,11 +123,14 @@ class Aggregator(object):
while True:
try:
print("Query for service delays")
result = self.db_client.query(
'SELECT mean(response_time) as "response_time", mean(request_size) as "request_size", mean(response_size) as "response_size" FROM "E2EMetrics"."autogen"."service_delays" WHERE time >= {0} and time < {1} GROUP BY endpoint, sf_instance, sfr'.format(
'SELECT mean(response_time) as "response_time", mean(request_size) as "request_size", mean(response_size) as "response_size" FROM "{0}"."autogen"."service_delays" WHERE time >= {1} and time < {2} GROUP BY endpoint, sf_instance, sfr'.format(self.db_name,
boundary_time_nano, current_time_nano))
break
except:
except Exception as e:
print("Exception getting service delay")
print(e)
sleep(self.RETRY_PERIOD)
for item in result.items():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment