Alex Dadgar
9497991590
Updated AWS speeds and network_speed now overrides
...
This PR:
* Makes AWS network speeds more granular
* Makes `network_speed` an override and not a default
* Adds a default of 1000 MBits if no network link speed is detected.
Fixes #1985
2016-11-15 13:55:51 -08:00
Alex Dadgar
92f526d902
Run environmental fingerprinters after host fingerprinters and do an override
2016-11-07 12:21:50 -08:00
Alex Dadgar
41b5679015
Advertise signalling abilities
2016-10-19 15:06:23 -07:00
Alex Dadgar
751aa114bf
Fix Vault parsing of booleans
2016-10-10 18:04:39 -07:00
Alex Dadgar
4a8fba5cf7
small fixes
2016-09-01 13:38:31 -07:00
Alex Dadgar
8ca3a16825
Fingerprint
2016-09-01 11:10:14 -07:00
Kenjiro Nakayama
71371fc592
tiny: Fix duplicated error message in CPU fingerprint
2016-08-07 12:49:40 +09:00
Michal Wieczorek
b6b3e24541
Link speed for windows network fingerprinting - tests
2016-07-22 22:49:03 +02:00
Michal Wieczorek
679fefc155
Link speed for windows network fingerprinting
2016-07-20 22:13:50 +02:00
Sean Chittenden
a9b3f5e552
Alpha-sort the build platforms
2016-07-11 12:23:46 -07:00
Sean Chittenden
267198742f
Merge branch 'master' into f-resource-isolation-fingerprinter
2016-07-11 12:23:09 -07:00
Sean Chittenden
20d87f1782
Remove cgroup fingerprinter from non-linux systems.
...
If someone wants to extend or reuse Cgroup detenction in the future they
can move `cgroup_linux.go` to `cgroup.go` and add the relevant build
tags.
Requested by: @dadgar
2016-07-11 12:16:56 -07:00
Alex Dadgar
f11b1ce079
Get windows to build
2016-07-11 11:52:41 -06:00
Sean Chittenden
9966169596
Merge branch 'f-resource-isolation-cleanup' into f-resource-isolation-fingerprinter
2016-07-11 00:10:21 -07:00
Sean Chittenden
f39e84b672
Improve readability: use of a switch vs two if's
2016-07-10 20:18:57 -07:00
Sean Chittenden
2ffbeee06c
Skip the network fingerprinter test when offline.
...
Conditionalize the network fingerprinter test so that it works when a
user is offline. Similarly, when the network fingerprint test fails in
the future pass a HINT to the user to set an env var to allow the test
to be skipped in the future.
2016-07-10 20:16:06 -07:00
Sean Chittenden
710173e9cb
Build the Cgroup fingerprinter on only Linux.
...
Change the logic from `!linux` to an empty build tag so that *if*
another platform picks up Cgroups support they can add themselves to the
necessary build tags for this fingerprinter and be on their way.
Because this technology isn't inherently Linux-specific and isn't
mutually exclusive of other resource isolation containers, resist the
urge to rename the Cgroup fingerprinter to something generic like the
ResourceContainerFingerprinter.
2016-07-10 13:55:06 -07:00
Sean Chittenden
bdd7022fdc
Centralize the fingerprintrs.
...
Add platform specific fingerprinters per platform.
Requested by: @diptanu
2016-07-09 22:31:14 -07:00
Sean Chittenden
1e2e0ca050
Initialize the list of available fingerprinters per platform.
2016-07-09 00:22:42 -07:00
Sean Chittenden
03c571c61b
Consolidate fingerprinters into a single `map`.
2016-07-08 23:37:14 -07:00
Jake Champlin
f094969c7b
Update failing tests
2016-06-23 11:28:17 -04:00
Alex Dadgar
14e950f882
Treat float as int
2016-06-22 15:09:39 -07:00
Alex Dadgar
4ff8edd2da
Floor CPU MHz and total compute and mark hostname as unique
2016-06-22 15:01:36 -07:00
Sean Chittenden
21b84fc3e6
Memoize the CPU stats. Error if CPU fingerprinting fails.
2016-06-17 12:13:53 -07:00
Sean Chittenden
686c125fea
Record and use only the first Mhz from the CPU fingerprinter.
...
Assume all cores are the same speed.
2016-06-17 11:06:57 -07:00
Sean Chittenden
4cc90753f8
In the debug log, split the unit from the measurement
...
awk(1) friendly is UNIX(tm) friendly.
2016-06-16 23:07:13 -07:00
Sean Chittenden
2dcb591cd8
Warn when we're unable to fingerprint the CPU Mhz
2016-06-16 23:07:13 -07:00
Sean Chittenden
b8e63411c0
Explicitly call `cpu.Counts()` to determine the CPU core count
...
Much safer than counting the number of InfoStat structs returned.
2016-06-16 23:07:13 -07:00
Sean Chittenden
ec77a1869e
Test for errors
2016-06-16 14:43:46 -07:00
Sean Chittenden
bcbec34937
Only actively test Consul when env `CONSUL_HTTP_ADDR` is set
2016-06-10 15:50:11 -04:00
Sean Chittenden
6fdf9135cb
Provide a default ConsulConfig for client/config.DefaultConfig()
...
Change the unit test to only test if the consul link exists, not the
value of the link. The old test was hostname specific and therefore
would always be different based on the environment running the tests.
2016-06-10 15:50:11 -04:00
Sean Chittenden
bff57a0dce
Reconcile, clean up, and centralize API version numbers (major and minor).
...
Reduce future confusion by introducing a minor version that is gossiped out
via the `mvn` Serf tag (Minor Version Number, `vsn` is already being used for
to communicate `Major Version Number`).
Background: hashicorp/consul/issues/1346#issuecomment-151663152
2016-06-10 15:50:11 -04:00
Sean Chittenden
e727fd8c3c
Centralize the creation of a consul/api.Config struct.
...
While documented, the consul.timeout parameter wasn't ever set
except one-off in the Consul fingerprinter.
2016-06-10 15:50:11 -04:00
Diptanu Choudhury
15d867d5f1
Updated gopsutil
2016-05-28 19:42:34 -07:00
Sean Chittenden
dc28ab0cb5
Speling police
2016-05-15 09:41:34 -07:00
Sean Chittenden
9fd4b82390
Establish a floor of one core for the number of cores.
...
In most cases the upstream library [shirou/gopsutil](https://github.com/shirou/gopsutil )
needs to be fixed.
2016-05-09 12:22:40 -07:00
Sean Chittenden
53d4681b61
Emit various debugging information with the results of the fingerprinter
2016-05-09 12:21:51 -07:00
Sean Chittenden
a2b71983c0
cgroups are a decidedly Linux-only feature. Build and test as such.
2016-05-09 11:56:35 -07:00
Sean Chittenden
8e88b11596
Decrease the log-level from WARN to DEBUG when fingerprinting GCE
...
This brings the logging here inline with the remaining fingerprinting code
2016-05-09 11:56:35 -07:00
Sean Chittenden
2ff8b10e05
Rename cgroup_universal.go to cgroup_default.go
...
Universal implies it is applicable to Linux, whereas default implies
the fallthrough for the non-Linux build targets.
2016-05-09 11:56:35 -07:00
Sean Chittenden
f8e9a759d3
Move network detection code to Linux-specific build
...
Non-Linux build targets get the current default of 0. This will allow
platform specific fingerprinting for network capabilities.
2016-05-09 11:56:35 -07:00
Sean Chittenden
f2e01f0eab
Stub out FreeBSD support for Nomad
...
Compiles, but is not functional (yet).
2016-05-09 11:56:35 -07:00
Troy Swanson
f16468c27a
Make logging more consistent
2016-04-15 15:42:57 -05:00
Alex Dadgar
aefa4b9207
add nomad fingerprinter
2016-03-22 17:12:30 -07:00
Alex Dadgar
4ce455be31
Merge pull request #712 from iverberk/f-cgroup-finterprinter
...
Add periodic cgroup fingerprinter
2016-01-29 08:50:43 -08:00
Ivo Verberk
22fef1766b
Add comments and small improvements to cgroup fingerprinter
2016-01-29 14:34:29 +01:00
Ivo Verberk
2921cf0d92
Fix comment
2016-01-27 10:56:35 +01:00
Ivo Verberk
5f86e28974
Add a periodic cgroup fingerprinter
2016-01-27 07:22:25 +01:00
Alex Dadgar
a85800188c
Respond to comments
2016-01-26 14:55:38 -08:00
Alex Dadgar
d5c77cd4a4
Update client fingerprinters
2016-01-26 10:08:01 -08:00
Abhishek Chanda
cd51ee6430
Handle non 200 codes while getting env metadata
2015-12-22 05:23:32 +00:00
Alex Dadgar
b943c6e278
Remove all calls to the default logger
2015-12-11 15:02:13 -08:00
Diptanu Choudhury
7bbf3b6497
Renaming constants
2015-12-11 13:47:35 -08:00
Diptanu Choudhury
6b43aa6753
Renaming constants
2015-12-11 13:18:04 -08:00
Diptanu Choudhury
7d6a687b95
Changed the log line in consul fingerprinter
2015-12-11 09:10:21 -08:00
Diptanu Choudhury
49d9d04025
Print consul debug messages only when the consul agent is available
2015-12-11 09:06:03 -08:00
Chris Hines
53ecc03022
Improve error messages.
2015-12-09 16:34:18 -05:00
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