Bug 752821

Summary: snmpd systemd service needs an EnvironmentFile to change options
Product: [Fedora] Fedora Reporter: Robert Kennedy <rt>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: jsafrane
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: net-snmp-5.7.1-3.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-28 13:17:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Robert Kennedy 2011-11-10 14:11:49 UTC
Description of problem:

/lib/systemd/system/snmpd.service hard codes arguments instead of sourcing an /etc/sysconfig file.


Version-Release number of selected component (if applicable):

net-snmp-5.7.1-2.fc16.x86_64

How reproducible:

Always

Steps to Reproduce:

1. Start snmpd service
  
Actual results:

Starts with "-LS0-6d -f" as arguments.

Expected results:

Starts with $OPTIONS or some other sourced variable from /etc/sysconfig/snmpd (or whatever) that has arguments of my choosing.

Additional info:

Comment 1 Jan Safranek 2011-11-21 12:28:47 UTC
I thought following simple /etc/systemd/services/snmpd.service could work, but I got bitten by systemd, it does not like two ExecStart options :(

        [Service]
        ExecStart=/usr/sbin/snmpd -LS0-5d -f
        .include /lib/systemd/system/snmpd.service

Can't you copy /lib/systemd/system/snmpd.service to /etc/systemd/system/snmpd.service and edit it there? /etc/sysconfig kind of sucks. IMHO most users don't really need to edit snmpd options.

Comment 2 Robert Kennedy 2011-11-21 13:26:03 UTC
If /etc/systemd is supposed to be taking over the role of /etc/sysconfig as well as /etc/init.d that is fine, but I haven't read anything that leads me to believe that. I'm happy moving on to the new hotness of systemd, but losing configurability should not be part of that migration.

Copying the file to /etc/systemd/system and replacing it with:

[Unit]
Description=Simple Network Management Protocol (SNMP) Daemon.
After=syslog.target network.target

[Service]
Type=notify
Environment=SNMPDLOG="-LS0-6d"
EnvironmentFile=-/etc/sysconfig/snmpd
ExecStart=/usr/sbin/snmpd $SNMPDLOG $SNMPDARGS -f
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target


has been a reasonable workaround for me but doing so leaves me stranded if net-snmp actually does update their /lib/systemd service file.

Comment 3 Jan Safranek 2011-11-28 13:17:04 UTC
(In reply to comment #2)
> Copying the file to /etc/systemd/system and replacing it with:
> 
> [Unit]
> Description=Simple Network Management Protocol (SNMP) Daemon.
> After=syslog.target network.target
> 
> [Service]
> Type=notify
> Environment=SNMPDLOG="-LS0-6d"
> EnvironmentFile=-/etc/sysconfig/snmpd
> ExecStart=/usr/sbin/snmpd $SNMPDLOG $SNMPDARGS -f
> ExecReload=/bin/kill -HUP $MAINPID
> 
> [Install]
> WantedBy=multi-user.target
> 
> 
> has been a reasonable workaround for me but doing so leaves me stranded if
> net-snmp actually does update their /lib/systemd service file.

This should work well through F16 lifecycle - I do not plan to update service file there unless absolutely necessary. I added /etc/systemd/snmpd to rawhide.