recmon 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -1
- data/README +2 -2
- data/lib/recmon/diskfree-sensor.rb +2 -2
- data/lib/recmon/diskspace-sensor.rb +1 -1
- data/lib/recmon/filesize-sensor.rb +3 -7
- metadata +3 -3
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -76,7 +76,7 @@ A DiskfreeSensor tracks how much disk space is available on a mounted disk parti
|
|
76
76
|
|
77
77
|
s.diskfree(name, freq=1200)
|
78
78
|
s.diskfree("/var")
|
79
|
-
# log entry => "2012-09-13T16:09:02+10:00 mountpoint=/var
|
79
|
+
# log entry => "2012-09-13T16:09:02+10:00 mountpoint=/var available=4576 MB"
|
80
80
|
|
81
81
|
=== diskspace: track the diskspace used by a folder
|
82
82
|
A DiskspaceSensor tracks how much disk space is being consumed by a set of files (log files or database files) in a folder:
|
@@ -92,7 +92,7 @@ A FilesizeSensor tracks the size of a given file every 10 minutes:
|
|
92
92
|
|
93
93
|
s.filesize(name, path, freq=1200)
|
94
94
|
s.filesize("Messages", "/var/log/messages")
|
95
|
-
# log entry => "2012-09-13T16:09:02+10:00 Messages filesize=
|
95
|
+
# log entry => "2012-09-13T16:09:02+10:00 Messages filesize=78045 bytes"
|
96
96
|
|
97
97
|
=== ping: check if a server is alive
|
98
98
|
The PingSensor pings a server to ensure it is accessible through the network
|
@@ -20,10 +20,10 @@ class DiskfreeSensor < Sensor
|
|
20
20
|
usage = "unknown"
|
21
21
|
if line
|
22
22
|
parts = line.split(/\s+/)
|
23
|
-
|
23
|
+
avail = parts[3].to_i()/1024
|
24
24
|
end
|
25
25
|
end
|
26
|
-
return("mountpoint=#{@name}
|
26
|
+
return("mountpoint=#{@name} available=#{avail} MB")
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -17,7 +17,7 @@ class DiskspaceSensor < Sensor
|
|
17
17
|
# Called by Monitor. Executes du(1) to determine the disk usage in Megabytes.
|
18
18
|
def sense()
|
19
19
|
begin
|
20
|
-
size = `sudo /usr/bin/du -sk #{@path}`.to_i()
|
20
|
+
size = `sudo /usr/bin/du -sk #{@path}`.to_i()/1024
|
21
21
|
rescue
|
22
22
|
size = "unknown"
|
23
23
|
end
|
@@ -13,14 +13,10 @@ class FilesizeSensor < Sensor
|
|
13
13
|
raise "Path not found: #{path}" unless File.exists?(@path)
|
14
14
|
end
|
15
15
|
|
16
|
-
# Called by Monitor. Determines the filesize in
|
16
|
+
# Called by Monitor. Determines the filesize in bytes.
|
17
17
|
def sense()
|
18
|
-
|
19
|
-
|
20
|
-
rescue
|
21
|
-
size = "unknown"
|
22
|
-
end
|
23
|
-
return("#{@name} filesize=#{size} KB")
|
18
|
+
size = File.stat(@path).size() || "unknown"
|
19
|
+
return("#{@name} filesize=#{size} bytes")
|
24
20
|
end
|
25
21
|
|
26
22
|
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: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Kernahan
|