From c1a19aa347fb8a68840043e86d80f7124e638f87 Mon Sep 17 00:00:00 2001 From: Bryan Sullivan Date: Mon, 27 Nov 2017 21:23:13 -0800 Subject: Add loglevel as env variable JIRA: VES-2 Change-Id: I909da7f9bc62ba33e5e33bb90d153ec9a425acb8 Signed-off-by: Bryan Sullivan --- build/ves-agent/start.sh | 9 ++++++++- build/ves-collector/start.sh | 16 ++++++++++++---- tools/demo_deploy.sh | 3 +++ tools/ves-setup.sh | 44 ++++++++++++++++++++++++++++---------------- 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/build/ves-agent/start.sh b/build/ves-agent/start.sh index 0476316..fce0c74 100644 --- a/build/ves-agent/start.sh +++ b/build/ves-agent/start.sh @@ -38,7 +38,14 @@ EOF cat ves_app_config.conf echo "ves_mode=$ves_mode" -python ves_app.py --events-schema=$ves_mode.yaml --loglevel DEBUG \ + +if [[ "$ves_loglevel" == "" ]]; then + ves_loglevel=ERROR +fi + +python ves_app.py --events-schema=$ves_mode.yaml --loglevel $ves_loglevel \ --config=ves_app_config.conf + +# Dump ves_app.log if the command above exits (fails) echo "*** ves_app.log ***" cat ves_app.log diff --git a/build/ves-collector/start.sh b/build/ves-collector/start.sh index 1c41778..be30c9a 100644 --- a/build/ves-collector/start.sh +++ b/build/ves-collector/start.sh @@ -34,7 +34,15 @@ sed -i -- "s~vel_topic_name = example_vnf~vel_topic_name = $ves_topic~g" \ sed -i -- "/vel_topic_name = /a influxdb = $ves_influxdb_host" \ evel-test-collector/config/collector.conf -python /opt/ves/evel-test-collector/code/collector/monitor.py \ - --config /opt/ves/evel-test-collector/config/collector.conf \ - --influxdb $ves_influxdb_host \ - --section default > /opt/ves/monitor.log 2>&1 +if [[ "$ves_loglevel" != "" ]]; then + python /opt/ves/evel-test-collector/code/collector/monitor.py \ + --config /opt/ves/evel-test-collector/config/collector.conf \ + --influxdb $ves_influxdb_host \ + --section default > /opt/ves/monitor.log 2>&1 +else + python /opt/ves/evel-test-collector/code/collector/monitor.py \ + --config /opt/ves/evel-test-collector/config/collector.conf \ + --influxdb $ves_influxdb_host \ + --section default +fi + diff --git a/tools/demo_deploy.sh b/tools/demo_deploy.sh index d8f6be0..433dafd 100644 --- a/tools/demo_deploy.sh +++ b/tools/demo_deploy.sh @@ -39,6 +39,7 @@ #. ves_influxdb_auth: authentication for the influxdb service #. ves_grafana_host: ip:port of the grafana service #. ves_grafana_auth: authentication for the grafana service +#. ves_loglevel: loglevel for VES Agent and Collector (ERROR|DEBUG) #. #. For deployment in a kubernetes cluster as setup by OPNFV Models scripts: #. - k8s cluster setup as in OPNFV Models repo tools/kubernetes/demo_deploy.sh @@ -88,6 +89,8 @@ ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ export ves_grafana_host ves_grafana_auth=$ves_grafana_auth export ves_grafana_auth + ves_loglevel=$ves_loglevel + export ves_loglevel env | grep ves bash /tmp/ves/tools/ves-setup.sh collector bash /tmp/ves/tools/ves-setup.sh kafka diff --git a/tools/ves-setup.sh b/tools/ves-setup.sh index 027b440..a39ce6c 100644 --- a/tools/ves-setup.sh +++ b/tools/ves-setup.sh @@ -50,6 +50,8 @@ #. ves_influxdb_auth: credentials in form "user/pass" (default: none) #. ves_grafana_host: grafana host:port (default: none) #. ves_grafana_auth: credentials in form "user/pass" (default: admin/admin) +#. ves_loglevel: loglevel for VES Agent and Collector (ERROR|DEBUG) +#. ves_cloudtype: kubernetes|openstack (default:kubernetes) #. #. Usage: #. git clone https://gerrit.opnfv.org/gerrit/ves /tmp/ves @@ -118,6 +120,8 @@ ves_influxdb_host="${ves_influxdb_host:=localhost:8086}" ves_influxdb_auth="${ves_influxdb_auth:=}" ves_grafana_host="${ves_grafana_host:=localhost:3000}" ves_grafana_auth="${ves_grafana_auth:=admin:admin}" +ves_loglevel="${ves_loglevel:=}" +ves_cloudtype="${ves_cloudtype:=kubernetes}" export ves_mode export ves_host export ves_port @@ -134,6 +138,8 @@ export ves_influxdb_host export ves_influxdb_auth export ves_grafana_host export ves_grafana_auth +export ves_loglevel +export ves_cloudtype EOF source /tmp/ves/ves_env.sh @@ -229,11 +235,6 @@ function setup_collectd() { sudo apt-get install -y libxml2-dev libpciaccess-dev libyajl-dev \ libdevmapper-dev - log "start libvirtd" - # TODO: install libvirt from source to enable all features per - # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/feature.userguide.html#virt-plugin - sudo systemctl start libvirtd - # # TODO: fix for journalctl -xe report "... is marked executable" # sudo chmod 744 /etc/systemd/system/collectd.service @@ -253,16 +254,6 @@ LoadPlugin csv StoreRates false -# TODO: complete the virt plugin install before enabling -#LoadPlugin virt -# -# Connection "qemu:///system" -# RefreshInterval 60 -# HostnameFormat uuid -# PluginInstanceFormat name -# ExtraStats "cpu_util" -# - LoadPlugin target_set LoadPlugin match_regex @@ -298,6 +289,24 @@ LoadPlugin write_kafka EOF + + if [[ "$ves_cloudtype" == "openstack" ]]; then + log "start libvirtd" + # TODO: install libvirt from source to enable all features per + # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/feature.userguide.html#virt-plugin + # sudo systemctl start libvirtd + + cat < + Connection "qemu:///system" + RefreshInterval 60 + HostnameFormat uuid + PluginInstanceFormat name + ExtraStats "cpu_util" + +EOF + fi else cat <