site24x7_apminsight 1.8.5.1 → 1.8.7

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,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 : @license_key.start_with?('gd_') ? @obj.constants.site24x7GDurl : @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 : @license_key.start_with?('jp_') ? @obj.constants.site24x7JPurl : @obj.constants.site24x7USurl
28
28
  end
29
29
  @db_operations =["select","insert","update","delete"]
30
30
  urlMergePattern
@@ -54,7 +54,7 @@ module ManageEngine
54
54
 
55
55
  def configureFile
56
56
  begin
57
- if(FileTest.exists?(@obj.constants.apm_conf))
57
+ if(FileTest.exist?(@obj.constants.apm_conf))
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)
@@ -98,7 +98,7 @@ module ManageEngine
98
98
  end
99
99
 
100
100
  def checkAgentInfo
101
- if FileTest.exists?(@obj.constants.agent_conf)
101
+ if FileTest.exist?(@obj.constants.agent_conf)
102
102
  @obj.log.debug "Status : Agent Already Connected"
103
103
  props = @obj.util.readProperties(@obj.constants.agent_conf)
104
104
  instance_id = props["agent.id"]
@@ -121,21 +121,20 @@ module ManageEngine
121
121
  end
122
122
 
123
123
  def checkLicenseFile
124
- if(@license_key != nil)
125
- @obj.log.info "License key is not null. Connecting to site24x7"
126
- @obj.constants.setLicenseKey @license_key
127
- true
128
- else
129
- @obj.log.info "License key is null. Connecting to APPManager"
130
- false
131
- end
132
-
124
+ @obj.constants.setLicenseKey @license_key
125
+ if(@license_key.start_with?('APMI_'))
126
+ @obj.log.info "Connecting to App Manager"
127
+ false
128
+ else
129
+ @obj.log.info "Connecting to Site24x7"
130
+ true
131
+ end
133
132
  end
134
133
 
135
134
  def urlMergePattern
136
135
  @url_merge_pattern = Hash.new
137
136
  begin
138
- if (FileTest.exists?(@obj.constants.mergepattern_conf))
137
+ if (FileTest.exist?(@obj.constants.mergepattern_conf))
139
138
  @url_merge_pattern=@obj.util.readProperties(@obj.constants.mergepattern_conf)
140
139
  end
141
140
  rescue Exception => e
@@ -172,6 +171,7 @@ module ManageEngine
172
171
  @dbmetric_overflow_t=500
173
172
  @trace_overflow_t=30
174
173
  @site24x7url = @obj.constants.site24x7USurl #default agent communication URL
174
+ @delayedStart = false
175
175
  end
176
176
 
177
177
  def assignConfig
@@ -213,6 +213,7 @@ module ManageEngine
213
213
  when "metricstore.metric.bucket.size" then @metric_overflow_t = isInteger(@metric_overflow_t, value)
214
214
  when "metricstore.dbmetric.bucket.size" then @dbmetric_overflow_t = isInteger(@dbmetric_overflow_t, value)
215
215
  when "transaction.tracestore.size" then @trace_overflow_t = isInteger(@trace_overflow_t, value)
216
+ when "agent.delay.start" then @delayedStart=@obj.util.getBooleanValue value
216
217
  end
217
218
  end
218
219
  store_encrypted_data(@config)
@@ -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
@@ -39,17 +48,20 @@ module ManageEngine
39
48
  resp = nil
40
49
  if @obj.config.alreadyconnected
41
50
  @obj.log.debug "[doConnect] Already Connected - Make Contact - Instance id = #{@obj.config.instance_id}"
42
- if @obj.config.site24x7
43
- resp = startConnect "?license.key="+@obj.config.license_key+"&instance_id="+@obj.config.instance_id,agentInfo
44
- else
45
- resp = startConnect "?instance_id="+@obj.config.instance_id,agentInfo
46
- end
51
+ resp = startConnect "?license.key="+@obj.config.license_key+"&instance_id="+@obj.config.instance_id,agentInfo
47
52
  else
48
53
  @obj.log.debug "[doConnect] Going to connect - New "
49
- if @obj.config.site24x7
50
- resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
54
+ # if @obj.config.site24x7
55
+ # resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
56
+ # else
57
+ # resp = startConnect "",agentInfo
58
+ # end
59
+ # Checking the license pattern for APM as per team requirement
60
+ if !@obj.config.site24x7 && !@obj.config.license_key.match?("APMI_[A-Fa-f0-9]{64}")
61
+ @obj.log.info "Invalid license key for App Manager, aborting agent init"
62
+ @obj.shutdown=true
51
63
  else
52
- resp = startConnect "",agentInfo
64
+ resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
53
65
  end
54
66
  end
55
67
 
@@ -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
@@ -16,17 +16,17 @@ class APMWorker
16
16
  @obj = ManageEngine::APMObjectHolder.instance
17
17
 
18
18
  if @status=="working"
19
- @obj.log.debug "woker thread already started"
19
+ @obj.log.debug "worker thread already started"
20
20
  elsif @status == "initialized"
21
21
  @obj.log.info "start worker thread for - #{Process.pid} :: #{@status} "
22
22
  #@obj.log.info "Starting APMWorker Thread #{Process.pid} "
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
6
+ attr_reader :site24x7USurl, :site24x7EUurl, :site24x7CNurl, :site24x7INurl, :site24x7AUurl, :site24x7GDurl, :site24x7JPurl
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
@@ -56,6 +56,7 @@ module ManageEngine
56
56
  @site24x7AUurl = "https://plusinsight.site24x7.net.au/"
57
57
  @site24x7INurl = "https://plusinsight.site24x7.in/"
58
58
  @site24x7GDurl = "https://gdplusinsight.site24x7.com/"
59
+ @site24x7JPurl = "https://plusinsight.site24x7.jp/"
59
60
 
60
61
  #Response Codes
61
62
  @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.5.1'
9
+ VERSION = '1.8.7'
10
10
  MAJOR_VERSION = '1.8'
11
- MINOR_VERSION = '5.1'
11
+ MINOR_VERSION = '7'
12
12
  end
13
13
  end
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 8
8
- - 5
9
- - 1
10
- version: 1.8.5.1
8
+ - 7
9
+ version: 1.8.7
11
10
  platform: ruby
12
11
  authors:
13
12
  - Adithyan P
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2021-07-06 00:00:00 +05:30
17
+ date: 2023-07-05 00:00:00 +05:30
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency