64
64
TIMEOUT = 3
65
65
POST_URLS = []
66
66
DEFAULT_POST_URL = "https://ingest.signalfx.com/v1/collectd"
67
- VERSION = "0.0.26 "
67
+ VERSION = "0.0.27 "
68
68
MAX_LENGTH = 0
69
69
COLLECTD_VERSION = ""
70
70
LINUX_VERSION = ""
77
77
3600 + random .randint (0 , 60 ),
78
78
86400 + random .randint (0 , 600 )]
79
79
LAST = 0
80
- AWS = True
80
+ AWS = False
81
81
AWS_SET = False
82
82
PROCESS_INFO = True
83
83
DATAPOINTS = True
@@ -842,7 +842,7 @@ def plugin_config(conf):
842
842
log ("Cpu utilization per core has been enabled via configuration" )
843
843
844
844
collectd .register_read (send , INTERVAL )
845
- set_aws_url ( get_aws_info () )
845
+ get_aws_info ()
846
846
847
847
848
848
def compact (thing ):
@@ -1032,16 +1032,13 @@ def get_kernel_info(host_info={}):
1032
1032
def get_aws_info (host_info = {}):
1033
1033
"""
1034
1034
call into aws to get some information about the instance, timeout really
1035
- small for non aws systems and only try the once per startup
1035
+ small for non aws systems.
1036
1036
"""
1037
1037
global AWS
1038
- if not AWS :
1039
- return host_info
1040
-
1041
1038
url = "http://169.254.169.254/latest/dynamic/instance-identity/document"
1042
1039
try :
1043
1040
req = urllib2 .Request (url )
1044
- response = urllib2 .urlopen (req , timeout = 0.1 )
1041
+ response = urllib2 .urlopen (req , timeout = 0.2 )
1045
1042
identity = json .loads (response .read ())
1046
1043
want = {
1047
1044
'availability_zone' : 'availabilityZone' ,
@@ -1054,6 +1051,9 @@ def get_aws_info(host_info={}):
1054
1051
}
1055
1052
for k , v in iter (want .items ()):
1056
1053
host_info ["aws_" + k ] = identity [v ]
1054
+ AWS = True
1055
+ set_aws_url (host_info )
1056
+ log ("is an aws box" )
1057
1057
except :
1058
1058
log ("not an aws box" )
1059
1059
AWS = False
0 commit comments