disk_reporter 0.0.5 → 0.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.
- checksums.yaml +4 -4
- data/lib/disk_reporter/disk_handler.rb +10 -5
- data/lib/disk_reporter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d9435c02f11c6d90546f179aad574efb9f8d40
|
4
|
+
data.tar.gz: 875e0ff17adde50e89e9d0e97926590b29f65392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e17f4044ba863c530347589e9bfb8c2284871586eb591a7ae4071b874033f1c61534fe1e2a1ccbffbdd603d1aa3a18785d5674275e02cbb7c49752cd911374f
|
7
|
+
data.tar.gz: 50be58a239450dbc192952a5336c4d3f5b29496eaaa8295019c57e1366e42fd564b408c44f330cfb2b46f6f51b9ab2c4e77dfa94275db366c5c93fe4251d6ac8
|
@@ -1,5 +1,10 @@
|
|
1
1
|
#!/bin/env ruby
|
2
2
|
require 'json'
|
3
|
+
|
4
|
+
SMARTCTL = '/usr/sbin/smartctl'
|
5
|
+
BLKID = '/sbin/blkid'
|
6
|
+
LSBLK = '/bin/lsblk'
|
7
|
+
|
3
8
|
module DiskHandler
|
4
9
|
class Disk
|
5
10
|
attr_accessor :name, :type, :size, :model, :state, :id, :number, :version, :partitions
|
@@ -32,7 +37,7 @@ class Disk
|
|
32
37
|
end
|
33
38
|
|
34
39
|
def get_smart_info
|
35
|
-
|
40
|
+
`#{SMARTCTL} -i /dev/#{name}`
|
36
41
|
end
|
37
42
|
|
38
43
|
# Is the device SMART capable and enabled
|
@@ -44,7 +49,7 @@ class Disk
|
|
44
49
|
# Check the SMART health
|
45
50
|
#
|
46
51
|
def check_health!
|
47
|
-
output =
|
52
|
+
output = `#{SMARTCTL} -H #{device_path}`
|
48
53
|
@smart_healthy = !output.scan(/PASSED/).empty?
|
49
54
|
@health_output = output
|
50
55
|
end
|
@@ -60,7 +65,7 @@ class Disk
|
|
60
65
|
# Checks if disk is capable
|
61
66
|
#
|
62
67
|
def check_smart_capability!
|
63
|
-
output =
|
68
|
+
output = `#{SMARTCTL} -i #{device_path}`
|
64
69
|
@smart_available = !output.scan(/SMART support is: Available/).empty?
|
65
70
|
@smart_enabled = !output.scan(/SMART support is: Enabled/).empty?
|
66
71
|
@capability_output = output
|
@@ -105,7 +110,7 @@ class Partition
|
|
105
110
|
end
|
106
111
|
|
107
112
|
def blkid
|
108
|
-
response =
|
113
|
+
response = `#{BLKID} #{name}`
|
109
114
|
self.fs = $?.exitstatus == 0
|
110
115
|
# puts "FS: #{fs}"
|
111
116
|
# puts response
|
@@ -143,7 +148,7 @@ class Parser
|
|
143
148
|
|
144
149
|
def scan_disks
|
145
150
|
ds = []
|
146
|
-
|
151
|
+
`#{LSBLK} -Pbdo NAME,TYPE,SIZE,MODEL,STATE`.each_line do |line|
|
147
152
|
ds << Disk.new(line)
|
148
153
|
end
|
149
154
|
ds
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disk_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Harland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.6.
|
96
|
+
rubygems_version: 2.6.13
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Uses sas2ircu and blkid to determine the status of various disks attached
|