site24x7_apminsight 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+
2
+ module ManageEngine
3
+ class APMConstants
4
+
5
+ attr_reader :apm_gem,:apm_conf,:agent_conf,:connection_open_timeout,:connection_read_timeout,:connect_uri,:connect_data_uri,:connect_trace_uri,:connect_config_update_uri,:site24x7url
6
+ attr_reader :licence_exceeds,:licence_expired,:unmanage_agent,:manage_agent,:agent_config_updated,:error_notfound,:error_server,:delete_agent,:response_code,:custom_config_info
7
+ attr_reader :mf_transaction,:mf_separator,:mf_db,:mf_apdex,:mf_namespace,:mf_name,:mf_all,:agent_store,:agent_lock,:mf_overflow
8
+
9
+ def initialize
10
+
11
+ #File path for APM Conf file
12
+ @apm_gem="apminsight"
13
+ #File path for APM Conf file
14
+ @apm_conf="apminsight.conf"
15
+
16
+ #file path for agent id, enable details
17
+ @agent_conf="apminsight.info"
18
+
19
+ #file path for agent data store lock
20
+ @agent_lock="apminsight.lock"
21
+
22
+ #file path for agent data store lock
23
+ @agent_store="apminsight.store"
24
+
25
+
26
+ #Timeout for opening Connections
27
+ @connection_open_timeout=60
28
+
29
+ #Timeout for Reading data from Connections
30
+ @connection_read_timeout=60
31
+
32
+ #Connection uri
33
+ @connect_uri="arh/connect"
34
+
35
+ #Connection uri for data
36
+ @connect_data_uri="arh/data?instance_id="
37
+
38
+ #Connection uri for trace
39
+ @connect_trace_uri="arh/trace?instance_id="
40
+
41
+ #Connection uri for config update
42
+ @connect_config_update_uri="arh/agent_config_update?instance_id="
43
+
44
+ #Site24x7 url for agent communication
45
+ @site24x7url="https://plusinsight.site24x7.com/"
46
+
47
+ #Response Codes
48
+ @licence_expired = 701
49
+ @licence_exceeds = 702
50
+ @delete_agent = 900
51
+ @unmanage_agent =910
52
+ @manage_agent = 911
53
+ @agent_config_updated = 920
54
+ @error_notfound = 404
55
+ @error_server = 500
56
+ @response_code = "response-code"
57
+ @custom_config_info = "custom_config_info"
58
+
59
+ #Metrics Formatter -mf
60
+ @mf_apdex = "apdex"
61
+ @mf_namespace = "ns"
62
+ @mf_name = "name"
63
+ @mf_all = "all"
64
+
65
+ @mf_separator = "/"
66
+ @mf_transaction = "transaction" + @mf_separator + "http"
67
+ @mf_db = "db"
68
+ @mf_overflow = "0verf10w"
69
+
70
+
71
+ end
72
+
73
+ def setLicenseKey lkey
74
+ @apm_gem="site24x7_apminsight"
75
+ @connect_data_uri="arh/data?license.key="+lkey+"&instance_id="
76
+ @connect_trace_uri="arh/trace?license.key="+lkey+"&instance_id="
77
+ @connect_config_update_uri="arh/agent_config_update?license.key="+lkey+"&instance_id="
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,130 @@
1
+ require 'socket'
2
+ module ManageEngine
3
+ class APMUtil
4
+
5
+ def setLogger log
6
+ @log = log
7
+ end
8
+
9
+ #Reads the Property Files and returns a Hashes
10
+ def readProperties filepath
11
+ props = {}
12
+ begin
13
+ propsFile=File.open(filepath, 'r')
14
+ propsFile.read.each_line do |line|
15
+ line.strip!
16
+ if (line[0] != ?# and line[0] != ?=)
17
+ i = line.index('=')
18
+ if (i)
19
+ props[line[0..i - 1].strip] = line[i + 1..-1].strip
20
+ else
21
+ props[line] = ''
22
+ end
23
+ end
24
+ end
25
+ rescue Exception=>e
26
+ @log.info "Problem in Reading Property File : #{e.message} "
27
+ @log.error "#{e.backtrace}"
28
+ ensure
29
+ propsFile.close
30
+ end
31
+ props
32
+ end
33
+
34
+ #write the Properties into the Property file
35
+ def writeProperties(f,props)
36
+ begin
37
+ file = File.new(f,"w+")
38
+ props.each {|key,value| file.puts "#{key}=#{value}\n"}
39
+ rescue Exception=>e
40
+ @log.info "Problem in Writing Property File : \n File : #{f}"
41
+ @log.logException "#{e.message}",e
42
+ ensure
43
+ file.close
44
+ end
45
+ end
46
+
47
+ def copyFiles src, dest
48
+ result = false
49
+ begin
50
+ srcFile = File.open(src)
51
+ destFile = File.open(dest , "w")
52
+ destFile.write( srcFile.read(100) ) while not srcFile.eof?
53
+ result = true
54
+ rescue Exception=>e
55
+ @log.info "Problem in Copying File : \n File : #{src} to #{dest}"
56
+ @log.logException "#{e.message}",e
57
+ result = false;
58
+ ensure
59
+ srcFile.close
60
+ destFile.close
61
+ end
62
+
63
+ result
64
+ end
65
+
66
+
67
+ def getBooleanValue(str)
68
+ if str == true || str == "true" || str == "True" || str == "TRUE"
69
+ return true
70
+ else
71
+ return false
72
+ end
73
+ end
74
+
75
+ def currenttimemillis
76
+ (Time.now.to_f*1000).to_i
77
+ end
78
+
79
+
80
+ def getArray value,sep
81
+ arr = Array.new
82
+ if(value!=nil && value.length>0)
83
+ arr = value.split(sep)
84
+ end
85
+ arr
86
+ end
87
+ def isPortBusy(port)
88
+ Timeout::timeout(1) do
89
+ begin
90
+ TCPSocket.new('localhost', port).close
91
+ true
92
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
93
+ false
94
+ end
95
+ end
96
+ rescue Timeout::Error
97
+ false
98
+ end
99
+
100
+ def is_integer(val)
101
+ Integer(val)
102
+ rescue ArgumentError
103
+ false
104
+ else
105
+ true
106
+ end
107
+
108
+ def is_float(val)
109
+ Float(val)
110
+ rescue ArgumentError
111
+ false
112
+ else
113
+ true
114
+ end
115
+
116
+ def parametrizeQuery qry
117
+ begin
118
+ qry.gsub!(/'(.*?[^'])??'/,"?")
119
+ qry.gsub!(/\"(.*?[^\"])??\"/,"?")
120
+ qry.gsub!(/=.\d+/,"=?")
121
+ qry.gsub!(/,.\d+/,", ?")
122
+ rescue Exception=>e
123
+ @log.info "Problem in Parameterizing query: #{e.message} "
124
+ @log.logException "#{e.message}",e
125
+ end
126
+ qry
127
+ end
128
+
129
+ end#c
130
+ end#m
@@ -0,0 +1,5 @@
1
+ require "agent/server/instrument/am_apm"
2
+ require "agent/am_objectholder"
3
+ module ManageEngine
4
+ ManageEngine::APMObjectHolder.instance
5
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: site24x7_apminsight
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rajalakshmi Ezhilan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: &27413904 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *27413904
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &27413616 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *27413616
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &27413328 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.4
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *27413328
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &27413040 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *27413040
58
+ - !ruby/object:Gem::Dependency
59
+ name: rails
60
+ requirement: &27412752 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 3.0.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *27412752
69
+ description: Site24x7 APMInsight gives you end-to-end web-transaction awareness of
70
+ Rails applications enabling you to isolate performance issues and resolve them quickly.
71
+ To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight)
72
+ in your Application Server. This agent allows you to send information about Ruby
73
+ applications. You can install APM Insight Agent via Rubygems or download it from
74
+ your user account in Site24x7
75
+ email: apm-insight@zohocorp.com
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files:
79
+ - LICENSE.txt
80
+ - README.rdoc
81
+ files:
82
+ - LICENSE.txt
83
+ - README.rdoc
84
+ - Rakefile
85
+ - VERSION
86
+ - conf/apminsight.conf
87
+ - lib/site24x7_apminsight.rb
88
+ - lib/agent/am_objectholder.rb
89
+ - lib/agent/logging/am_logger.rb
90
+ - lib/agent/configuration/am_configuration.rb
91
+ - lib/agent/util/am_constants.rb
92
+ - lib/agent/util/am_util.rb
93
+ - lib/agent/metrics/am_metricsformatter.rb
94
+ - lib/agent/metrics/am_metricstore.rb
95
+ - lib/agent/metrics/am_metricscollector.rb
96
+ - lib/agent/metrics/am_metricsparser.rb
97
+ - lib/agent/server/am_agent.rb
98
+ - lib/agent/server/am_connector.rb
99
+ - lib/agent/server/worker/am_worker.rb
100
+ - lib/agent/server/instrument/am_apm.rb
101
+ - lib/agent/server/instrument/am_instrumenter.rb
102
+ homepage: https://help.site24x7.com/Installing-Ruby-Agent.html
103
+ licenses: []
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 1.7.2
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: Site24x7 APMInsight gives you end-to-end web-transaction awareness of Rails
126
+ applications enabling you to isolate performance issues and resolve them quickly.
127
+ To monitor Rails application performance, download and deploy Ruby agent(site24x7_apminsight.gem)
128
+ in your Application Server. This agent allows you to send information about Ruby
129
+ applications. You can install APM Insight Agent via Rubygems or download it from
130
+ your user account in Site24x7
131
+ test_files: []