qnotifier 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/config/qnotifier_config.yml +1 -1
- data/lib/plugin.rb +1 -1
- data/lib/qnotifier.rb +9 -6
- data/lib/storage.rb +5 -3
- data/qnotifier.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
data/config/qnotifier_config.yml
CHANGED
@@ -27,7 +27,7 @@ resend_alert_time: 1 #14400 # Four hours
|
|
27
27
|
# Where to look for user generated plugins
|
28
28
|
# To add your own plugin subclass the Qnotifier::Plugin class and put this in to this directory
|
29
29
|
# You may add configuration parameters here based on the name of your plugin class
|
30
|
-
plugin_directory: "/var/qnotifier"
|
30
|
+
plugin_directory: "/var/lib/qnotifier/plugins"
|
31
31
|
|
32
32
|
# The System Plugin must be enabled, this gives basic stats like load average, disk use, memory, etc
|
33
33
|
System:
|
data/lib/plugin.rb
CHANGED
@@ -83,8 +83,8 @@ module Qnotifier
|
|
83
83
|
|
84
84
|
# Alert is no longer needed as the value has crossed back over the threshold value
|
85
85
|
def reset_alert(name, message)
|
86
|
-
@alerts = {@class_name => []} unless @alerts
|
87
86
|
if Qnotifier::Storage.get("AlertTime_#{@class_name}-#{name}")
|
87
|
+
@alerts = {@class_name => []} unless @alerts
|
88
88
|
log.warn message
|
89
89
|
Qnotifier::Storage.delete("AlertTime_#{@class_name}-#{name}")
|
90
90
|
data = [name, message, 6] # Clear
|
data/lib/qnotifier.rb
CHANGED
@@ -156,7 +156,10 @@ module Qnotifier
|
|
156
156
|
return unless api_key
|
157
157
|
@config["api_key"] = api_key
|
158
158
|
begin
|
159
|
-
|
159
|
+
var_dir = "/var/lib/qnotifier"
|
160
|
+
FileUtils.mkdir_p var_dir unless File.exists?(var_dir)
|
161
|
+
File.open("/var/lib/qnotifier/api_key", 'w') {|f| f.write(api_key) }
|
162
|
+
File.chmod(0600, "/var/lib/qnotifier/api_key")
|
160
163
|
rescue Exception => e
|
161
164
|
Qnotifier.log.fatal "Can't save API Key #{e.message}"
|
162
165
|
end
|
@@ -164,10 +167,6 @@ module Qnotifier
|
|
164
167
|
|
165
168
|
def load_config
|
166
169
|
|
167
|
-
# Make the var dir if it doesn't exist
|
168
|
-
var_dir = File.dirname(__FILE__) + "/../var"
|
169
|
-
FileUtils.mkdir_p var_dir
|
170
|
-
|
171
170
|
# Load from /etc/qnotifier_config.yml if the file is there
|
172
171
|
begin
|
173
172
|
@config = YAML::load(File.open('/etc/qnotifier_config.yml'))
|
@@ -185,7 +184,11 @@ module Qnotifier
|
|
185
184
|
|
186
185
|
unless @config["api_key"]
|
187
186
|
begin
|
188
|
-
|
187
|
+
# Make the var dir if it doesn't exist
|
188
|
+
var_dir = "/var/lib/qnotifier"
|
189
|
+
FileUtils.mkdir_p var_dir unless File.exists?(var_dir)
|
190
|
+
|
191
|
+
api_key_file = File.open("/var/lib/qnotifier/api_key")
|
189
192
|
while (line = api_key_file.readline)
|
190
193
|
@config["api_key"] = line
|
191
194
|
end
|
data/lib/storage.rb
CHANGED
@@ -8,8 +8,10 @@ module Qnotifier
|
|
8
8
|
@@restored = false
|
9
9
|
|
10
10
|
def self.restore
|
11
|
+
saved_variables = "/var/lib/qnotifier/saved_variables.yml"
|
11
12
|
begin
|
12
|
-
|
13
|
+
var_dir = "/var/lib/qnotifier"
|
14
|
+
FileUtils.mkdir_p var_dir unless File.exists?(var_dir)
|
13
15
|
@@stored_variables = YAML::load(File.open(saved_variables))
|
14
16
|
rescue Exception => e
|
15
17
|
Qnotifier.log.debug "Error loading stored variables file. #{e.message}"
|
@@ -32,7 +34,7 @@ module Qnotifier
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def self.wipe
|
35
|
-
saved_variables =
|
37
|
+
saved_variables = "/var/lib/qnotifier/saved_variables.yml"
|
36
38
|
begin
|
37
39
|
File.delete(saved_variables)
|
38
40
|
rescue Exception => e
|
@@ -46,8 +48,8 @@ module Qnotifier
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def self.save
|
51
|
+
saved_variables = "/var/lib/qnotifier/saved_variables.yml"
|
49
52
|
begin
|
50
|
-
saved_variables = File.dirname(__FILE__) + "/../var/saved_variables.yml"
|
51
53
|
File.open(saved_variables, "w") do |f|
|
52
54
|
f.write(YAML::dump(@@stored_variables))
|
53
55
|
end
|
data/qnotifier.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{qnotifier}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Gersham Meharg"]
|
9
9
|
s.date = %q{2010-05-05}
|
10
10
|
s.default_executable = %q{qnotifier}
|
11
|
-
s.description = %q{The server side agent for the QNotifier monitoring system. This software will monitor local Linux system parameters and upload them to the
|
11
|
+
s.description = %q{The server side agent for the QNotifier monitoring system. This software will monitor local Linux system parameters and upload them to the QNotifier servers where users can use iPhone/iPad applications to view those stats and recieve alerts.}
|
12
12
|
s.email = %q{gersham@qnotifier.com}
|
13
13
|
s.executables = ["qnotifier"]
|
14
14
|
s.extra_rdoc_files = ["bin/qnotifier", "lib/command.rb", "lib/plugin.rb", "lib/qnotifier.rb", "lib/storage.rb", "lib/web_service.rb"]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 5
|
9
|
+
version: 0.6.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gersham Meharg
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: 0.1.0
|
123
123
|
type: :development
|
124
124
|
version_requirements: *id006
|
125
|
-
description: The server side agent for the QNotifier monitoring system. This software will monitor local Linux system parameters and upload them to the
|
125
|
+
description: The server side agent for the QNotifier monitoring system. This software will monitor local Linux system parameters and upload them to the QNotifier servers where users can use iPhone/iPad applications to view those stats and recieve alerts.
|
126
126
|
email: gersham@qnotifier.com
|
127
127
|
executables:
|
128
128
|
- qnotifier
|
metadata.gz.sig
CHANGED
Binary file
|