recmon 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/recmon/filesize-sensor.rb +27 -0
- metadata +4 -3
data/CHANGELOG
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'recmon/sensor'
|
2
|
+
|
3
|
+
module Recmon
|
4
|
+
|
5
|
+
# Periodically checks the size of a designated file
|
6
|
+
class FilesizeSensor < Sensor
|
7
|
+
|
8
|
+
# The name is arbitrary (used in creating the log entries), and the
|
9
|
+
# path should be absolute (eg. <code>/var/log/messages</code>)
|
10
|
+
def initialize(name, path, freq=1200)
|
11
|
+
super(name, freq)
|
12
|
+
@path = path.strip()
|
13
|
+
raise "Path not found: #{path}" unless File.exists?(@path)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Called by Monitor. Determines the filesize in Kilobytes.
|
17
|
+
def sense()
|
18
|
+
begin
|
19
|
+
size = `sudo /bin/ls -sk #{@path}`.to_i
|
20
|
+
rescue
|
21
|
+
size = "unknown"
|
22
|
+
end
|
23
|
+
return("#{@name} filesize=#{size} KB")
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recmon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Kernahan
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/recmon/sensor.rb
|
33
33
|
- lib/recmon/command-sensor.rb
|
34
34
|
- lib/recmon/diskspace-sensor.rb
|
35
|
+
- lib/recmon/filesize-sensor.rb
|
35
36
|
- lib/recmon/ping-sensor.rb
|
36
37
|
- lib/recmon/proc-sensor.rb
|
37
38
|
- lib/recmon/ssh-sensor.rb
|