bdb0615dc6fdc6df6fbaebcd86c97d1ba8a19d4b
[barometer.git] / src / collectd / ovs_pmd_stats_config.sh
1 #!/bin/bash
2 # Copyright 2017 OPNFV
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 export CURRENT_DIR=$(pwd)
17
18 SERVICE="openvswitch"
19 RESULT=`ps -aux | grep $SERVICE | grep -v grep`
20 OVS_PMD_STAT_SCRIPT=$CURRENT_DIR/../../3rd_party/ovs_pmd_stats/ovs_pmd_stats.py
21 PATH_LOCAL=/usr/local/src/
22
23 if [ "${RESULT:-null}" != null ]; then
24   echo "Openvswitch service is running."
25   sudo ovs-vsctl set-manager ptcp:6640
26   cp $OVS_PMD_STAT_SCRIPT $PATH_LOCAL
27 else
28   echo "Openvswitch service is not running. Please start before running ovs plugins"
29 fi
30 # Always copy python ovs module when building Docker image
31 if [ -z ${DOCKER+x} ]; then
32   cp $OVS_PMD_STAT_SCRIPT $PATH_LOCAL
33 fi