Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-1784

Nagios module generates broken nagios config, if `hostname -f` returns localhost

    XMLWordPrintable

    Details

      Description

      root@jessie:~# oaconfig install --allow-broken-hostname 
      .. snip ... 
      Traceback (most recent call last):
        File "manage.py", line 26, in <module>
          execute_from_command_line(sys.argv)
        File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
          utility.execute()
        File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
          self.fetch_command(subcommand).run_from_argv(self.argv)
        File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
          self.execute(*args, **options.__dict__)
        File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
          output = self.handle(*args, **options)
        File "/usr/share/openattic/rpcd/management/commands/makedefaultadmin.py", line 27, in handle
          admin.save()
        File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 589, in save
          force_update=force_update, update_fields=update_fields)
        File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 613, in save_base
          update_fields=update_fields)
        File "/usr/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send
          response = receiver(signal=self, sender=sender, **named)
        File "/usr/share/openattic/nagios/models.py", line 177, in update_conf_for_user
          nagios.restart_service()
        File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
          **keywords)
        File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
          message, timeout)
      dbus.exceptions.DBusException: org.freedesktop.DBus.Python.SystemError: Traceback (most recent call last):
        File "/usr/lib/python2.7/dist-packages/dbus/service.py", line 707, in _message_cb
          retval = candidate_method(self, *args, **keywords)
        File "/usr/share/openattic/systemd/plugins.py", line 51, in loggedfunc
          return func(*args, **kwargs)
        File "/usr/share/openattic/systemd/plugins.py", line 99, in wrapper
          return meth(self, *args, **kwargs)
        File "/usr/share/openattic/nagios/systemapi.py", line 66, in restart_service
          invoke([nagios_settings.BINARY_NAME, "--verify-config", nagios_settings.NAGIOS_CFG_PATH])
        File "/usr/share/openattic/systemd/procutils.py", line 119, in invoke
          raise SystemError("%s failed: %s" % (cmdline, procerr))
      SystemError: "nagios3" "--verify-config" "/etc/nagios3/nagios.cfg" failed: 
      
      root@jessie:~# "nagios3" "--verify-config" "/etc/nagios3/nagios.cfg"
      
      Nagios Core 3.5.1
      Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
      Copyright (c) 1999-2009 Ethan Galstad
      Last Modified: 08-30-2013
      License: GPL
      
      Website: http://www.nagios.org
      Reading configuration data...
         Read main config file okay...
      Processing object config file '/etc/nagios3/commands.cfg'...
      Processing object config directory '/etc/nagios-plugins/config'...
      Processing object config file '/etc/nagios-plugins/config/apt.cfg'...
      Processing object config file '/etc/nagios-plugins/config/telnet.cfg'...
      Processing object config file '/etc/nagios-plugins/config/load.cfg'...
      Processing object config file '/etc/nagios-plugins/config/flexlm.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ftp.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ldap.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ping.cfg'...
      Processing object config file '/etc/nagios-plugins/config/disk.cfg'...
      Processing object config file '/etc/nagios-plugins/config/disk-smb.cfg'...
      Processing object config file '/etc/nagios-plugins/config/pgsql.cfg'...
      Processing object config file '/etc/nagios-plugins/config/dhcp.cfg'...
      Processing object config file '/etc/nagios-plugins/config/breeze.cfg'...
      Processing object config file '/etc/nagios-plugins/config/dns.cfg'...
      Processing object config file '/etc/nagios-plugins/config/news.cfg'...
      Processing object config file '/etc/nagios-plugins/config/nt.cfg'...
      Processing object config file '/etc/nagios-plugins/config/mail.cfg'...
      Processing object config file '/etc/nagios-plugins/config/fping.cfg'...
      Processing object config file '/etc/nagios-plugins/config/games.cfg'...
      Processing object config file '/etc/nagios-plugins/config/mailq.cfg'...
      Processing object config file '/etc/nagios-plugins/config/real.cfg'...
      Processing object config file '/etc/nagios-plugins/config/users.cfg'...
      Processing object config file '/etc/nagios-plugins/config/radius.cfg'...
      Processing object config file '/etc/nagios-plugins/config/rpc-nfs.cfg'...
      Processing object config file '/etc/nagios-plugins/config/hppjd.cfg'...
      Processing object config file '/etc/nagios-plugins/config/tcp_udp.cfg'...
      Processing object config file '/etc/nagios-plugins/config/mysql.cfg'...
      Processing object config file '/etc/nagios-plugins/config/openattic.cfg'...
      Processing object config file '/etc/nagios-plugins/config/netware.cfg'...
      Processing object config file '/etc/nagios-plugins/config/mrtg.cfg'...
      Processing object config file '/etc/nagios-plugins/config/snmp.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ntp.cfg'...
      Processing object config file '/etc/nagios-plugins/config/dummy.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ssh.cfg'...
      Processing object config file '/etc/nagios-plugins/config/ifstatus.cfg'...
      Processing object config file '/etc/nagios-plugins/config/http.cfg'...
      Processing object config file '/etc/nagios-plugins/config/procs.cfg'...
      Processing object config directory '/etc/nagios3/conf.d'...
      Processing object config file '/etc/nagios3/conf.d/services_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/extinfo_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/pnp4nagios.cfg'...
      Processing object config file '/etc/nagios3/conf.d/timeperiods_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/localhost_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/generic-host_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/openattic_contacts.cfg'...
      Processing object config file '/etc/nagios3/conf.d/hostgroups_nagios2.cfg'...
      Processing object config file '/etc/nagios3/conf.d/openattic.cfg'...
      Warning: Duplicate definition found for host 'localhost' (config file '/etc/nagios3/conf.d/openattic.cfg', starting on line 4)
      Error: Could not add object property in file '/etc/nagios3/conf.d/openattic.cfg' on line 5.
         Error processing object config files!
      
      
      ***> One or more problems was encountered while processing the config files...
      
           Check your configuration file(s) to ensure that they contain valid
           directives and data defintions.  If you are upgrading from a previous
           version of Nagios, you should be aware that some variables/definitions
           may have been removed or modified in this version.  Make sure to read
           the HTML documentation regarding the config files, as well as the
           'Whats New' section to find out what has changed.
      root@jessie:~# hostname -f    
      localhost
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                swagner Sebastian Wagner
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: