Bug 768683

Summary: Mrtg fails to Start on Fedora 16
Product: [Fedora] Fedora Reporter: Kjell Randa <kjell.m.randa>
Component: mrtgAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: vcrhonek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-10 11:49:45 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 Kjell Randa 2011-12-17 21:49:43 UTC
Description of problem:

After upgrade from Fedora 15 to Fedora 16 mrtg will not start.
In /var/log/mrtg.log the following messages are found

Starting mrtg: 
2011-12-17 17:12:15 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'
2011-12-17 17:12:16 -- Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.
2011-12-17 17:12:16 -- Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/Exporter.pm line 67.


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

[root@nazgul ~]# rpm -qf /usr/share/perl5/Exporter.pm
   perl-5.14.2-191.fc16.x86_64
[root@nazgul ~]# rpm -qa|grep -i mrtg-2
   mrtg-2.17.2-5.fc16.x86_64
[root@nazgul ~]# rpm -qa| grep -i snmp
   net-snmp-5.7.1-2.fc16.x86_64
   collectd-snmp-4.10.3-8.fc16.x86_64
   net-snmp-agent-libs-5.7.1-2.fc16.x86_64
   net-snmp-devel-5.7.1-2.fc16.x86_64
   net-snmp-libs-5.7.1-2.fc16.x86_64
   nagios-plugins-snmp-1.4.15-4.fc16.x86_64
   net-snmp-utils-5.7.1-2.fc16.x86_64
   perl-Net-SNMP-6.0.1-3.fc16.noarch
   nagios-plugins-snmp-disk-proc-1.2-9.fc16.x86_64
   perl-SNMP_Session-1.12-8.fc16.noarch

How reproducible:
Alway when staring mrtg

Steps to Reproduce:
1.
Upgrade F15 - F16 using DVD
2.
systemctl enable mrtg.service
systemctl start mrtg.service
[root@nazgul ~]# systemctl status mrtg.service
mrtg.service - Multi-router Traffic Grapher
          Loaded: loaded (/lib/systemd/system/mrtg.service; enabled)
          Active: inactive (dead) since Sat, 17 Dec 2011 22:14:31 +0100; 32min ago
         Process: 15708 ExecStart=/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/mrtg.service


  
Actual results:
mrtg failed to start

Expected results:
mrtg should start

Additional info:

Similar to https://bugzilla.redhat.com/show_bug.cgi?id=732587
but fingerprint a bit different

Comment 1 Vitezslav Crhonek 2011-12-20 09:22:39 UTC
Kjell, redefinition of SNMP_Session::pack_sockaddr_in6 subroutine should be completely fixed in mrtg-2.17.2-5.fc16.x86_64. You can check the fix:

# grep -n 'Socket6->import' /usr/lib/mrtg2/SNMP_Session.pm

If you have fixed version, the output should be:

149:       Socket6->import(qw(inet_pton getaddrinfo));
604:        Socket6->import(qw(inet_pton getaddrinfo));

But I think there's another issue. Please run mrtg manually:

#  env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok

Does it fail? And the error message is:
Undefined subroutine &main::AF_UNSPEC called at /usr/bin/mrtg line 2247.

Comment 2 Kjell Randa 2011-12-20 23:32:43 UTC
I only have the 64c bit version of mrtg installed and libs are in /usr/lib64

[root@nazgul ~]# grep -n 'Socket6->import' /usr/lib64/mrtg2/SNMP_Session.pm
149:       Socket6->import(qw(inet_pton getaddrinfo));
604:        Socket6->import(qw(inet_pton getaddrinfo));

Starting mrtg manually make it run successfully
[root@nazgul ~]# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
Daemonizing MRTG ...


[root@nazgul ~]# ps -ef| grep mrtg|grep -v grep
root     22211     1  0 00:18 ?        00:00:00 /usr/bin/perl -w /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok


My problem must somehow be related to the start-up script, but I have an unmodified start-up script from the mrtg package containing the following:
[root@nazgul ~]# cat /lib/systemd/system/mrtg.service 
# To customize, copy this file to /etc/systemd/system and edit there
#
# This unit facilitates starting of MRTG.  There are 2 options of
# how to run MRTG:
# - as a daemon (preferred); in this case please put
#   RunAsDaemon: yes in mrtg.conf (or use --daemon switch)
# - periodically - please see and enable mrtg.timer
#   Periodic settings need Type=oneshot set here
#
# Other recommended settings in mrtg.cfg for daemon mode:
# NoDetach: yes 
# If you set this, change below Type=simple
#
# Please disable /etc/crond.d/mrtg job when using this unit!
#
# do not enable both mrtg-as-a-daemon and timer at the same time

[Unit]
Description=Multi-router Traffic Grapher
After=syslog.target

[Service]
Environment=LANG=C
ExecStart=/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
# Type= settings cheatsheet:
# - RunAsDaemon: yes; NoDetach: yes :
#Type=simple
# - RunAsDaemon: yes; NoDetach: no :
#Type=forking
# - RunAsDaemon: no; (periodic invocation) :
#Type=oneshot
Type=simple
StandardOutput=syslog

[Install]
WantedBy=multi-user.target

Comment 3 Vitezslav Crhonek 2012-01-09 15:50:42 UTC
(In reply to comment #2)
> I only have the 64c bit version of mrtg installed and libs are in /usr/lib64
> 
> [root@nazgul ~]# grep -n 'Socket6->import' /usr/lib64/mrtg2/SNMP_Session.pm
> 149:       Socket6->import(qw(inet_pton getaddrinfo));
> 604:        Socket6->import(qw(inet_pton getaddrinfo));
> 
> Starting mrtg manually make it run successfully
> [root@nazgul ~]# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file
> /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
> Daemonizing MRTG ...
> 
> 
> [root@nazgul ~]# ps -ef| grep mrtg|grep -v grep
> root     22211     1  0 00:18 ?        00:00:00 /usr/bin/perl -w /usr/bin/mrtg
> /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file
> /var/lib/mrtg/mrtg.ok
> 
> 
> My problem must somehow be related to the start-up script, but I have an
> unmodified start-up script from the mrtg package containing the following:
> [root@nazgul ~]# cat /lib/systemd/system/mrtg.service 
> # To customize, copy this file to /etc/systemd/system and edit there
> #
> # This unit facilitates starting of MRTG.  There are 2 options of
> # how to run MRTG:
> # - as a daemon (preferred); in this case please put
> #   RunAsDaemon: yes in mrtg.conf (or use --daemon switch)
> # - periodically - please see and enable mrtg.timer
> #   Periodic settings need Type=oneshot set here
> #
> # Other recommended settings in mrtg.cfg for daemon mode:
> # NoDetach: yes 
> # If you set this, change below Type=simple
> #
> # Please disable /etc/crond.d/mrtg job when using this unit!
> #
> # do not enable both mrtg-as-a-daemon and timer at the same time
> 
> [Unit]
> Description=Multi-router Traffic Grapher
> After=syslog.target
> 
> [Service]
> Environment=LANG=C
> ExecStart=/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l
> --confcache-file /var/lib/mrtg/mrtg.ok
> # Type= settings cheatsheet:
> # - RunAsDaemon: yes; NoDetach: yes :
> #Type=simple
> # - RunAsDaemon: yes; NoDetach: no :
> #Type=forking
> # - RunAsDaemon: no; (periodic invocation) :
> #Type=oneshot
> Type=simple
> StandardOutput=syslog
> 
> [Install]
> WantedBy=multi-user.target

All above looks fine... One more thing - do you have

RunAsDaemon: yes
NoDetach: yes

in your /etc/mrtg/mrtg.cfg file, as suggested in .service file?

There will be mrtg-2.17.2-7.fc16 in the testing repository soon. It fixes different problems, but please try it.

Comment 4 Kjell Randa 2012-01-09 22:46:59 UTC
I had
RunAsDaemon: yes
and adding
NoDetach: yes to /etc/mrtg/mrtg.cfg solved the problem.

This was with mrtg-2.17.2-6.fc16.x86_64 and not mrtg-2.17.2-5.fc16.x86_64 as the problem originally was reported with.

I was also able to put back my old set-up in mrtg.service and mrtg is now running as:
root@nazgul system]# systemctl status mrtg.service
mrtg.service - Multi-router Traffic Grapher
          Loaded: loaded (/lib/systemd/system/mrtg.service; enabled)
          Active: active (running) since Mon, 09 Jan 2012 23:32:53 +0100; 9min ago
        Main PID: 12032 (mrtg)
          CGroup: name=systemd:/system/mrtg.service
                  └ 12032 /usr/bin/perl -w /usr/bin/mrtg /etc/mrtg/mrtg.cfg --user=apache --group=apache --logging=/var/log/mrtg.log --pid-file=/var/lock/mrtg/mrtg.pid --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/...

Thanks a lot for your suggestion.

Comment 5 Vitezslav Crhonek 2012-01-10 11:49:45 UTC
Happy to help!