summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2018-09-01 14:22:57 +0200
committerChristian Poessinger <christian@poessinger.com>2018-09-01 14:22:57 +0200
commit1117cf40eb996b0f29567545b1232dbdfb40ca96 (patch)
tree970f977bedfc080d6dc0f9d4848c56b00a8627dc /src/conf_mode
parent81e1cf8dbf02b95a89caa180f483a66655591d1a (diff)
downloadvyos-1x-1117cf40eb996b0f29567545b1232dbdfb40ca96.tar.gz
vyos-1x-1117cf40eb996b0f29567545b1232dbdfb40ca96.zip
T771: snmp.px: reduce syslog noise
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/snmp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py
index b98741913..4d84aa4df 100755
--- a/src/conf_mode/snmp.py
+++ b/src/conf_mode/snmp.py
@@ -38,6 +38,7 @@ config_file_client = r'/etc/snmp/snmp.conf'
config_file_daemon = r'/etc/snmp/snmpd.conf'
config_file_access = r'/usr/share/snmp/snmpd.conf'
config_file_user = r'/var/lib/snmp/snmpd.conf'
+config_file_init = r'/etc/default/snmpd'
# SNMP OIDs used to mark auth/priv type
OIDs = {
@@ -224,7 +225,17 @@ group {{ u.group }} tsm {{ u.name }}
{% endif %}
{% endif %}
+"""
+
+init_config_tmpl = """
+### Autogenerated by snmp.py ###
+# This file controls the activity of snmpd
+
+# snmpd control (yes means start daemon).
+SNMPDRUN=yes
+# snmpd options (use syslog, close stdin/out/err).
+SNMPDOPTS='-LSed -u snmp -g snmp -p /run/snmpd.pid'
"""
default_config_data = {
@@ -734,6 +745,12 @@ def generate(snmp):
with open(config_file_user, 'w') as f:
f.write(config_text)
+ # Write init config file
+ tmpl = jinja2.Template(init_config_tmpl)
+ config_text = tmpl.render(snmp)
+ with open(config_file_init, 'w') as f:
+ f.write(config_text)
+
return None
def apply(snmp):