Bug 752821 - snmpd systemd service needs an EnvironmentFile to change options
Summary: snmpd systemd service needs an EnvironmentFile to change options
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: net-snmp
Version: 16
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jan Safranek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-10 14:11 UTC by Robert Kennedy
Modified: 2011-11-28 13:17 UTC (History)
1 user (show)

Fixed In Version: net-snmp-5.7.1-3.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-28 13:17:04 UTC
Type: ---


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.