Commit bfc4bfc3 authored by Jérémie Gaidamour's avatar Jérémie Gaidamour
Browse files

[dev] Update the logic for switch info + pdu

parent d1372360
......@@ -110,8 +110,8 @@ global_hash["sites"].each do |site_uid, site|
network_adapter["ib_switch_card"] = network_adapter.delete("line_card") if network_adapter.key?("line_card")
network_adapter["ib_switch_card_pos"] = network_adapter.delete("position") if network_adapter.key?("position")
# Management network_adapter (bmc)
if network_adapter["management"]
# Management network_adapter (bmc)
network_adapter["network_address"] = "#{node_uid}-bmc.#{site_uid}.grid5000.fr"
elsif network_adapter["mounted"] and /^eth[0-9]$/.match(network_adapter["device"])
# Primary network_adapter
......@@ -121,11 +121,13 @@ global_hash["sites"].each do |site_uid, site|
network_adapter["switch"], network_adapter["switch_port"] = net_switch_port_lookup(site, node_uid, network_adapter["device"]) || net_switch_port_lookup(site, node_uid)
else
# Secondary network_adapter(s)
network_adapter["network_address"] = "#{node_uid}-#{network_adapter["device"]}.#{site_uid}.grid5000.fr" if network_adapter["enabled"]
network_adapter["network_address"] = "#{node_uid}-#{network_adapter["device"]}.#{site_uid}.grid5000.fr" if network_adapter["enabled"] && network_adapter["mounted"]
if network_adapter["mountable"]
switch, port = net_switch_port_lookup(site, node_uid, network_adapter["device"])
network_adapter["switch"] = switch if switch
network_adapter["switch_port"] = port if port
end
end
}
node["sensors"] ||= {}
......@@ -166,7 +168,10 @@ global_hash["sites"].each do |site_uid, site|
#pp node["monitoring"]["wattmeter"]
if node["monitoring"]["wattmeter"] != "false"
if node["monitoring"]["wattmeter"] == "yes"
node["sensors"]["power"]["via"]["api"] ||= {}
node["sensors"]["power"]["via"]["api"]["metric"] = "pdu"
elsif node["monitoring"]["wattmeter"] != "false"
node["sensors"]["power"]["via"]["api"] ||= {}
node["sensors"]["power"]["via"]["api"]["metric"] = "power"
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment