extinfo stuff has been deprecated the way we do it. rip it out
authorPeter Palfrader <peter@palfrader.org>
Tue, 13 Mar 2018 10:51:37 +0000 (11:51 +0100)
committerPeter Palfrader <peter@palfrader.org>
Tue, 13 Mar 2018 10:51:37 +0000 (11:51 +0100)
config/build-nagios
config/nagios-master.cfg

index 28513c9..49b981e 100755 (executable)
@@ -31,7 +31,7 @@ SHORTORG="dsa"
 GENERATED_PREFIX="./generated/"
 
 nagios_filename = {};
-%w(hosts hostgroups services dependencies hostextinfo serviceextinfo servicegroups).each{
+%w(hosts hostgroups services dependencies servicegroups).each{
        |x| nagios_filename[x] = GENERATED_PREFIX+"auto-#{x}.cfg"
 }
 nagios_filename['nrpe'] = GENERATED_PREFIX+"nrpe_#{ ORG }.cfg"
@@ -209,11 +209,6 @@ def addService(hosts, service, files, servers)
                }
        end
 
-
-       set_complain_if_set service['_extinfo'], 'service_description' , service['service_description'], 'serviceextinfo', service['service_description']
-       set_complain_if_set service['_extinfo'], 'host_name'           , hosts.sort.join(',')          , 'serviceextinfo', service['service_description']
-
-       print_block files['serviceextinfo'], 'serviceextinfo', service['_extinfo'], %w()
 end
 
 # hostlists in services can be given as both, single hosts and hostgroups
@@ -252,19 +247,6 @@ def find_hosts(service, servers, hostgroups)
        return hosts
 end
 
-# Move all elements that have a key that starts with "extinfo-"
-# into the _extinfo subhash
-def split_away_extinfo(hash)
-       hash['_extinfo'] = {}
-       hash.keys.each{ |key|
-               if key[0, 8] == 'extinfo-'
-                       hash['_extinfo'][ key[8, key.length-8] ] = hash[key]
-                       hash.delete(key);
-               end
-       }
-end
-
-
 #############################################################################################
 #############################################################################################
 #############################################################################################
@@ -291,7 +273,6 @@ config['hostgroups']['pingable']['private'] = true
 
 config['hostgroups'].each_pair{ |name, hg|
        throw "Empty hostgroup or hostgroup #{name} not a hash" unless hg.kind_of?(Hash)
-       split_away_extinfo hg
 
        hg['_memberlist'] = []
 }
@@ -299,8 +280,6 @@ config['hostgroups'].each_pair{ |name, hg|
 config['servers'].each_pair{ |name, server|
        throw "Empty server or server #{name} not a hash" unless server.kind_of?(Hash)
 
-       split_away_extinfo server
-
        throw "No hostgroups defined for #{name}" unless server['hostgroups']
        server['_hostgroups'] = server['hostgroups'].split(/,/).map{ |x| x.strip };
        server['_hostgroups'] << 'all'
@@ -333,29 +312,6 @@ config['servers'].keys.sort.each{ |name|
        set_if_unset        server, 'check_command', HOST_ALIVE_CHECK    unless server['pingable'] == false
 
        print_block files['hosts']      , 'host'       , server            , %w(hostgroups pingable no-servicegroups)
-
-
-
-       # Handle hostextinfo
-       # Compose extinfo from all the hostgroups for each server
-       config['hostgroups'].each_pair{ |hgname, hostgroup|
-               next unless server['_hostgroups'].include?(hgname)
-               hostgroup['_extinfo'].each_pair do |k, v|
-                       if v.empty?
-                               server['_extinfo'].delete(k)
-                       else
-                               # substitute hostname into the notes_url
-                               v = sprintf(v,name) if k == 'notes_url'
-                               server['_extinfo'][k] = v
-                       end
-               end
-       }
-
-       set_complain_if_set server['_extinfo'], 'host_name'       , name, 'hostextinfo', name
-       set_if_unset        server['_extinfo'], 'vrml_image'      , server['_extinfo']['icon_image'] if server['_extinfo'].has_key?('icon_image')
-       set_if_unset        server['_extinfo'], 'statusmap_image' , server['_extinfo']['icon_image'] if server['_extinfo'].has_key?('icon_image')
-
-       print_block files['hostextinfo'], 'hostextinfo', server['_extinfo'], %w()
 }
 
 
@@ -382,8 +338,6 @@ config['hostgroups'].keys.sort.each{ |name|
 config['services'].each{ |service|
        throw "Empty service or service not a hash" unless service.kind_of?(Hash)
 
-       split_away_extinfo service
-
        # make sure the depends list is an array
        service['depends'] = ensure_array( service['depends'] )
 
index 999aa94..a432e4e 100644 (file)
@@ -1095,13 +1095,8 @@ hostgroups:
   computers:
     alias: computers
     private: 1
-    extinfo-icon_image: base/debian.png
-    extinfo-icon_image_alt: Debian GNU/Linux
-    extinfo-notes_url: https://db.debian.org/machines.cgi?host=%s
   layer3-infrastructure:
     alias: Layer 3 Devices
-    extinfo-icon_image: base/switch40.png
-    extinfo-icon_image_alt: router
   notacomputer:
     alias: Systems that are not really systems.  Yeah :)
     private: 1