mirror of
https://github.com/kemko/nomad.git
synced 2026-01-15 06:45:41 +03:00
Emit various debugging information with the results of the fingerprinter
This commit is contained in:
@@ -582,6 +582,7 @@ func (c *Client) reservePorts() {
|
||||
func (c *Client) fingerprint() error {
|
||||
whitelist := c.config.ReadStringListToMap("fingerprint.whitelist")
|
||||
whitelistEnabled := len(whitelist) > 0
|
||||
c.logger.Printf("[DEBUG] client: built-in fingerprints: %v", fingerprint.BuiltinFingerprints)
|
||||
|
||||
var applied []string
|
||||
var skipped []string
|
||||
|
||||
@@ -48,10 +48,12 @@ func (f *CPUFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bo
|
||||
|
||||
if mhz > 0 {
|
||||
node.Attributes["cpu.frequency"] = fmt.Sprintf("%.6f", mhz)
|
||||
f.logger.Printf("[DEBUG] fingerprint.cpu: frequency: %02.1fMHz", mhz)
|
||||
}
|
||||
|
||||
if numCores > 0 {
|
||||
node.Attributes["cpu.numcores"] = fmt.Sprintf("%d", numCores)
|
||||
f.logger.Printf("[DEBUG] fingerprint.cpu: core count: %d", numCores)
|
||||
}
|
||||
|
||||
if mhz > 0 && numCores > 0 {
|
||||
|
||||
@@ -77,6 +77,7 @@ func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node)
|
||||
|
||||
if throughput := f.linkSpeed(intf.Name); throughput > 0 {
|
||||
newNetwork.MBits = throughput
|
||||
f.logger.Printf("[DEBUG] fingerprint.network: link speed for %v set to %v", intf.Name, newNetwork.MBits)
|
||||
} else {
|
||||
f.logger.Printf("[DEBUG] fingerprint.network: Unable to read link speed; setting to default %v", cfg.NetworkSpeed)
|
||||
newNetwork.MBits = cfg.NetworkSpeed
|
||||
|
||||
@@ -16,14 +16,14 @@ func (f *NetworkFingerprint) linkSpeedSys(device string) int {
|
||||
// Read contents of the device/speed file
|
||||
content, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
f.logger.Printf("[WARN] fingerprint.network: Unable to read link speed from %s", path)
|
||||
f.logger.Printf("[DEBUG] fingerprint.network: Unable to read link speed from %s", path)
|
||||
return 0
|
||||
}
|
||||
|
||||
lines := strings.Split(string(content), "\n")
|
||||
mbs, err := strconv.Atoi(lines[0])
|
||||
if err != nil || mbs <= 0 {
|
||||
f.logger.Printf("[WARN] fingerprint.network: Unable to parse link speed from %s", path)
|
||||
f.logger.Printf("[DEBUG] fingerprint.network: Unable to parse link speed from %s", path)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user