site24x7_apminsight 1.8.6 → 1.8.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ require 'agent/version'
7
7
 
8
8
  module ManageEngine
9
9
  class APMConfig
10
- attr_reader :agenthost,:agentport,:instance_id,:alreadyconnected,:apmhost,:apmport,:license_key,:site24x7, :site24x7url, :hostType
10
+ attr_reader :agenthost,:agentport,:instance_id,:alreadyconnected,:apmhost,:apmport,:license_key,:site24x7, :site24x7url, :hostType,:delayedStart
11
11
  attr_reader :appname,:proxyneeded, :apdex_t, :trans_trace, :trans_trace_t, :sql_capture, :sql_capture_params, :sql_trace_t,:proxy_user,:proxy_pass, :metric_overflow_t, :trace_overflow_t, :dbmetric_overflow_t
12
12
  attr_reader :proxy_host,:proxy_port ,:is_secured, :logs_dir ,:connection_retry,:agent_enabled,:connect_interval,:db_operations,:txn_skip_listen, :url_merge_pattern
13
13
  attr_accessor :app_db,:app_dispatcher,:lastupdatedtime
@@ -24,7 +24,17 @@ 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 : @license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl : @license_key.start_with?('jp_') ? @obj.constants.site24x7JPurl : @obj.constants.site24x7USurl
27
+ @site24x7url = @license_key.start_with?('eu_') ? @obj.constants.site24x7EUurl :
28
+ @license_key.start_with?('cn_') ? @obj.constants.site24x7CNurl :
29
+ @license_key.start_with?('au_') ? @obj.constants.site24x7AUurl :
30
+ @license_key.start_with?('in_') ? @obj.constants.site24x7INurl :
31
+ @license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl :
32
+ @license_key.start_with?('jp_') ? @obj.constants.site24x7JPurl :
33
+ @license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl :
34
+ @license_key.start_with?('ca_') ? @obj.constants.site24x7CAurl :
35
+ @license_key.start_with?('sa_') ? @obj.constants.site24x7SAurl :
36
+ @license_key.start_with?('uk_') ? @obj.constants.site24x7UKurl :
37
+ @license_key.start_with?('in_hd_') ? @obj.constants.site24x7HDFCurl : @obj.constants.site24x7USurl
28
38
  end
29
39
  @db_operations =["select","insert","update","delete"]
30
40
  urlMergePattern
@@ -54,7 +64,7 @@ module ManageEngine
54
64
 
55
65
  def configureFile
56
66
  begin
57
- if(FileTest.exists?(@obj.constants.apm_conf))
67
+ if(FileTest.exist?(@obj.constants.apm_conf))
58
68
  #conf file exists in APPlication Home
59
69
  @obj.log.debug "Config File Exists. It is read from #{@obj.constants.apm_conf}"
60
70
  @config = @obj.util.readProperties(@obj.constants.apm_conf)
@@ -98,7 +108,7 @@ module ManageEngine
98
108
  end
99
109
 
100
110
  def checkAgentInfo
101
- if FileTest.exists?(@obj.constants.agent_conf)
111
+ if FileTest.exist?(@obj.constants.agent_conf)
102
112
  @obj.log.debug "Status : Agent Already Connected"
103
113
  props = @obj.util.readProperties(@obj.constants.agent_conf)
104
114
  instance_id = props["agent.id"]
@@ -134,7 +144,7 @@ module ManageEngine
134
144
  def urlMergePattern
135
145
  @url_merge_pattern = Hash.new
136
146
  begin
137
- if (FileTest.exists?(@obj.constants.mergepattern_conf))
147
+ if (FileTest.exist?(@obj.constants.mergepattern_conf))
138
148
  @url_merge_pattern=@obj.util.readProperties(@obj.constants.mergepattern_conf)
139
149
  end
140
150
  rescue Exception => e
@@ -171,6 +181,7 @@ module ManageEngine
171
181
  @dbmetric_overflow_t=500
172
182
  @trace_overflow_t=30
173
183
  @site24x7url = @obj.constants.site24x7USurl #default agent communication URL
184
+ @delayedStart = false
174
185
  end
175
186
 
176
187
  def assignConfig
@@ -212,6 +223,7 @@ module ManageEngine
212
223
  when "metricstore.metric.bucket.size" then @metric_overflow_t = isInteger(@metric_overflow_t, value)
213
224
  when "metricstore.dbmetric.bucket.size" then @dbmetric_overflow_t = isInteger(@dbmetric_overflow_t, value)
214
225
  when "transaction.tracestore.size" then @trace_overflow_t = isInteger(@trace_overflow_t, value)
226
+ when "agent.delay.start" then @delayedStart=@obj.util.getBooleanValue value
215
227
  end
216
228
  end
217
229
  store_encrypted_data(@config)
@@ -298,6 +310,14 @@ module ManageEngine
298
310
  if (@hostType != nil)
299
311
  agentdata["host.type"]=@hostType
300
312
  end
313
+ begin
314
+ fqdn = Addrinfo.getaddrinfo(Socket.gethostname, nil).first.getnameinfo.first
315
+ if (fqdn != nil)
316
+ agentdata["fqdn"] = fqdn
317
+ end
318
+ rescue Exception=>e
319
+ @obj.log.warn("Unable to get fqdn value #{e.message}")
320
+ end
301
321
  data["agent_info"]=agentdata
302
322
  data["environment"]=getEnvData
303
323
  data["custom_config_info"]=getAgentConfigData
@@ -40,7 +40,7 @@ module ManageEngine
40
40
  def getLogsPath
41
41
  props = {}
42
42
  begin
43
- if FileTest.exists?(@obj.constants.apm_conf)
43
+ if FileTest.exist?(@obj.constants.apm_conf)
44
44
  propsFile=File.open(@obj.constants.apm_conf, 'r')
45
45
  propsFile.read.each_line do |line|
46
46
  line.strip!
@@ -9,7 +9,16 @@ module ManageEngine
9
9
  def initialize
10
10
  @obj = ManageEngine::APMObjectHolder.instance
11
11
  @obj.log.debug "Agent Initialization - START"
12
- doConnect
12
+ if @obj.config.delayedStart
13
+ @obj.log.info "Delaying agent handshake as per configuration.."
14
+ @obj.agent_initialized = true # to be reset when connecting
15
+ @apm = Thread.new do
16
+ sleep ((@obj.config.connect_interval).to_i)/2
17
+ doConnect
18
+ end
19
+ else
20
+ doConnect
21
+ end
13
22
 
14
23
  if !@obj.shutdown && @obj.agent_initialized
15
24
  @obj.log.info "Agent Initialization - DONE"
@@ -26,12 +35,12 @@ module ManageEngine
26
35
  #@obj.instrumenter.doUnSubscribe
27
36
  @obj.shutdownagent
28
37
  end
29
-
30
-
31
- end
38
+ end
32
39
 
33
40
  def doConnect
34
41
  begin
42
+ @obj.agent_initialized=false #resetting, to go with the flow
43
+
35
44
  if @obj.shutdown
36
45
  @obj.log.info "[ Problem in Agent Startup ]"
37
46
  else
@@ -19,7 +19,7 @@ module ManageEngine
19
19
 
20
20
  u = url uri
21
21
  #@obj.log.info "[connector] [ POST] START"
22
- @obj.log.debug "[connector] [ POST] : \n\n#{u}\n\n#{data}\n\n"
22
+ @obj.log.debug "[connector] [ POST] : #{u}\n#{data}"
23
23
  con = connection(u)
24
24
  req = Net::HTTP::Post.new(u.request_uri,initheader = {'Content-Type' =>'application/json'})
25
25
  req.body=data.to_json
@@ -23,10 +23,10 @@ class APMWorker
23
23
  @apm = Thread.new do
24
24
  @status = 'working'
25
25
  while !@obj.shutdown do
26
+ sleep (@obj.config.connect_interval).to_i
26
27
  checkforagentstatus
27
28
  updateConfig
28
29
  dc
29
- sleep (@obj.config.connect_interval).to_i
30
30
  end#w
31
31
  @status= "end"
32
32
  @obj.log.debug "Worker thread ends"
@@ -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, :site24x7GDurl, :site24x7JPurl
6
+ attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl, :site24x7GDurl, :site24x7JPurl, :site24x7CAurl, :site24x7SAurl, :site24x7UKurl, :site24x7HDFCurl
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
@@ -57,6 +57,10 @@ module ManageEngine
57
57
  @site24x7INurl = "https://plusinsight.site24x7.in/"
58
58
  @site24x7GDurl = "https://gdplusinsight.site24x7.com/"
59
59
  @site24x7JPurl = "https://plusinsight.site24x7.jp/"
60
+ @site24x7CAurl = "https://plusinsight.site24x7.ca/"
61
+ @site24x7SAurl = "https://plusinsight.site24x7.sa/"
62
+ @site24x7UKurl = "https://plusinsight.site24x7.uk/"
63
+ @site24x7HDFCurl = "https://hdplusinsight.site24x7.in/"
60
64
 
61
65
  #Response Codes
62
66
  @licence_expired = 701
@@ -50,22 +50,21 @@ module ManageEngine
50
50
  props = {}
51
51
  begin
52
52
  propsFile=File.open(filepath, 'r')
53
- propsFile.read.each_line do |line|
54
- line.strip!
55
- if (line[0] != ?# and line[0] != ?=)
56
- i = line.index('=')
57
- if (i)
58
- props[line[0..i - 1].strip] = line[i + 1..-1].strip
59
- else
60
- props[line] = ''
61
- end
62
- end
63
- end
53
+ propsFile.read.each_line do |line|
54
+ line.strip!
55
+ if (line[0] != ?# and line[0] != ?=)
56
+ i = line.index('=')
57
+ if (i)
58
+ props[line[0..i - 1].strip] = line[i + 1..-1].strip
59
+ else
60
+ props[line] = ''
61
+ end
62
+ end
63
+ end
64
+ propsFile.close
64
65
  rescue Exception=>e
65
66
  @log.info "Problem in Reading Property File : #{e.message} "
66
67
  @log.error "#{e.backtrace}"
67
- ensure
68
- propsFile.close
69
68
  end
70
69
  props
71
70
  end
data/lib/agent/version.rb CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  module ManageEngine
8
8
  class APMInsight
9
- VERSION = '1.8.6'
9
+ VERSION = '1.8.8'
10
10
  MAJOR_VERSION = '1.8'
11
- MINOR_VERSION = '6'
11
+ MINOR_VERSION = '8'
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
- - 6
9
- version: 1.8.6
8
+ - 8
9
+ version: 1.8.8
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: 2022-08-26 00:00:00 +05:30
17
+ date: 2024-01-31 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency