site24x7_apminsight 1.8.3 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ module ManageEngine
24
24
  @alreadyconnected = checkAgentInfo
25
25
  @site24x7 = checkLicenseFile
26
26
  if (@site24x7)
27
- @site24x7url = @license_key.start_with?('eu_') ? @obj.constants.site24x7EUurl : @license_key.start_with?('cn_') ? @obj.constants.site24x7CNurl : @license_key.start_with?('au_') ? @obj.constants.site24x7AUurl : @license_key.start_with?('in_') ? @obj.constants.site24x7INurl : @obj.constants.site24x7USurl
27
+ @site24x7url = @license_key.start_with?('eu_') ? @obj.constants.site24x7EUurl : @license_key.start_with?('cn_') ? @obj.constants.site24x7CNurl : @license_key.start_with?('au_') ? @obj.constants.site24x7AUurl : @license_key.start_with?('in_') ? @obj.constants.site24x7INurl : @license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl : @obj.constants.site24x7USurl
28
28
  end
29
29
  @db_operations =["select","insert","update","delete"]
30
30
  urlMergePattern
@@ -58,6 +58,7 @@ module ManageEngine
58
58
  #conf file exists in APPlication Home
59
59
  @obj.log.debug "Config File Exists. It is read from #{@obj.constants.apm_conf}"
60
60
  @config = @obj.util.readProperties(@obj.constants.apm_conf)
61
+ secureConfFile "#{@obj.constants.apm_conf}"
61
62
  else
62
63
  gemSpecs = Gem.loaded_specs[@obj.constants.s247_apm_gem]
63
64
  if (gemSpecs == nil)
@@ -72,13 +73,14 @@ module ManageEngine
72
73
  #copied sucessfully
73
74
  @obj.log.info "Config File copied to application home directory. It is read from #{@obj.constants.apm_conf}"
74
75
  @config = @obj.util.readProperties(@obj.constants.apm_conf)
76
+ secureConfFile "#{@obj.constants.apm_conf}"
75
77
  else
76
78
  #Problem in copying, so reading props from Conf file in Gem Location
77
79
  @obj.log.warn "Config File not copied. It is read from #{gem_conf}"
78
80
  @config = @obj.util.readProperties(gem_conf)
81
+ secureConfFile gem_conf
79
82
  end
80
83
  end
81
-
82
84
  rescue Exception=>e
83
85
  @obj.log.info "[Exception] Problem in Reading Configuration File : \n File : #{@obj.constants.apm_conf}"
84
86
  @obj.log.logException "#{e.message}",e
@@ -87,6 +89,14 @@ module ManageEngine
87
89
  end
88
90
  end
89
91
 
92
+ def secureConfFile(file)
93
+ begin
94
+ File.chmod(0600, file)
95
+ rescue Exception => e
96
+ @obj.log.warn "Unable to secure the conf file #{file}"
97
+ end
98
+ end
99
+
90
100
  def checkAgentInfo
91
101
  if FileTest.exists?(@obj.constants.agent_conf)
92
102
  @obj.log.debug "Status : Agent Already Connected"
@@ -138,6 +148,8 @@ module ManageEngine
138
148
  @instance_id = props["agent.id"]
139
149
  @agent_enabled= @obj.util.getBooleanValue props["agent.enabled"]
140
150
  @obj.util.writeProperties(@obj.constants.agent_conf,props)
151
+
152
+ secureConfFile(@obj.constants.agent_conf)
141
153
  end
142
154
 
143
155
  def initValues
@@ -246,8 +258,7 @@ module ManageEngine
246
258
  def getHostType
247
259
  begin
248
260
  # Check for AWS environment
249
- # response = Net::HTTP.get_response(URI('http://169.254.169.254/latest/meta-data/'))
250
- url = URI.parse('http://169.254.169.254/latest/meta-data/')
261
+ url = URI.parse('http://169.254.169.254/latest/meta-data/') # AWS metadata url
251
262
  request = Net::HTTP::Get.new(url.path)
252
263
  response = Net::HTTP.start(url.host, url.port, :read_timeout => 2) {|http| http.request(request)}
253
264
  if (response.kind_of? Net::HTTPOK)
@@ -259,8 +270,7 @@ module ManageEngine
259
270
 
260
271
  begin
261
272
  #Check for Azure environment
262
- # response = Net::HTTP.get_response(URI('http://169.254.169.254/metadata/v1/maintenance'))
263
- url = URI.parse('http://169.254.169.254/metadata/v1/maintenance')
273
+ url = URI.parse('http://169.254.169.254/metadata/v1/maintenance') # Azure metadata url
264
274
  request = Net::HTTP::Get.new(url.path)
265
275
  response = Net::HTTP.start(url.host, url.port, :read_timeout => 2) {|http| http.request(request)}
266
276
  if (response.kind_of? Net::HTTPOK)
@@ -270,6 +280,15 @@ module ManageEngine
270
280
  rescue Exception => e
271
281
  end
272
282
 
283
+ begin
284
+ # Check for Heroku env. In the backgroud it is using AWS EC2, hence sending as AWS
285
+ if (ENV.has_key?('DYNO') || ENV.has_key?('STACK'))
286
+ @hostType = "AWS"
287
+ return @hostType
288
+ end
289
+ rescue Exception => e
290
+ end
291
+
273
292
  @hostType = nil
274
293
  end
275
294
 
@@ -3,7 +3,7 @@ module ManageEngine
3
3
  class APMConstants
4
4
 
5
5
  attr_reader :conf_location, :apm_gem,:s247_apm_gem,:apm_conf,:agent_conf,:connection_open_timeout,:connection_read_timeout,:connect_uri,:connect_data_uri,:connect_trace_uri,:connect_config_update_uri,:mergepattern_conf
6
- attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl
6
+ attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl, :site24x7GDurl
7
7
  attr_reader :licence_exceeds,:licence_expired,:unmanage_agent,:manage_agent,:agent_config_updated,:error_notfound,:error_server,:delete_agent,:response_code,:custom_config_info, :agent_specific_info
8
8
  attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
9
9
  attr_reader :mf_logmetric, :mf_logmetric_warning, :mf_exception_st, :mf_err_st, :mf_loginfo, :mf_loginfo_time, :mf_loginfo_level, :mf_loginfo_str, :mf_loginfo_err_clz, :mf_loginfo_st, :mf_loginfo_level_warn
@@ -55,6 +55,7 @@ module ManageEngine
55
55
  @site24x7CNurl = "https://plusinsight.site24x7.cn/"
56
56
  @site24x7AUurl = "https://plusinsight.site24x7.net.au/"
57
57
  @site24x7INurl = "https://plusinsight.site24x7.in/"
58
+ @site24x7GDurl = "https://gdplusinsight.site24x7.com/"
58
59
 
59
60
  #Response Codes
60
61
  @licence_expired = 701
data/lib/agent/version.rb CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  module ManageEngine
8
8
  class APMInsight
9
- VERSION = '1.8.3'
9
+ VERSION = '1.8.5'
10
10
  MAJOR_VERSION = '1.8'
11
- MINOR_VERSION = '3'
11
+ MINOR_VERSION = '5'
12
12
  end
13
13
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 8
8
- - 3
9
- version: 1.8.3
8
+ - 5
9
+ version: 1.8.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adithyan P
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2021-03-23 00:00:00 +05:30
17
+ date: 2021-06-29 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency