time (&rawtime);
timeinfo = localtime (&rawtime);
strftime(period,7,"%H:%M:",timeinfo);
- strftime(secs,2,"%S",timeinfo);
+ strftime(secs,3,"%S",timeinfo);
sec = atoi(secs);
if (sec == 0) sec = 59;
sprintf(secs, "%02d", sec);
if (fgets(count, 10, fp) != NULL) {
request_rate = atoi(count);
+ printf("Reporting request rate for second: %s as %d\n", period, request_rate);
measurement = evel_new_measurement(concurrent_sessions,
configured_entities, mean_request_latency, measurement_interval,
memory_configured, memory_used, request_rate);
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright 2016 AT&T Intellectual Property, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# What this is: Monitor and closed-loop policy agent as part of the OPNFV VES
+# vHello_VES demo.
+#
+# Status: this is a work in progress, under test.
+
+with open('/home/ubuntu/ves.log') as f:
+ while True:
+ line = f.readline()
+ if line:
+# print line,
+ if "requestRate" in line:
+# print line,
+ rate = line[27:-2]
+ print 'request rate: {0}'.format(rate)
+#....5....1....5....2....5....3....5
+# "requestRate": 2264,
+
cd /home/ubuntu
git clone https://github.com/att/evel-library.git
- echo "$0: Build agent demo"
+ echo "$0: Clone VES repo"
+ git clone https://gerrit.opnfv.org/gerrit/ves
+
+ echo "$0: Use vHello_VES blueprint version of agent_demo.c"
+ cp ves/tests/blueprints/tosca-vnfd-hello-ves/evel_demo.c evel-library/code/evel_demo/evel_demo.c
+
+ echo "$0: Update parameters and build agent demo"
sed -i -- "/api_secure,/{n;s/.*/ \"$username\",/}" evel-library/code/evel_demo/evel_demo.c
sed -i -- "/\"hello\",/{n;s/.*/ \"$password\",/}" evel-library/code/evel_demo/evel_demo.c
make
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/evel-library/libs/x86_64
- nohup ..output/x86_64/evel_demo --id $agent_id --fqdn $collector_ip --port 30000 --username $username --password $password &
+ nohup ../output/x86_64/evel_demo --id $agent_id --fqdn $collector_ip --port 30000 --username $username --password $password &
# echo "$0: Start agent demo, repeat every minute"
# crontab -l > /tmp/cron
</body></html>
EOM
+cp ~/ves/tests/blueprints/tosca-vnfd-hello-ves/favicon.ico ~/www/html/favicon.ico
+
echo "$0: Install docker"
# Per https://docs.docker.com/engine/installation/linux/ubuntulinux/
# Per https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
ssh -i /tmp/vHello.pem -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@$VDU2_IP << 'EOF'
sudo kill $(ps -ef | grep evel-test-collector | awk '{print $2}')
cd /home/ubuntu/
-python evel-test-collector/code/collector/collector.py \
+nohup python evel-test-collector/code/collector/collector.py \
--config evel-test-collector/config/collector.conf \
--section default \
- --verbose >~/ves.log
+ --verbose >~/ves.log &
EOF
}