add env config

This commit is contained in:
Radek
2025-03-06 13:00:02 +00:00
parent c06e385bc9
commit ee830ec557
3 changed files with 10 additions and 4 deletions

View File

@@ -14,10 +14,10 @@ COPY custom_snmp_script.py /usr/local/bin/custom_snmp_script.py
RUN chmod +x /usr/local/bin/custom_snmp_script.py
# Configure snmpd to use the custom script
RUN echo "extend .1.3.6.1.4.1.38446.1.2.4.1.9.1 /usr/local/bin/custom_snmp_script.py" >> /etc/snmp/snmpd.conf
RUN echo "extend customOID /usr/local/bin/custom_snmp_script.py" >> /etc/snmp/snmpd.conf
# Expose the SNMP port
EXPOSE 161/udp
# Start snmpd
CMD ["snmpd", "-f"]
# Start snmpd with environment variables
CMD ["sh", "-c", "snmpd -f -c /etc/snmp/snmpd.conf -Lf /dev/null -p /var/run/snmpd.pid -a -x $SNMP_COMMUNITY"]