X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-monitor;h=40ad64b303c8412828e4425b388d83f0cf625637;hb=d65349ea28bb67a0062a9b4b60ff97538206373b;hp=4e09861238cb42e5da73214311dad17cf557f32b;hpb=064af42167bf4fc9aaea2702d80ce08074b889c0;p=openvswitch diff --git a/utilities/ovs-monitor b/utilities/ovs-monitor index 4e098612..40ad64b3 100755 --- a/utilities/ovs-monitor +++ b/utilities/ovs-monitor @@ -2,23 +2,22 @@ # Copyright (C) 2008, 2009 Nicira Networks, Inc. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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: # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# http://www.apache.org/licenses/LICENSE-2.0 # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# 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. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -SECCHAN_PID=/var/run/secchan.pid -SECCHAN_SOCK=/var/run/secchan.mgmt +OPENFLOWD_PID=/var/run/ovs-openflowd.pid +OPENFLOWD_SOCK=/var/run/ovs-openflowd.mgmt LOG_FILE=/var/log/openflow/monitor INTERVAL=1 FAIL_THRESH=3 @@ -28,8 +27,8 @@ usage() { echo echo "OPTIONS:" echo " -h Show this message" - echo " -p PID file for secchan (default: $SECCHAN_PID)" - echo " -s Unix socket for secchan (default: $SECCHAN_SOCK)" + echo " -p PID file for ovs-openflowd (default: $OPENFLOWD_PID)" + echo " -s Unix socket for ovs-openflowd (default: $OPENFLOWD_SOCK)" echo " -l File to log messages (default: $LOG_FILE)" echo " -i Interval to send probes in seconds (default: $INTERVAL)" echo " -c Number of failed probes before reboot (default: $FAIL_THRESH)" @@ -49,11 +48,11 @@ while getopts "hp:s:l:i:c:" OPTION; do ;; p) - SECCHAN_PID=$OPTARG + OPENFLOWD_PID=$OPTARG ;; s) - SECCHAN_SOCK=$OPTARG + OPENFLOWD_SOCK=$OPTARG ;; l) @@ -74,14 +73,14 @@ while getopts "hp:s:l:i:c:" OPTION; do done -if [ ! -f $SECCHAN_PID ]; then - log "No secchan pid file: ${SECCHAN_PID}" - echo "No secchan pid file: ${SECCHAN_PID}" +if [ ! -f $OPENFLOWD_PID ]; then + log "No ovs-openflowd pid file: ${OPENFLOWD_PID}" + echo "No ovs-openflowd pid file: ${OPENFLOWD_PID}" fi -if [ ! -S $SECCHAN_SOCK ]; then - log "No secchan sock file: ${SECCHAN_SOCK}" - echo "No secchan sock file: ${SECCHAN_SOCK}" +if [ ! -S $OPENFLOWD_SOCK ]; then + log "No ovs-openflowd sock file: ${OPENFLOWD_SOCK}" + echo "No ovs-openflowd sock file: ${OPENFLOWD_SOCK}" fi if [ ! -d `dirname $LOG_FILE` ]; then @@ -89,17 +88,17 @@ if [ ! -d `dirname $LOG_FILE` ]; then fi let DP_DOWN=0 -let SECCHAN_DOWN=0 +let OPENFLOWD_DOWN=0 log "===== Starting Monitor ====" while `/bin/true`; do - # Only check for liveness if the secchan's PID file exists. The PID - # file is removed when secchan is brought down gracefully. - if [ -f $SECCHAN_PID ]; then - pid=`cat $SECCHAN_PID` + # Only check for liveness if ovs-openflowd's PID file exists. The PID + # file is removed when ovs-openflowd is brought down gracefully. + if [ -f $OPENFLOWD_PID ]; then + pid=`cat $OPENFLOWD_PID` if [ -d /proc/$pid ]; then - # Check if the secchan and datapath still can communicate - if [ -S $SECCHAN_SOCK ]; then - ovs-ofctl probe -t 2 unix:$SECCHAN_SOCK + # Check if the ovs-openflowd and datapath still can communicate + if [ -S $OPENFLOWD_SOCK ]; then + ovs-ofctl probe -t 2 unix:$OPENFLOWD_SOCK if [ $? -ne 0 ]; then log "datapath probe failed" let DP_DOWN++ @@ -107,15 +106,15 @@ while `/bin/true`; do let DP_DOWN=0 fi fi - let SECCHAN_DOWN=0 + let OPENFLOWD_DOWN=0 else - log "secchan probe failed" - let SECCHAN_DOWN++ + log "ovs-openflowd probe failed" + let OPENFLOWD_DOWN++ fi fi - if [ $SECCHAN_DOWN -ge $FAIL_THRESH ]; then - log "Failed to probe secchan after ${SECCHAN_DOWN} tries...rebooting!" + if [ $OPENFLOWD_DOWN -ge $FAIL_THRESH ]; then + log "Failed to probe ovs-openflowd after ${OPENFLOWD_DOWN} tries...rebooting!" reboot fi