diff --git a/Rakefile b/Rakefile
index bff4b2a549da2145b10601d36d687e6d7f3a460b..783af900383425111e68000862e39ae9cf993234 100644
--- a/Rakefile
+++ b/Rakefile
@@ -203,7 +203,7 @@ namespace :gen do
 
   namespace :puppet do
 
-    all_puppet_tasks = [:bindg5k, :conmang5k, :dhcpg5k, :kadeployg5k, :lanpowerg5k, :kavlang5k]
+    all_puppet_tasks = [:bindg5k, :conmang5k, :dhcpg5k, :kadeployg5k, :lanpowerg5k, :kavlang5k, :network_monitoring]
 
     all_puppet_tasks.each { |t|
       desc "Generate #{t} configuration -- parameters: [SITE={grenoble,...}] [OUTPUTDIR=(default: #{PUPPET_ODIR})] [CONFDIR=...] [VERBOSE=1]"
diff --git a/lib/refrepo/gen/puppet/network_monitoring.rb b/lib/refrepo/gen/puppet/network_monitoring.rb
new file mode 100644
index 0000000000000000000000000000000000000000..bbd6ef34dfa611ec536319481d349be4e771238f
--- /dev/null
+++ b/lib/refrepo/gen/puppet/network_monitoring.rb
@@ -0,0 +1,76 @@
+# add network_monitoring on supervision.site.grid5000.fr.yaml on hiera
+#
+
+def generate_puppet_network_monitoring(options)
+  refapi = load_data_hierarchy
+
+  sites = options[:sites]
+  out = options[:output_dir]
+
+  sites.each do |s|
+    net_eqs = refapi['sites'][s]['network_equipments']
+    hiera_file = "#{out}/platforms/production/hieradata/clients/supervision2.#{s}.grid5000.fr.yaml"
+    hiera_yaml = YAML.load_file(hiera_file)
+
+    snmp_hosts = hiera_yaml['grid5000::munin::snmp::hosts'] || []
+    net_hosts = hiera_yaml['grid5000::icinga::network::hosts'] || []
+
+    net_eqs.each do |eq_name, eq_v|
+      fqdn_eq_name = "#{eq_name}.#{s}.grid5000.fr"
+
+      snmp_hosts << fqdn_eq_name unless
+        snmp_hosts.find { |i| i == fqdn_eq_name }
+
+      net_hosts_eq = net_hosts.select { |i| i['name'] == fqdn_eq_name }
+
+      if net_hosts_eq.length.zero?
+        net_hosts << {
+          'name' => fqdn_eq_name,
+          'address' => eq_v['ip'],
+          'interfaces' => [],
+          'has_ospf' => eq_v['kind'] == 'router'
+        }
+        net_hosts_eq = net_hosts.find { |i| i['name'] == fqdn_eq_name }
+
+      elsif net_hosts_eq.length == 1
+        net_hosts_eq = net_hosts_eq.first
+      else
+        net_hosts_eq = net_hosts_eq.first
+        puts "ERROR: multiple entry for #{fqdn_eq_name} in hiera"
+      end
+
+      eq_v['linecards'].each do |l|
+        next if l == {}
+
+        l['ports'].each do |p|
+          next if p == {}
+
+          next unless %w[other switch router channel backbone].include?(p['kind'])
+
+          port_name = p['snmp_name']
+          next if net_hosts_eq['interfaces'].find { |i| i['name'] == port_name }
+
+          sw = "#{eq_v['channels'][p['uid']]['uid']} " if p['kind'] == 'channel'
+
+          net_hosts_eq['interfaces'] << {
+            'name' => port_name,
+            'description' => "Uplink #{sw}#{p['uid']}"
+          }
+        end
+      end
+
+      next unless eq_v['channels']
+      eq_v['channels'].each do |c_name, c_v|
+        next if net_hosts_eq['interfaces'].find { |i| i['name'] == c_name }
+
+        net_hosts_eq['interfaces'] << {
+          'name' => c_name,
+          'description' => "LACP #{c_v['uid']}"
+        }
+      end
+    end
+    hiera_yaml['grid5000::munin::snmp::hosts'] = snmp_hosts
+    hiera_yaml['grid5000::icinga::network::hosts'] = net_hosts
+    IO.write(hiera_file, YAML.dump(hiera_yaml))
+  end
+end