func (ic *IpmiCollector) construct(cfg map[string]ctypes.ConfigValue) { var hostList []string var ipmiLayer ipmi.IpmiAL ic.Mode = getMode(cfg) channel := getChannel(cfg) slave := getSlave(cfg) user := getUser(cfg) pass := getPass(cfg) host, _ := os.Hostname() if ic.Mode == "legacy_inband" { ipmiLayer = &ipmi.LinuxInBandIpmitool{Device: "ipmitool", Channel: channel, Slave: slave} hostList = []string{host} } else if ic.Mode == "oob" { ipmiLayer = &ipmi.LinuxOutOfBand{Device: "ipmitool", Channel: channel, Slave: slave, User: user, Pass: pass} hostList = []string{getHost(cfg)} } else if ic.Mode == "legacy_inband_openipmi" { ipmiLayer = &ipmi.LinuxInband{} } else { return } ic.IpmiLayer = ipmiLayer ic.Hosts = hostList ic.Vendor = ipmiLayer.GetPlatformCapabilities(ipmi.GenericVendor, hostList) ic.Initialized = true }
func (ic *IpmiCollector) construct(cfg map[string]ctypes.ConfigValue) { var hostList []string var ipmiLayer ipmi.IpmiAL ic.Mode = getMode(cfg) channel := getChannel(cfg) slave := getSlave(cfg) host, _ := os.Hostname() fmt.Println(host) if ic.Mode == "legacy_inband" { ipmiLayer = &ipmi.LinuxInBandIpmitool{Device: "ipmitool", Channel: channel, Slave: slave} hostList = []string{host} } else { return } ic.IpmiLayer = ipmiLayer ic.Hosts = hostList ic.Vendor = ipmiLayer.GetPlatformCapabilities(ipmi.GenericVendor, hostList) }