Merge "Fix snmp trap (Coldstart, Warmstart, or other Fault Managment alarm traps) behaviour on IPv6 environments."

This commit is contained in:
Zuul 2021-09-20 20:44:49 +00:00 committed by Gerrit Code Review
commit 57249f526f
4 changed files with 68 additions and 3 deletions

View File

@ -15,8 +15,34 @@ if [ "$OPTIONDEBUG" != "" ]; then
esac
fi
# Waiting master agent initialization
if [ "$MASTER_AGENT_HOST" == "" ]; then
MASTER_AGENT_HOST="localhost";
fi
if [ "$MASTER_AGENT_PORT" == "" ]; then
MASTER_AGENT_PORT=705;
fi
if [ "$MASTER_AGENT_CONNECTION_RETRIES" == "" ]; then
MASTER_AGENT_CONNECTION_RETRIES=20;
fi
HOST=$MASTER_AGENT_HOST
PORT=$MASTER_AGENT_PORT
RETRIES=$MASTER_AGENT_CONNECTION_RETRIES
echo "Waiting master agent initialization ($HOST:$PORT) [MaxRetries:$RETRIES]"
counter=0
until </dev/tcp/$HOST/$PORT; do
sleep 1;
[[ counter -eq $RETRIES ]] && exit 1;
echo "Trying again, try #$counter";
$((counter++));
done
# Internal params
RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:localhost:705"
RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:${HOST}:$PORT"
# Launch
$RUN_CMD

View File

@ -15,8 +15,34 @@ if [ "$OPTIONDEBUG" != "" ]; then
esac
fi
# Waiting master agent initialization
if [ "$MASTER_AGENT_HOST" == "" ]; then
MASTER_AGENT_HOST="localhost";
fi
if [ "$MASTER_AGENT_PORT" == "" ]; then
MASTER_AGENT_PORT=705;
fi
if [ "$MASTER_AGENT_CONNECTION_RETRIES" == "" ]; then
MASTER_AGENT_CONNECTION_RETRIES=20;
fi
HOST=$MASTER_AGENT_HOST
PORT=$MASTER_AGENT_PORT
RETRIES=$MASTER_AGENT_CONNECTION_RETRIES
echo "Waiting master agent initialization ($HOST:$PORT) [MaxRetries:$RETRIES]"
counter=0
until </dev/tcp/$HOST/$PORT; do
sleep 1;
[[ counter -eq $RETRIES ]] && exit 1;
echo "Trying again, try #$counter";
$((counter++));
done
# Internal params
RUN_CMD="./wrsAlarmMIB ${OPTIONDEBUG} -f -x tcp:localhost:705"
RUN_CMD="./wrsAlarmMIB ${OPTIONDEBUG} -f -x tcp:${HOST}:$PORT"
# Launch
$RUN_CMD

View File

@ -68,6 +68,12 @@ spec:
env:
- name: "OPTIONDEBUG"
value: {{ .Values.image.debug }}
- name: "MASTER_AGENT_HOST"
value: {{ .Values.deployment.master_agent_host | quote}}
- name: "MASTER_AGENT_PORT"
value: {{ .Values.deployment.master_agent_port | quote}}
- name: "MASTER_AGENT_CONNECTION_RETRIES"
value: {{ .Values.deployment.master_agent_connection_retries | quote}}
# Fail on liveness and readiness as here: https://bit.ly/3nVRQrL
# K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713
#
@ -104,6 +110,12 @@ spec:
env:
- name: "OPTIONDEBUG"
value: {{ .Values.image.debug }}
- name: "MASTER_AGENT_HOST"
value: {{ .Values.deployment.master_agent_host | quote}}
- name: "MASTER_AGENT_PORT"
value: {{ .Values.deployment.master_agent_port | quote}}
- name: "MASTER_AGENT_CONNECTION_RETRIES"
value: {{ .Values.deployment.master_agent_connection_retries | quote}}
# Fail on liveness and readiness as here: https://bit.ly/3nVRQrL
# K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713
#
@ -123,7 +135,6 @@ spec:
# timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
# successThreshold: {{ .Values.readinessProbe.successThreshold }}
# failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
volumes:
- name: snmpd-etc-volume
configMap:

View File

@ -33,6 +33,8 @@ configmap:
deployment:
master_agent_host: localhost
master_agent_port: 705
master_agent_connection_retries: 20
service:
name: snmpd-service