From 1117cf40eb996b0f29567545b1232dbdfb40ca96 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 1 Sep 2018 14:22:57 +0200 Subject: T771: snmp.px: reduce syslog noise --- src/conf_mode/snmp.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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): -- cgit v1.2.3