Support enabling DEBUG log mode for all SNMP containers into the POD

Enable/Disable the verbose logging to debug the application SNMP including master-agent,subagent and trap-subagent running on containers. Add parameter "-DALL" to turn on debugging output.

Story: 2008132
Task: 41410
Signed-off-by: Gonzalo Gallardo <gonzalo.gallardo@windriver.com>
Change-Id: Id0f68ae1bcfba7086ad20a27748cd272c3477d81
This commit is contained in:
Gonzalo Gallardo 2020-12-11 17:07:35 -03:00
parent 0fd1e0fbaa
commit 2b370655a7
7 changed files with 49 additions and 15 deletions

View File

@ -6,7 +6,6 @@ RUN yum -y install\
fm-common-dev
FROM centos:7 AS base
RUN yum -y install\
net-snmp \
net-snmp-utils \
@ -38,7 +37,6 @@ RUN make
FROM base AS deployment-env
COPY --from=builder /home/sub-agent/snmpSubAgent .
COPY bootstrap.sh .
RUN chmod 755 bootstrap.sh

View File

@ -1,9 +1,22 @@
#!/bin/bash
set -u
# Option handling in sh
if [ "$OPTIONDEBUG" != "" ]; then
case "$OPTIONDEBUG" in
-DALL) echo "-DALL - debug option enable"
;;
-*) echo "Unrecognized option $OPTIONDEBUG"
OPTIONDEBUG=""
;;
*) echo "Bad argument $OPTIONDEBUG"
OPTIONDEBUG=""
;;
esac
fi
# Internal params
RUN_CMD="./snmpSubAgent -f -x tcp:localhost:705"
RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:localhost:705"
# Launch
$RUN_CMD

View File

@ -23,4 +23,3 @@ COPY --from=builder /home/trapagent/wrsAlarmMIB .
COPY bootstrap.sh .
RUN chmod 755 ./bootstrap.sh
ENTRYPOINT ["./bootstrap.sh"]

View File

@ -1,8 +1,22 @@
#!/bin/bash
set -u
# Option handling in sh
if [ "$OPTIONDEBUG" != "" ]; then
case "$OPTIONDEBUG" in
-DALL) echo "-DALL - debug option enable"
;;
-*) echo "Unrecognized option $OPTIONDEBUG"
OPTIONDEBUG=""
;;
*) echo "Bad argument $OPTIONDEBUG"
OPTIONDEBUG=""
;;
esac
fi
# Internal params
RUN_CMD="./wrsAlarmMIB -f -x tcp:localhost:705"
RUN_CMD="./wrsAlarmMIB ${OPTIONDEBUG} -f -x tcp:localhost:705"
# Launch
$RUN_CMD

View File

@ -5,8 +5,8 @@ RUN yum -y install \
net-snmp-libs \
net-snmp-devel \
libuuid\
gcc\
make
gcc\
make
RUN ln -s /usr/lib64/libuuid.so.1.3.0 /usr/lib64/libuuid.so
WORKDIR /home
COPY ./src/* /home/src/
@ -17,13 +17,13 @@ FROM centos:8
RUN yum -y update
RUN yum -y upgrade
RUN yum -y install\
net-snmp \
net-snmp-utils \
net-snmp-libs
net-snmp \
net-snmp-utils \
net-snmp-libs
COPY ./mibs/* /usr/share/snmp/mibs/
COPY --from=builder /home/src/libsnmpAuditPlugin.so /usr/lib64/
EXPOSE 161/udp
EXPOSE 162/udp
EXPOSE 705/tcp
CMD [ "/usr/sbin/snmpd", "-f"]
CMD /usr/sbin/snmpd $OPTIONDEBUG -f

View File

@ -34,6 +34,9 @@ spec:
protocol: UDP
- containerPort: 705
protocol: TCP
env:
- name: "OPTIONDEBUG"
value: {{ .Values.image.debug }}
# Issues with liveness and readiness: https://bit.ly/3nVRQrL
# K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713
#
@ -62,6 +65,9 @@ spec:
volumeMounts:
- name: snmpd-fm-volume
mountPath: /etc/fm/
env:
- name: "OPTIONDEBUG"
value: {{ .Values.image.debug }}
# Fail on liveness and readiness as here: https://bit.ly/3nVRQrL
# K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713
#
@ -95,6 +101,9 @@ spec:
ports:
- containerPort: 162
protocol: TCP
env:
- name: "OPTIONDEBUG"
value: {{ .Values.image.debug }}
# Fail on liveness and readiness as here: https://bit.ly/3nVRQrL
# K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713
#

View File

@ -6,16 +6,17 @@ replicaCount: 1
image:
repository: registry.local:9001/docker.io/starlingx/stx-snmp
tag: stx.5.0-1.0.0
tag: stx.5.0-1.0.1
pullPolicy: IfNotPresent
subagent_name: sub-agent
repository_subagent: registry.local:9001/docker.io/starlingx/stx-fm-subagent
tag_subagent: stx.5.0-1.0.0
tag_subagent: stx.5.0-1.0.1
pullPolicy_subagent: IfNotPresent
trap_subagent_name: trap-subagent
repository_trap_subagent: registry.local:9001/docker.io/starlingx/stx-fm-trap-subagent
tag_trap_subagent: stx.5.0-1.0.0
tag_trap_subagent: stx.5.0-1.0.1
pullPolicy_trap_subagent: IfNotPresent
debug: ''
nameOverride: ""
fullnameOverride: ""