overwatch 0.0.3.pre → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color --drb --format doc
@@ -1,70 +0,0 @@
1
- GIT
2
- remote: git://github.com/danryan/fakefs.git
3
- revision: 95f4ef407909641218594c51002524a5cc72ab8b
4
- specs:
5
- fakefs (0.3.1)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- addressable (2.2.6)
11
- crack (0.1.8)
12
- diff-lcs (1.1.2)
13
- fuubar (0.0.5)
14
- rspec (~> 2.0)
15
- rspec-instafail (~> 0.1.4)
16
- ruby-progressbar (~> 0.0.10)
17
- git (1.2.5)
18
- jeweler (1.6.3)
19
- bundler (~> 1.0)
20
- git (>= 1.2.5)
21
- rake
22
- json (1.5.3)
23
- mime-types (1.16)
24
- mixlib-cli (1.2.0)
25
- mixlib-config (1.1.2)
26
- mixlib-log (1.3.0)
27
- ohai (0.6.4)
28
- mixlib-cli
29
- mixlib-config
30
- mixlib-log
31
- systemu
32
- yajl-ruby
33
- rake (0.9.2)
34
- rest-client (1.6.3)
35
- mime-types (>= 1.16)
36
- rspec (2.6.0)
37
- rspec-core (~> 2.6.0)
38
- rspec-expectations (~> 2.6.0)
39
- rspec-mocks (~> 2.6.0)
40
- rspec-core (2.6.4)
41
- rspec-expectations (2.6.0)
42
- diff-lcs (~> 1.1.2)
43
- rspec-instafail (0.1.8)
44
- rspec-mocks (2.6.0)
45
- ruby-progressbar (0.0.10)
46
- spork (0.9.0.rc9)
47
- systemu (2.2.0)
48
- watchr (0.7)
49
- webmock (1.6.4)
50
- addressable (~> 2.2, > 2.2.5)
51
- crack (>= 0.1.7)
52
- yajl-ruby (0.8.2)
53
- yard (0.7.2)
54
-
55
- PLATFORMS
56
- ruby
57
-
58
- DEPENDENCIES
59
- bundler (>= 1.0.0)
60
- fakefs!
61
- fuubar
62
- jeweler (>= 1.5.2)
63
- json (>= 1.5.1)
64
- ohai (>= 0.6.4)
65
- rest-client (>= 1.6.3)
66
- rspec (>= 2.5.0)
67
- spork (>= 0.9.0.rc)
68
- watchr
69
- webmock
70
- yard (>= 0.6.0)
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011 Dan Ryan
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.3.pre
@@ -1,38 +0,0 @@
1
- require 'overwatch/mixin'
2
- require 'yaml'
3
- require 'ohai'
4
-
5
- module Overwatch
6
- class Client
7
- attr_accessor :logger, :server_url, :config, :raw_config,
8
- :plugin_manifest, :api_key, :data
9
-
10
- def initialize(api_key)
11
- @ohai = Ohai::System.new
12
- @api_key = api_key
13
- Ohai::Config[:plugin_path] << Overwatch.plugin_path unless Ohai::Config[:plugin_path].include?(Overwatch.plugin_path)
14
- end
15
-
16
- def run
17
- all_plugins
18
- post_data
19
- end
20
-
21
- def all_plugins
22
- @ohai.all_plugins
23
- end
24
-
25
- def post_data
26
- res = RestClient.post(
27
- "http://overwat.ch:9292/nodes/#{api_key}",
28
- Yajl.dump(data),
29
- { 'Content-Type' => 'application/json' }
30
- )
31
- puts res.body
32
- end
33
-
34
- def data
35
- @ohai.data
36
- end
37
- end
38
- end
@@ -1,8 +0,0 @@
1
- provides "load_average"
2
- load_average Mash.new
3
-
4
- raw_load_averages = %x[uptime|cut -d: -f4].strip.split(" ")
5
-
6
- load_average[:one_minute] = raw_load_averages[0]
7
- load_average[:five_minutes] = raw_load_averages[1]
8
- load_average[:fifteen_minutes] = raw_load_averages[2]
@@ -1,113 +0,0 @@
1
- provides "mongo"
2
- mongo Mash.new
3
-
4
- begin
5
- require 'mongo'
6
- rescue LoadError => e
7
- Ohai::Log.warn e.message
8
- end
9
-
10
- connection = Mongo::Connection.new
11
- server_stats = connection.db("local").command('serverStatus' => 1)
12
-
13
- mongo[:version] = server_stats['version']
14
- mongo[:uptime] = server_stats['uptime']
15
- mongo[:host] = server_stats['host']
16
- mongo[:uptime_estimate] = server_stats['uptimeEstimate']
17
-
18
- # DB stats
19
- mongo[:databases] = {}
20
- connection.database_names.map(&:to_sym).each do |db_name|
21
- stats = connection.db(db_name).stats
22
- mongo[:databases][db_name] = Mash.new
23
- mongo[:databases][db_name][:collections] = stats['collections']
24
- mongo[:databases][db_name][:objects] = stats['objects']
25
- mongo[:databases][db_name][:indexes] = stats['indexes']
26
- mongo[:databases][db_name][:data_size] = stats['dataSize']
27
- mongo[:databases][db_name][:storage_size] = stats['storageSize']
28
- mongo[:databases][db_name][:file_size] = stats['fileSize']
29
- mongo[:databases][db_name][:avg_obj_size] = stats['avgObjSize']
30
- mongo[:databases][db_name][:index_size] = stats['indexSize']
31
- mongo[:databases][db_name][:num_extents] = stats['numExtents']
32
- end
33
-
34
- # Connections
35
- mongo[:connections] = Mash.new
36
- mongo[:connections][:current] = server_stats['connections']['current']
37
- mongo[:connections][:available] = server_stats['connections']['available']
38
-
39
- # Memory usage
40
- mongo[:memory] = Mash.new
41
- mongo[:memory][:resident] = server_stats['mem']['resident']
42
- mongo[:memory][:virtual] = server_stats['mem']['virtual']
43
- mongo[:memory][:supported] = server_stats['mem']['supported']
44
- mongo[:memory][:mapped] = server_stats['mem']['mapped']
45
-
46
- # Global lock
47
- mongo[:global_lock] = Mash.new
48
- mongo[:global_lock][:ratio] = server_stats['globalLock']['ratio']
49
- mongo[:global_lock][:current_queue] = Mash.new
50
- mongo[:global_lock][:current_queue][:total] = server_stats['globalLock']['currentQueue']['total']
51
- mongo[:global_lock][:current_queue][:readers] = server_stats['globalLock']['currentQueue']['readers']
52
- mongo[:global_lock][:current_queue][:writers] = server_stats['globalLock']['currentQueue']['writers']
53
- mongo[:global_lock][:active_clients] = Mash.new
54
- mongo[:global_lock][:active_clients][:total] = server_stats['globalLock']['activeClients']['total']
55
- mongo[:global_lock][:active_clients][:readers] = server_stats['globalLock']['activeClients']['readers']
56
- mongo[:global_lock][:active_clients][:writers] = server_stats['globalLock']['activeClients']['writers']
57
-
58
-
59
- # Index counters
60
- mongo[:index_counters] = Mash.new
61
- mongo[:index_counters][:accesses] = server_stats['indexCounters']['btree']['accesses']
62
- mongo[:index_counters][:hits] = server_stats['indexCounters']['btree']['hits']
63
- mongo[:index_counters][:misses] = server_stats['indexCounters']['btree']['misses']
64
- mongo[:index_counters][:resets] = server_stats['indexCounters']['btree']['resets']
65
- mongo[:index_counters][:miss_ratio] = server_stats['indexCounters']['btree']['missRatio']
66
-
67
- # Background flushing
68
- mongo[:background_flushing] = Mash.new
69
- mongo[:background_flushing][:flushes] = server_stats['backgroundFlushing']['flushes']
70
- mongo[:background_flushing][:total_ms] = server_stats['backgroundFlushing']['average_ms']
71
- mongo[:background_flushing][:last_ms] = server_stats['backgroundFlushing']['last_ms']
72
- mongo[:background_flushing][:last_finished] = server_stats['backgroundFlushing']['last_finished'].to_s
73
-
74
- # Op counters
75
- mongo[:op_counters] = Mash.new
76
- mongo[:op_counters][:insert] = server_stats['opcounters']['insert']
77
- mongo[:op_counters][:query] = server_stats['opcounters']['query']
78
- mongo[:op_counters][:update] = server_stats['opcounters']['update']
79
- mongo[:op_counters][:delete] = server_stats['opcounters']['delete']
80
- mongo[:op_counters][:getmore] = server_stats['opcounters']['getmore']
81
- mongo[:op_counters][:command] = server_stats['opcounters']['command']
82
-
83
- # Asserts
84
- mongo[:asserts] = Mash.new
85
- mongo[:asserts][:regular] = server_stats['asserts']['regular']
86
- mongo[:asserts][:warning] = server_stats['asserts']['warning']
87
- mongo[:asserts][:msg] = server_stats['asserts']['msg']
88
- mongo[:asserts][:user] = server_stats['asserts']['user']
89
- mongo[:asserts][:rollovers] = server_stats['asserts']['rollovers']
90
-
91
- # Network
92
- mongo[:network] = Mash.new
93
- mongo[:network][:bytes_in] = server_stats['network']['bytesIn']
94
- mongo[:network][:bytes_out] = server_stats['network']['bytesOut']
95
- mongo[:network][:num_requests] = server_stats['network']['numRequests']
96
-
97
- # Replica Set
98
-
99
- begin
100
- admin = connection.db("admin")
101
- repl_stats = admin.command('replSetGetStatus' => 1)
102
- rescue Mongo::OperationFailure => e
103
- Ohai::Log.warn e.message
104
- end
105
-
106
- mongo[:repl_set] = Mash.new
107
- mongo[:repl_set][:set] = repl_set['set']
108
- mongo[:repl_set][:date] = repl_set['date']
109
- mongo[:repl_set][:my_state] = repl_set['myState']
110
- mongo[:repl_set][:members] = []
111
- repl_set['members'].each do |member|
112
- mongo[:repl_set][:members] << member.symbolize_keys
113
- end
@@ -1,152 +0,0 @@
1
- provides "mysql"
2
- mysql Mash.new
3
-
4
- begin
5
- require 'mysql'
6
- rescue LoadError => e
7
- Ohai::Log.warn e.message
8
- end
9
-
10
- user = nil
11
- passwd = nil
12
- port = nil
13
- connection = Mysql.connect("localhost", user, passwd, nil, port )
14
-
15
- global_status = Mash.new
16
-
17
- raw_status = connection.query("SHOW GLOBAL STATUS")
18
- raw_status.each do |row|
19
- global_status[row.first] = row.last.to_i
20
- end
21
-
22
- variables = Mash.new
23
-
24
- raw_variables = connection.query("SHOW VARIABLES")
25
- raw_variables.each do |row|
26
- variables[row.first] = row.last.to_i
27
- end
28
-
29
- mysql[:max_used_connections] = global_status['Max_used_connections']
30
- mysql[:connections] = global_status['Connections']
31
- mysql[:slow_queries] = global_status['Slow_queries']
32
-
33
- # Threads
34
- mysql[:threads_cached] = global_status['Threads_cached']
35
- mysql[:threads_connected] = global_status['Threads_connected']
36
- mysql[:threads_created] = global_status['Threads_created']
37
- mysql[:threads_running] = global_status['Threads_running']
38
-
39
- # Errors
40
- mysql[:aborted_clients] = global_status['Aborted_clients']
41
- mysql[:aborted_connects] = global_status['Aborted_connects']
42
-
43
- # Network
44
-
45
- mysql[:bytes_received] = global_status['Bytes_received']
46
- mysql[:bytes_sent] = global_status['Bytes_sent']
47
-
48
- # Temp tables
49
-
50
- mysql[:created_tmp_disk_tables] = global_status["Created_tmp_disk_tables"]
51
- mysql[:created_tmp_files] = global_status["Created_tmp_files"]
52
- mysql[:created_tmp_tables] = global_status["Created_tmp_tables"]
53
-
54
- mysql[:table_locks_waited] = global_status["Table_locks_waited"]
55
-
56
- # InnoDB
57
-
58
- mysql[:innodb_buffer_pool_pages_data] = global_status["Innodb_buffer_pool_pages_dirty"]
59
- mysql[:innodb_buffer_pool_pages_dirty] = global_status["Innodb_buffer_pool_pages_flushed"]
60
- mysql[:innodb_buffer_pool_pages_flushed] = global_status["Innodb_buffer_pool_pages_free"]
61
- mysql[:innodb_buffer_pool_pages_free] = global_status["Innodb_buffer_pool_pages_misc"]
62
- mysql[:innodb_buffer_pool_pages_misc] = global_status["Innodb_buffer_pool_pages_total"]
63
- mysql[:innodb_buffer_pool_pages_total] = global_status["Innodb_buffer_pool_read_ahead"]
64
- mysql[:innodb_buffer_pool_read_ahead] = global_status["Innodb_buffer_pool_read_ahead_evicted"]
65
- mysql[:innodb_buffer_pool_read_ahead_evicted] = global_status["Innodb_buffer_pool_read_requests"]
66
- mysql[:innodb_buffer_pool_read_requests] = global_status["Innodb_buffer_pool_reads"]
67
- mysql[:innodb_buffer_pool_reads] = global_status["Innodb_buffer_pool_wait_free"]
68
- mysql[:innodb_buffer_pool_wait_free] = global_status["Innodb_buffer_pool_write_requests"]
69
- mysql[:innodb_buffer_pool_write_requests] = global_status["Innodb_data_fsyncs"]
70
- mysql[:innodb_data_fsyncs] = global_status["Innodb_data_pending_fsyncs"]
71
- mysql[:innodb_data_pending_fsyncs] = global_status["Innodb_data_pending_reads"]
72
- mysql[:innodb_data_pending_reads] = global_status["Innodb_data_pending_writes"]
73
- mysql[:innodb_data_pending_writes] = global_status["Innodb_data_read"]
74
- mysql[:innodb_data_read] = global_status["Innodb_data_reads"]
75
- mysql[:innodb_data_reads] = global_status["Innodb_data_writes"]
76
- mysql[:innodb_data_writes] = global_status["Innodb_data_written"]
77
- mysql[:innodb_data_written] = global_status["Innodb_dblwr_pages_written"]
78
- mysql[:innodb_dblwr_pages_written] = global_status["Innodb_dblwr_writes"]
79
- mysql[:innodb_dblwr_writes] = global_status["Innodb_have_atomic_builtins"]
80
- mysql[:innodb_have_atomic_builtins] = global_status["Innodb_log_waits"]
81
- mysql[:innodb_log_waits] = global_status["Innodb_log_write_requests"]
82
- mysql[:innodb_log_write_requests] = global_status["Innodb_log_writes"]
83
- mysql[:innodb_log_writes] = global_status["Innodb_os_log_fsyncs"]
84
- mysql[:innodb_os_log_fsyncs] = global_status["Innodb_os_log_pending_fsyncs"]
85
- mysql[:innodb_os_log_pending_fsyncs] = global_status["Innodb_os_log_pending_writes"]
86
- mysql[:innodb_os_log_pending_writes] = global_status["Innodb_os_log_written"]
87
- mysql[:innodb_os_log_written] = global_status["Innodb_page_size"]
88
- mysql[:innodb_page_size] = global_status["Innodb_pages_created"]
89
- mysql[:innodb_pages_created] = global_status["Innodb_pages_read"]
90
- mysql[:innodb_pages_read] = global_status["Innodb_pages_written"]
91
- mysql[:innodb_pages_written] = global_status["Innodb_row_lock_current_waits"]
92
- mysql[:innodb_row_lock_current_waits] = global_status["Innodb_row_lock_time"]
93
- mysql[:innodb_row_lock_time] = global_status["Innodb_row_lock_time_avg"]
94
- mysql[:innodb_row_lock_time_avg] = global_status["Innodb_row_lock_time_max"]
95
- mysql[:innodb_row_lock_time_max] = global_status["Innodb_row_lock_waits"]
96
- mysql[:innodb_row_lock_waits] = global_status["Innodb_rows_deleted"]
97
- mysql[:innodb_rows_deleted] = global_status["Innodb_rows_inserted"]
98
- mysql[:innodb_rows_inserted] = global_status["Innodb_rows_read"]
99
- mysql[:innodb_rows_read] = global_status["Innodb_rows_updated"]
100
- mysql[:innodb_rows_updated] = global_status["Innodb_truncated_status_writes"]
101
- mysql[:innodb_truncated_status_writes] = global_status["Innodb_buffer_pool_pages_data"]
102
-
103
- # Qcache
104
- mysql[:qcache_free_blocks] = global_status["Qcache_free_blocks"]
105
- mysql[:qcache_free_memory] = global_status["Qcache_free_memory"]
106
- mysql[:qcache_hits] = global_status["Qcache_hits"]
107
- mysql[:qcache_inserts] = global_status["Qcache_inserts"]
108
- mysql[:qcache_lowmem_prunes] = global_status["Qcache_lowmem_prunes"]
109
- mysql[:qcache_not_cached] = global_status["Qcache_not_cached"]
110
- mysql[:qcache_queries_in_cache] = global_status["Qcache_queries_in_cache"]
111
- mysql[:qcache_total_blocks] = global_status["Qcache_total_blocks"]
112
-
113
- # Keys
114
- mysql[:key_blocks_not_flushed] = global_status["Key_blocks_not_flushed"]
115
- mysql[:key_blocks_unused] = global_status["Key_blocks_unused"]
116
- mysql[:key_blocks_used] = global_status["Key_blocks_used"]
117
- mysql[:key_read_requests] = global_status["Key_read_requests"]
118
- mysql[:key_reads] = global_status["Key_reads"]
119
- mysql[:key_write_requests] = global_status["Key_write_requests"]
120
- mysql[:key_writes] = global_status["Key_writes"]
121
-
122
- ## VARIABLES
123
-
124
- # Binlog
125
- mysql[:binlog_cache_size] = variables["binlog_cache_size"]
126
- mysql[:binlog_direct_non_transactional_updates] = variables["binlog_direct_non_transactional_updates"]
127
- mysql[:binlog_format] = variables["binlog_format"]
128
- mysql[:binlog_stmt_cache_size] = variables["binlog_stmt_cache_size"]
129
-
130
- # Max
131
-
132
- mysql[:max_allowed_packet] = variables["max_allowed_packet"]
133
- mysql[:max_binlog_cache_size] = variables["max_binlog_cache_size"]
134
- mysql[:max_binlog_size] = variables["max_binlog_size"]
135
- mysql[:max_binlog_stmt_cache_size] = variables["max_binlog_stmt_cache_size"]
136
- mysql[:max_connect_errors] = variables["max_connect_errors"]
137
- mysql[:max_connections] = variables["max_connections"]
138
- mysql[:max_delayed_threads] = variables["max_delayed_threads"]
139
- mysql[:max_error_count] = variables["max_error_count"]
140
- mysql[:max_heap_table_size] = variables["max_heap_table_size"]
141
- mysql[:max_insert_delayed_threads] = variables["max_insert_delayed_threads"]
142
- mysql[:max_join_size] = variables["max_join_size"]
143
- mysql[:max_length_for_sort_data] = variables["max_length_for_sort_data"]
144
- mysql[:max_long_data_size] = variables["max_long_data_size"]
145
- mysql[:max_prepared_stmt_count] = variables["max_prepared_stmt_count"]
146
- mysql[:max_relay_log_size] = variables["max_relay_log_size"]
147
- mysql[:max_seeks_for_key] = variables["max_seeks_for_key"]
148
- mysql[:max_sort_length] = variables["max_sort_length"]
149
- mysql[:max_sp_recursion_depth] = variables["max_sp_recursion_depth"]
150
- mysql[:max_tmp_tables] = variables["max_tmp_tables"]
151
- mysql[:max_user_connections] = variables["max_user_connections"]
152
- mysql[:max_write_lock_count] = variables["max_write_lock_count"]
@@ -1,52 +0,0 @@
1
- provides "redis"
2
- redis Mash.new
3
-
4
- begin
5
- require 'redis'
6
- require 'system_timer'
7
- rescue LoadError => e
8
- Ohai::Log.warn e.message
9
- end
10
-
11
- port = 6379
12
- info = Mash.new(Redis.new(:port => port).info).symbolize_keys
13
-
14
- redis[:version] = info[:redis_version]
15
- redis[:arch_bits] = info[:arch_bits]
16
- redis[:multiplexing_api] = info[:multiplexing_api]
17
- redis[:process_id] = info[:process_id]
18
- redis[:uptime_in_seconds] = info[:uptime_in_seconds]
19
- redis[:uptime_in_days] = info[:uptime_in_days]
20
- redis[:lru_clock] = info[:lru_clock]
21
- redis[:used_cpu_sys] = info[:used_cpu_sys]
22
- redis[:used_cpu_user] = info[:used_cpu_user]
23
- redis[:used_cpu_sys_childrens] = info[:used_cpu_sys_childrens]
24
- redis[:used_cpu_user_childrens] = info[:used_cpu_user_childrens]
25
- redis[:connected_clients] = info[:connected_clients]
26
- redis[:connected_slaves] = info[:connected_slaves]
27
- redis[:client_longest_output_list] = info[:client_longest_output_list]
28
- redis[:client_biggest_input_buf] = info[:client_biggest_input_buf]
29
- redis[:blocked_clients] = info[:blocked_clients]
30
- redis[:used_memory] = info[:used_memory]
31
- redis[:used_memory_human] = info[:used_memory_human]
32
- redis[:used_memory_rss] = info[:used_memory_rss]
33
- redis[:mem_fragmentation_ratio] = info[:mem_fragmentation_ratio]
34
- redis[:use_tcmalloc] = info[:use_tcmalloc]
35
- redis[:loading] = info[:loading]
36
- redis[:aof_enabled] = info[:aof_enabled]
37
- redis[:changes_since_last_save] = info[:changes_since_last_save]
38
- redis[:bgsave_in_progress] = info[:bgsave_in_progress]
39
- redis[:last_save_time] = info[:last_save_time]
40
- redis[:bgrewriteaof_in_progress] = info[:bgrewriteaof_in_progress]
41
- redis[:total_connections_received] = info[:total_connections_received]
42
- redis[:total_commands_processed] = info[:total_commands_processed]
43
- redis[:expired_keys] = info[:expired_keys]
44
- redis[:evicted_keys] = info[:evicted_keys]
45
- redis[:keyspace_hits] = info[:keyspace_hits]
46
- redis[:keyspace_misses] = info[:keyspace_misses]
47
- redis[:hash_max_zipmap_entries] = info[:hash_max_zipmap_entries]
48
- redis[:hash_max_zipmap_value] = info[:hash_max_zipmap_value]
49
- redis[:pubsub_channels] = info[:pubsub_channels]
50
- redis[:pubsub_patterns] = info[:pubsub_patterns]
51
- redis[:vm_enabled] = info[:vm_enabled]
52
- redis[:role] = info[:role]