Commit Graph

220 Commits

Author SHA1 Message Date
Chris Hines 6697980331 Use GetDiskFreeSpaceEx instead of parsing output of fsutil on Windows. 2015-11-30 16:43:25 -05:00
Alex Dadgar b2daa5e2e6 Standardize log messages in fingerprinters to DEBUG 2015-11-24 11:06:51 -08:00
Alex Dadgar 6e59527a97 Clear consul attributes if consul couldn't be fingerprinted 2015-11-22 13:51:10 -08:00
Alex Dadgar 77d86d5bb0 Fingerprinter only creates one consul client 2015-11-22 13:42:06 -08:00
Alex Dadgar a352c0fc69 Fix network fingerprint test 2015-11-19 09:22:32 -08:00
Alex Dadgar cf4a44352f Allow no interfaces in network fingerprinter 2015-11-18 19:01:39 -08:00
Guillaume Jacquet 4a3e709eef Fix AWS metadata url
Fix URL. It was printing an error message on startup:
```
2015/11/13 15:49:21 [ERR] fingerprint.env_aws: Error querying AWS Metadata URL, skipping
```

By the way is it safe to use latest? Is there a chance that Amazon decides to change the format of the metadata? It could be safer to use something like `http://169.254.169.254/2014-11-05/meta-data`
2015-11-13 11:03:05 -05:00
Alex Dadgar 7c6b80a8fd Merge pull request #400 from nak3/fingerprint-test
Update fingerprint test codes
2015-11-10 17:06:16 -08:00
Kenjiro Nakayama 658118ed5f Update fingerprint test codes 2015-11-07 23:16:43 +09:00
Chris Bednarski 2719c4ffd7 Merge branch 'master' into f-windows-networking 2015-11-06 13:32:28 -08:00
Alex Dadgar 5f1b6e70b0 Client handles periodic fingerprinters 2015-11-05 13:46:17 -08:00
Alex Dadgar 5f84878ffb Add consul fingerprinter to builtin list; sort list; fix bad error in consul fingerprinter 2015-11-05 13:46:16 -08:00
Alex Dadgar f9fd83c696 Merge fix 2015-11-05 13:46:02 -08:00
Kenjiro Nakayama 21f537339e Use const value for AWS metadata URL 2015-11-04 00:06:14 +09:00
Chris Bednarski a67a78a2d9 Use the same network fingerprinter for *nix and windows 2015-10-30 16:48:02 -07:00
Diptanu Choudhury e55bbe5f2c Refactored code 2015-10-29 16:16:10 -07:00
Diptanu Choudhury 17d430e46c Renamed BasicNetworkInterfaceDetector to DefaultNetworkInterfaceDetector 2015-10-29 15:55:49 -07:00
Diptanu Choudhury 1360f8c6fa Fixed a debug message 2015-10-29 15:17:40 -07:00
Diptanu Choudhury d31f567484 Fixed style of a debug log 2015-10-29 15:15:44 -07:00
Diptanu Choudhury 08302d43ee Added a test to ensure we are not selecting devices which are not marked as UP or loopback and have no IP addresses 2015-10-29 15:14:13 -07:00
Diptanu Choudhury b048919b63 Added some coments 2015-10-29 11:05:58 -07:00
Diptanu Choudhury 6400273cf8 Added tests for testing detecting default device 2015-10-29 11:01:15 -07:00
Diptanu Choudhury b78c00f255 Introduced an interface to detect network devices so that we can mock it for tests 2015-10-28 15:58:40 -07:00
Diptanu Choudhury f0e445d8f5 Refactored the findInterfaces method to make it more clear 2015-10-28 15:48:08 -07:00
Diptanu Choudhury a3d79ec589 Some coding style changes 2015-10-28 15:03:11 -07:00
Diptanu Choudhury 9b86b2313f We don't want lo and PPP in production 2015-10-28 14:44:46 -07:00
Diptanu Choudhury df5efd1e24 Added more information to log 2015-10-28 14:41:13 -07:00
Diptanu Choudhury 58bf6047a7 Adding more information to errors 2015-10-28 14:32:13 -07:00
Diptanu Choudhury 2464789b73 Added more comments 2015-10-28 14:03:33 -07:00
Diptanu Choudhury 915be5e86c Selecting the ipv4 address if there are ipv4 and ipv6 addresses configured for an interface 2015-10-28 13:38:28 -07:00
Diptanu Choudhury fffb0ed5ae Exctracted a method to detect network interface 2015-10-28 11:11:13 -07:00
Diptanu Choudhury 7a15cf0e45 Fix merge conflicts 2015-10-28 08:54:29 -07:00
Kenjiro Nakayama a79ae3c546 Assign IP when network device is specified 2015-10-28 21:19:06 +09:00
Diptanu Choudhury 809f360743 Using the Go stdlib APIs to detect IP Address of a device 2015-10-27 14:14:25 -07:00
Kenjiro Nakayama e688dc3826 Set default network interface rather than eth0 for non-dev mode, and use loopback device for dev mode by default 2015-10-28 02:03:48 +09:00
Kenjiro Nakayama fa005d75fa Set default network interface rather than eth0 2015-10-25 23:32:54 +09:00
Jeff Mitchell 959c175ca1 Update the location of cleanhttp 2015-10-22 14:21:07 -04:00
Jeff Mitchell cea5fd9081 Use cleanhttp for truly clean clients and transports. 2015-10-22 10:58:23 -04:00
Alex Dadgar 1d15f6eda6 Bind alloc dir and task local dir to docker containers and parse args correctly 2015-10-15 16:40:07 -07:00
Abhishek Chanda 953bd8b53f Trim extra newline from kernel version 2015-10-15 00:54:21 -07:00
Alex Dadgar 76ec48bfce Merge pull request #215 from Carevoyance/gce_fingerprint
Add GCE fingerprinting functionality
2015-10-12 16:14:32 -07:00
Daniel Imfeld c9c8dee48e More syntax cleanup 2015-10-12 17:57:45 -05:00
Daniel Imfeld 9730df8411 Fix old comments and other syntax cleanup 2015-10-12 16:56:33 -05:00
Daniel Imfeld 9f58d85762 GCE fingerprinter no longer updates network resources
It has nothing to add that the generic fingerprinters aren't
finding on their own already.
2015-10-09 18:34:57 -05:00
Daniel Imfeld cbe349b8b4 Add a few more GCE-specific attributes:
* cpu-platform
* scheduling.automatic-restart
* scheduling.on-host-maintenance
* network.NETWORKNAME=true
2015-10-09 09:10:40 -05:00
Alex Dadgar 8130510a5a Fix AWS Networking Fingerprint tests failing when actually on AWS 2015-10-08 12:49:43 -07:00
Daniel Imfeld d66e78c5ca Parse information for all GCE network interface.
* No longer setting Device name in the network interface since we can't
match up the info here with real device names.
* Add attributes for all external IPs if more than one exists.
2015-10-07 13:35:20 -05:00
Daniel Imfeld 70350aead9 Compact tags and attribute reading code. 2015-10-07 12:39:23 -05:00
Ivo Verberk c6e1b13b51 Fix vet warnings 2015-10-07 12:26:58 +02:00
Daniel Imfeld dc1c8e5273 TestNetworkFingerprint_notAWS passes even when actually on AWS 2015-10-06 21:21:42 -05:00
Daniel Imfeld 892cad6775 NonXXX tests should pass when actually running in their respective environments.
Fixes #224
2015-10-06 21:16:28 -05:00
Daniel Imfeld 32d5c61779 Consolidate GCEMetadataClient into EnvGCEFingerprint
This allows easier reuse of the same client across multiple functions.
2015-10-05 13:13:25 -05:00
Daniel Imfeld a85dda68fe And add a comment to the constant. 2015-10-05 12:59:02 -05:00
Daniel Imfeld adbb23e267 Use a constant for the default GCE metadata URL 2015-10-05 12:57:45 -05:00
Daniel Imfeld 46bbfc3549 isAWS should return false on GCE
GCE and AWS both expose metadata servers, and GCE's 404 response
includes the URL in the content, which maatches the regex. So,
check the response code as well and if a 4xx code comes back,
take that to meanit's not AWS.
2015-10-05 00:42:34 -05:00
Daniel Imfeld a43a262e66 Fingerprinting code for GCE nodes
This reads the following:

* hostname
* instance id
* machine-type
* zone
* internal IP
* external IP (if any)
* tags
* attributes

Atributes are placed under the platform.gce.attr.* hierarchy.

Tags are set up as platform.gce.tag.TagName=true.
2015-10-05 00:40:43 -05:00
Alex Dadgar e60e6ff8f5 Add debug line when setting link speed to default 2015-10-02 17:32:17 -07:00
Alex Dadgar 4cc8588cb5 Merges 2015-10-02 17:32:11 -07:00
Antoine POPINEAU f35ebe14ad Merge branch 'master' into dev/net-fingerprint 2015-10-02 09:38:35 +02:00
Antoine POPINEAU 36daef1625 Renamed all instances of `Iface` to `NetworkInterface`. 2015-10-02 09:29:18 +02:00
Antoine POPINEAU 3a4b304a53 Refactored code. 2015-10-01 21:16:39 +02:00
Antoine POPINEAU 2e1488fb04 Comment some undocumented code. 2015-10-01 20:39:10 +02:00
Ryan Uber 836fd8a015 Merge pull request #153 from aldergren/master
Prevent df on linux from adding line breaks to output
2015-10-01 11:21:02 -07:00
Antoine POPINEAU b01912abdc Forgot some error checking. 2015-10-01 17:33:40 +02:00
Antoine POPINEAU 70d34da1bc Client config param added to specify net iface to use for fingerprinting. Added a Golang-native method for determining the interface IP address. 2015-10-01 17:31:47 +02:00
Orivej Desh 443d2deb32 Update obsolete comments 2015-09-29 20:33:11 +00:00
Orivej Desh d844997661 Fix "ifconfig not found" warning 2015-09-29 20:06:37 +00:00
Niklas Aldergren 9145d8ffb9 Prevent df on linux from adding line breaks to output 2015-09-29 13:23:41 +02:00
Orivej Desh 4ecf7a0f74 Improve link speed fingerprint error reporting
With disconnected eth0 log output now looks like:

[WARN] fingerprint.network: Unable to parse IP in output of '/bin/ifconfig eth0'
[WARN] fingerprint.network: Unable to parse Speed in output of '/usr/sbin/ethtool eth0'

In a virtual machine:

[WARN] fingerprint.network: Unable to parse Speed in output of '/sbin/ethtool eth0'
[WARN] fingerprint.network: Unable to read link speed from /sys/class/net/eth0/speed
2015-09-28 23:34:25 +00:00
Mitchell Hashimoto 690634d245 client: fix windows build errors 2015-09-27 23:53:25 -07:00
Armon Dadgar 8aa2c292a0 Merge pull request #77 from hashicorp/f-network-fingerprint
Network Fingerprinting
2015-09-23 14:36:29 -07:00
Clint Shryock 491f2d927f clean up some log formatting 2015-09-23 14:09:55 -05:00
Armon Dadgar b213462cb4 Change CPU from float64 to int 2015-09-23 11:14:32 -07:00
Clint Shryock 8c0542a9af Refactor network fingerprinting to be generic, use build flags 2015-09-23 10:12:56 -05:00
Clint Shryock 61d695b7d4 prefix warn/error messages 2015-09-23 10:03:35 -05:00
Clint Shryock e4a8565f00 fix casing for ERR logs 2015-09-23 10:00:06 -05:00
Clint Shryock c84d51a9d1 don't re-convert mbits 2015-09-22 23:57:24 -05:00
Clint Shryock f876ed6673 refactoring, docs 2015-09-22 23:51:56 -05:00
Clint Shryock f60bbbfd15 populate node network resource 2015-09-22 23:22:23 -05:00
Clint Shryock e3c8ca8462 Update code for parsing IP address 2015-09-22 22:56:31 -05:00
Clint Shryock c615c560d2 Move ec2InstanceSpeed to a package variable, convert to string:int map 2015-09-22 22:04:20 -05:00
Clint Shryock 5c749e1ffb Consolidate the AWS fingerprinters 2015-09-22 16:56:04 -05:00
Clint Shryock 2bbf080666 Refactor some AWS things, removing fingerprint/network.go
- move isAWS to env, use in other places
- fingerprint/network.go is no empty; removed
2015-09-22 16:31:57 -05:00
Clint Shryock b44c911996 change the naming 2015-09-22 16:01:29 -05:00
Clint Shryock a9cf7381ca Refactor the Network Fingerprinters 2015-09-22 15:59:00 -05:00
Clint Shryock f048326300 Rework client/fingerprint/fingerprint.go to use a slice and enforce ordering 2015-09-22 14:23:48 -05:00
Clint Shryock d11bd582f7 Basic network fingerprinting for Unix type, AWS systems 2015-09-22 11:44:53 -05:00
Armon Dadgar c7773feced nomad: improve error messages at start for dev mode 2015-09-06 20:18:47 -07:00
Chris Bednarski d9d78d6b2c Add working test for consul fingerprinter 2015-08-31 19:56:38 -07:00
Chris Bednarski ab0deab3e5 Made consul fingerprinter configurable 2015-08-31 19:56:25 -07:00
Chris Bednarski ff5266ad8f Add consul data to node.Links 2015-08-31 16:04:48 -07:00
Chris Bednarski a033bedbaf Added basic consul functionality; currently hard-coded to a test instance 2015-08-31 16:04:48 -07:00
Clint Shryock 1e652cc4e9 fingerprint/env_aws: Rename ec2-instance link to aws.ec2, drop ami link 2015-08-31 15:02:31 -05:00
Clint Shryock 416e7de06d fingerprint/aws: Add 2 basic links, rename 'env' to 'platform' 2015-08-31 14:18:40 -05:00
Clint Shryock ae1142ad33 cleanups 2015-08-28 13:09:21 -05:00
Clint Shryock dc217da84a spike on AWS ENV fingerprint 2015-08-28 11:33:41 -05:00
Chris Bednarski 9b8fc07bbe Drop os fingerprint since this is redundant with host 2015-08-27 17:37:56 -07:00
Chris Bednarski 94235e3448 Change 'os' to 'kernel.name'; add 'kernel.version' for *nix* 2015-08-27 17:37:37 -07:00
Chris Bednarski ced2f647c6 Add guard to storage fingerprint so CWD will be used if AllocDir is not specified -- fixes windows tests 2015-08-27 16:03:09 -07:00
Chris Bednarski d0a091c952 Add the storage fingerprinter to the list of built-ins 2015-08-27 14:30:41 -07:00
Chris Bednarski 0437a02fd7 Change column constraint so this is compatible with darwin and linux 2015-08-27 14:30:20 -07:00
Clint c6cdf014fd Merge pull request #7 from hashicorp/memory-fingerprint
Add a memory fingerprint
2015-08-27 16:11:44 -05:00
Clint Shryock b223278b6f convert to MB for MemoryMB, and update test 2015-08-27 16:01:47 -05:00
Chris Bednarski 6123ba8b83 Get average frequency of all CPUs so we can do average frequency * cores for total compute 2015-08-27 13:35:54 -07:00
Clint Shryock 759d3131f2 Merge remote-tracking branch 'upstream/master' into memory-fingerprint
* upstream/master:
  Prevent a panic if the df tool output is not in the expected format
  Change 'available' to 'free' because it's shorter; also initialize node.Resources.DiskMB as total disk instead of available disk
  Changed logs to errors; added data to node.Resources.DiskMB
  populate CPU in Node Resources
  Fix arity in log call for TCP resolution failure
  Add storage fingerprinter
2015-08-27 15:30:00 -05:00
Clint e3348ad809 Merge pull request #6 from hashicorp/cpu-resources
populate CPU in Node Resources
2015-08-27 15:26:00 -05:00
Clint Shryock 83a792593e Add a memory fingerprint, just grabs memory 2015-08-27 15:19:19 -05:00
Chris Bednarski 78767f0ff4 Merge pull request #4 from hashicorp/f-storage-fingerprint
Add storage fingerprinter
2015-08-27 12:43:18 -07:00
Chris Bednarski 8e544e0969 Prevent a panic if the df tool output is not in the expected format 2015-08-27 12:42:58 -07:00
Chris Bednarski 66b518cd6c Change 'available' to 'free' because it's shorter; also initialize node.Resources.DiskMB as total disk instead of available disk 2015-08-27 12:37:05 -07:00
Chris Bednarski d17c6128c8 Changed logs to errors; added data to node.Resources.DiskMB 2015-08-27 12:23:17 -07:00
Clint Shryock 58be8ba139 populate CPU in Node Resources 2015-08-27 14:15:56 -05:00
Clint Shryock cacb8074d3 Add cpu.frequency, cpu.totalcompute 2015-08-27 09:19:53 -05:00
Chris Bednarski edea3700a4 Add storage fingerprinter
Breaking change: Added ID() to Fingerprint interface. This allows us to assign
each fingerprint implementation a unique ID, identify which fingerprinters have
been run, and also self-identify in log messages.

- Added storage fingerprinter for Windows and *nix
- Added storage tests under storage_test.go
- Added test helper functions under fingerprint/fingerprint_test.go
- Added ID() to existing finterprinters and drivers
- Added Fingerprint.ID() to log messages via log.SetPrefix()
2015-08-26 17:17:08 -07:00
Clint Shryock 9a92383b69 refactor into multiple fingerprints 2015-08-26 16:29:18 -05:00
Clint Shryock 8ab31da8b0 update fingerprint with more cpu, some host info 2015-08-26 15:20:07 -05:00
Clint Shryock d2318f71f1 Fingerprint CPU model name, count of cores 2015-08-26 11:32:30 -05:00
Chris Bednarski 0b255c6af6 Pass config to fingerprints; update tests 2015-08-25 16:21:29 -07:00
Armon Dadgar 88438619c8 fingerprint: adding arch fingerprint 2015-08-20 16:29:19 -07:00
Armon Dadgar f20b361d89 fingerprint: adding simple package 2015-08-20 16:26:32 -07:00