idrac 0.4.6 → 0.5.1
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/bin/idrac +102 -7
- data/lib/idrac/client.rb +1 -0
- data/lib/idrac/license.rb +63 -0
- data/lib/idrac/storage.rb +2 -1
- data/lib/idrac/system.rb +59 -16
- data/lib/idrac/version.rb +1 -1
- data/lib/idrac.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d31422362fd2d548fff6e03265162bdf4cfb34237085a7e9e14170bcd8d5eb
|
4
|
+
data.tar.gz: 219ca3faaaf4e3b8d85ceb0db0baebe5ffa81c2e5afc61ba13851c76fd1f6b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37b6e6094ee872b2989dcd4d66a8a965502ed7193a66813d5ed3ff60592cfae47c26f9caf9b2f0c34580d366845b49414f55bd909519618d8439cdb71fe8473
|
7
|
+
data.tar.gz: 30ffb9cbd571489a12f71c553777089541c3550287aca5a267bc4b964da41ff268219ca9e4306097c0aced7ae29a1bd7d17f6ccccfefd45f77778a29891801e1
|
data/bin/idrac
CHANGED
@@ -456,6 +456,37 @@ module IDRAC
|
|
456
456
|
end
|
457
457
|
end
|
458
458
|
|
459
|
+
desc "license_info", "Display license information"
|
460
|
+
map "license:info" => :license_info
|
461
|
+
def license_info
|
462
|
+
with_idrac_client do |client|
|
463
|
+
license = client.license_info
|
464
|
+
if license
|
465
|
+
puts "\nLicense Information:".green.bold
|
466
|
+
puts "Description: #{license['Description']}".cyan
|
467
|
+
puts "License Type: #{license['LicenseType']}".cyan
|
468
|
+
puts "License Version: #{client.license_version || 'Unknown'}".cyan
|
469
|
+
puts "Removable: #{license['Removable']}".cyan
|
470
|
+
puts "Status: #{license.dig('Status', 'Health') || 'Unknown'}".cyan
|
471
|
+
else
|
472
|
+
puts "No license information available".yellow
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
desc "license_version", "Display the iDRAC license version number"
|
478
|
+
map "license:version" => :license_version
|
479
|
+
def license_version
|
480
|
+
with_idrac_client do |client|
|
481
|
+
version = client.license_version
|
482
|
+
if version
|
483
|
+
puts version
|
484
|
+
else
|
485
|
+
puts "Unknown license version"
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
459
490
|
desc "test:all", "Run tests for all major functionality areas"
|
460
491
|
map "test" => :test_all
|
461
492
|
option :quiet, type: :boolean, default: false, desc: "Minimize output, just show pass/fail"
|
@@ -472,6 +503,8 @@ module IDRAC
|
|
472
503
|
# Basic information
|
473
504
|
{ name: "System Summary", method: -> (c) { c.summary } },
|
474
505
|
{ name: "Redfish Version", method: -> (c) { c.redfish_version } },
|
506
|
+
{ name: "License Version", method: -> (c) { c.license_version } },
|
507
|
+
{ name: "System Health", method: -> (c) { c.system_health } },
|
475
508
|
|
476
509
|
# Power methods
|
477
510
|
{ name: "Power State", method: -> (c) { c.get_power_state } },
|
@@ -488,6 +521,7 @@ module IDRAC
|
|
488
521
|
|
489
522
|
# System components
|
490
523
|
{ name: "Memory Info", method: -> (c) { c.memory } },
|
524
|
+
{ name: "CPU Info", method: -> (c) { c.cpus } },
|
491
525
|
{ name: "PSU Info", method: -> (c) { c.psus } },
|
492
526
|
{ name: "Fan Info", method: -> (c) { c.fans } },
|
493
527
|
{ name: "NIC Info", method: -> (c) { c.nics } },
|
@@ -863,6 +897,27 @@ module IDRAC
|
|
863
897
|
end
|
864
898
|
end
|
865
899
|
|
900
|
+
desc "system_cpus", "Get processor/CPU information"
|
901
|
+
map "system:cpus" => :system_cpus
|
902
|
+
def system_cpus
|
903
|
+
with_idrac_client do |client|
|
904
|
+
cpus = client.cpus
|
905
|
+
|
906
|
+
puts "\nProcessor Summary:".green.bold
|
907
|
+
puts "=" * 50
|
908
|
+
|
909
|
+
health_color = cpus.status == "OK" ? :green : :red
|
910
|
+
|
911
|
+
puts "Processor Model:".ljust(25) + cpus.model.to_s.light_cyan
|
912
|
+
puts "Processor Count:".ljust(25) + cpus.count.to_s.light_cyan
|
913
|
+
puts "Physical Cores:".ljust(25) + cpus.cores.to_s.light_cyan
|
914
|
+
puts "Logical Cores:".ljust(25) + cpus.threads.to_s.light_cyan
|
915
|
+
puts "Status:".ljust(25) + cpus.status.to_s.send(health_color)
|
916
|
+
|
917
|
+
puts "=" * 50
|
918
|
+
end
|
919
|
+
end
|
920
|
+
|
866
921
|
desc "system_psus", "Get power supply information"
|
867
922
|
map "system:psus" => :system_psus
|
868
923
|
def system_psus
|
@@ -1109,22 +1164,62 @@ module IDRAC
|
|
1109
1164
|
with_idrac_client do |client|
|
1110
1165
|
info = client.system_info
|
1111
1166
|
|
1112
|
-
if info
|
1167
|
+
if info.is_dell
|
1113
1168
|
puts "Dell iDRAC System:".green.bold
|
1114
|
-
puts " Service Tag: #{info
|
1115
|
-
puts " Model: #{info
|
1116
|
-
puts " iDRAC Version: #{info
|
1117
|
-
puts " Firmware Version: #{info
|
1169
|
+
puts " Service Tag: #{info.service_tag}".cyan
|
1170
|
+
puts " Model: #{info.model}".cyan
|
1171
|
+
puts " iDRAC Version: #{info.idrac_version}".cyan
|
1172
|
+
puts " Firmware Version: #{info.firmware_version}".cyan
|
1118
1173
|
else
|
1119
1174
|
puts "Not a Dell iDRAC system".yellow
|
1120
|
-
puts " Product: #{info
|
1121
|
-
if info
|
1175
|
+
puts " Product: #{info.product}".cyan
|
1176
|
+
if info.is_ancient_dell
|
1122
1177
|
puts " Ancient Dell System detected. Update firmware.".yellow
|
1123
1178
|
end
|
1124
1179
|
end
|
1125
1180
|
end
|
1126
1181
|
end
|
1127
1182
|
|
1183
|
+
desc "system_config", "Get complete system configuration"
|
1184
|
+
map "system:config" => :system_config
|
1185
|
+
def system_config
|
1186
|
+
with_idrac_client do |client|
|
1187
|
+
response = client.authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1?$expand=*($levels=1)")
|
1188
|
+
if response.status == 200
|
1189
|
+
config = JSON.parse(response.body)
|
1190
|
+
puts JSON.pretty_generate(config)
|
1191
|
+
else
|
1192
|
+
puts "Failed to retrieve system configuration: #{response.status}".red
|
1193
|
+
end
|
1194
|
+
end
|
1195
|
+
end
|
1196
|
+
|
1197
|
+
desc "system_health", "Get system health status"
|
1198
|
+
map "system:health" => :system_health
|
1199
|
+
def system_health
|
1200
|
+
with_idrac_client do |client|
|
1201
|
+
health = client.system_health
|
1202
|
+
|
1203
|
+
puts "\nSystem Health Status:".green.bold
|
1204
|
+
puts "=" * 50
|
1205
|
+
|
1206
|
+
# Display overall health with color coding
|
1207
|
+
overall_color = health.overall == "OK" ? :green : :red
|
1208
|
+
system_color = health.system == "OK" ? :green : :red
|
1209
|
+
processor_color = health.processor == "OK" ? :green : :red
|
1210
|
+
memory_color = health.memory == "OK" ? :green : :red
|
1211
|
+
storage_color = health.storage == "OK" ? :green : (health.storage.nil? ? :yellow : :red)
|
1212
|
+
|
1213
|
+
puts "Overall Health:".ljust(25) + health.overall.to_s.send(overall_color)
|
1214
|
+
puts "System Health:".ljust(25) + health.system.to_s.send(system_color)
|
1215
|
+
puts "Processor Health:".ljust(25) + health.processor.to_s.send(processor_color)
|
1216
|
+
puts "Memory Health:".ljust(25) + health.memory.to_s.send(memory_color)
|
1217
|
+
puts "Storage Health:".ljust(25) + (health.storage || "Unknown").to_s.send(storage_color)
|
1218
|
+
|
1219
|
+
puts "=" * 50
|
1220
|
+
end
|
1221
|
+
end
|
1222
|
+
|
1128
1223
|
# Test commands
|
1129
1224
|
desc "test_live", "Test all major functionality of the gem on a real system"
|
1130
1225
|
map "test:live" => :test_live
|
data/lib/idrac/client.rb
CHANGED
@@ -21,6 +21,7 @@ module IDRAC
|
|
21
21
|
include System
|
22
22
|
include VirtualMedia
|
23
23
|
include Boot
|
24
|
+
include License
|
24
25
|
|
25
26
|
def initialize(host:, username:, password:, port: 443, use_ssl: true, verify_ssl: false, direct_mode: false, auto_delete_sessions: true, retry_count: 3, retry_delay: 1)
|
26
27
|
@host = host
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module IDRAC
|
2
|
+
module License
|
3
|
+
# Gets the license information from the iDRAC
|
4
|
+
# @return [Hash] License details
|
5
|
+
def license_info
|
6
|
+
response = authenticated_request(:get, "/redfish/v1/LicenseService/Licenses")
|
7
|
+
if response.status != 200
|
8
|
+
debug "Failed to retrieve licenses list: #{response.status}", 1, :red
|
9
|
+
return nil
|
10
|
+
end
|
11
|
+
|
12
|
+
license_data = JSON.parse(response.body)
|
13
|
+
debug "License collection: #{license_data}", 2
|
14
|
+
|
15
|
+
# Check if there are any license entries
|
16
|
+
if !license_data["Members"] || license_data["Members"].empty?
|
17
|
+
debug "No licenses found", 1, :yellow
|
18
|
+
return nil
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get the first license in the list
|
22
|
+
license_uri = license_data["Members"][0]["@odata.id"]
|
23
|
+
debug "Using license URI: #{license_uri}", 2
|
24
|
+
|
25
|
+
# Get detailed license information
|
26
|
+
license_response = authenticated_request(:get, license_uri)
|
27
|
+
if license_response.status != 200
|
28
|
+
debug "Failed to retrieve license details: #{license_response.status}", 1, :red
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
license_details = JSON.parse(license_response.body)
|
33
|
+
debug "License details: #{license_details}", 2
|
34
|
+
|
35
|
+
return license_details
|
36
|
+
end
|
37
|
+
|
38
|
+
# Extracts the iDRAC version from the license description
|
39
|
+
# @return [Integer, nil] The license version (e.g. 9) or nil if not found
|
40
|
+
def license_version
|
41
|
+
license = license_info
|
42
|
+
return nil unless license
|
43
|
+
|
44
|
+
# Check the Description field, which often contains the version
|
45
|
+
# Example: "iDRAC9 Enterprise License"
|
46
|
+
if license["Description"] && license["Description"].match(/iDRAC(\d+)/i)
|
47
|
+
version = license["Description"].match(/iDRAC(\d+)/i)[1].to_i
|
48
|
+
debug "Found license version from Description: #{version}", 1
|
49
|
+
return version
|
50
|
+
end
|
51
|
+
|
52
|
+
# Try alternative fields if Description didn't work
|
53
|
+
if license["Name"] && license["Name"].match(/iDRAC(\d+)/i)
|
54
|
+
version = license["Name"].match(/iDRAC(\d+)/i)[1].to_i
|
55
|
+
debug "Found license version from Name: #{version}", 1
|
56
|
+
return version
|
57
|
+
end
|
58
|
+
|
59
|
+
debug "Could not determine license version from license info", 1, :yellow
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/idrac/storage.rb
CHANGED
@@ -50,7 +50,8 @@ module IDRAC
|
|
50
50
|
encryption_capability: controller.dig("Oem", "Dell", "DellController", "EncryptionCapability"),
|
51
51
|
controller_type: controller.dig("Oem", "Dell", "DellController", "ControllerType"),
|
52
52
|
pci_slot: controller.dig("Oem", "Dell", "DellController", "PCISlot"),
|
53
|
-
raw: controller
|
53
|
+
raw: controller,
|
54
|
+
odata_id: controller["@odata.id"]
|
54
55
|
}
|
55
56
|
|
56
57
|
RecursiveOpenStruct.new(controller_data, recurse_over_arrays: true)
|
data/lib/idrac/system.rb
CHANGED
@@ -367,29 +367,72 @@ module IDRAC
|
|
367
367
|
system_data = JSON.parse(system_response.body)
|
368
368
|
info[:model] = system_data["Model"]
|
369
369
|
end
|
370
|
+
|
371
|
+
return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
|
370
372
|
else
|
371
|
-
#
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
chassis_data = JSON.parse(chassis_response.body)
|
376
|
-
if chassis_data["Manufacturer"] && chassis_data["Manufacturer"].include?("Dell")
|
377
|
-
info[:is_ancient_dell] = true
|
378
|
-
info[:model] = chassis_data["Model"]
|
379
|
-
info[:service_tag] = chassis_data["SKU"] || chassis_data["SerialNumber"]
|
380
|
-
end
|
381
|
-
end
|
382
|
-
rescue
|
383
|
-
# Ignore errors while checking for ancient Dell
|
373
|
+
# Try to handle ancient Dell models where Product is null or non-standard
|
374
|
+
if data["Product"].nil? || data.dig("Oem", "Dell")
|
375
|
+
info[:is_ancient_dell] = true
|
376
|
+
return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
|
384
377
|
end
|
385
378
|
end
|
386
379
|
|
387
|
-
return info
|
380
|
+
return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
|
381
|
+
rescue JSON::ParserError
|
382
|
+
raise Error, "Failed to parse system information: #{response.body}"
|
383
|
+
end
|
384
|
+
else
|
385
|
+
raise Error, "Failed to get system information. Status code: #{response.status}"
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
# Get processor/CPU information
|
390
|
+
def cpus
|
391
|
+
response = authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1?$expand=*($levels=1)")
|
392
|
+
|
393
|
+
if response.status == 200
|
394
|
+
begin
|
395
|
+
data = JSON.parse(response.body)
|
396
|
+
|
397
|
+
summary = {
|
398
|
+
count: data.dig("ProcessorSummary", "Count"),
|
399
|
+
model: data.dig("ProcessorSummary", "Model"),
|
400
|
+
cores: data.dig("ProcessorSummary", "CoreCount"),
|
401
|
+
threads: data.dig("ProcessorSummary", "LogicalProcessorCount"),
|
402
|
+
status: data.dig("ProcessorSummary", "Status", "Health")
|
403
|
+
}
|
404
|
+
|
405
|
+
return RecursiveOpenStruct.new(summary, recurse_over_arrays: true)
|
406
|
+
rescue JSON::ParserError
|
407
|
+
raise Error, "Failed to parse processor information: #{response.body}"
|
408
|
+
end
|
409
|
+
else
|
410
|
+
raise Error, "Failed to get processor information. Status code: #{response.status}"
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
# Get system health status
|
415
|
+
def system_health
|
416
|
+
response = authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1?$expand=*($levels=1)")
|
417
|
+
|
418
|
+
if response.status == 200
|
419
|
+
begin
|
420
|
+
data = JSON.parse(response.body)
|
421
|
+
|
422
|
+
health = {
|
423
|
+
overall: data.dig("Status", "HealthRollup"),
|
424
|
+
system: data.dig("Status", "Health"),
|
425
|
+
processor: data.dig("ProcessorSummary", "Status", "Health"),
|
426
|
+
memory: data.dig("MemorySummary", "Status", "Health"),
|
427
|
+
storage: data.dig("Storage", "Status", "Health")
|
428
|
+
}
|
429
|
+
|
430
|
+
return RecursiveOpenStruct.new(health, recurse_over_arrays: true)
|
388
431
|
rescue JSON::ParserError
|
389
|
-
raise Error, "Failed to parse system
|
432
|
+
raise Error, "Failed to parse system health information: #{response.body}"
|
390
433
|
end
|
391
434
|
else
|
392
|
-
raise Error, "Failed to get system
|
435
|
+
raise Error, "Failed to get system health. Status code: #{response.status}"
|
393
436
|
end
|
394
437
|
end
|
395
438
|
|
data/lib/idrac/version.rb
CHANGED
data/lib/idrac.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idrac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Siegel
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- lib/idrac/firmware.rb
|
242
242
|
- lib/idrac/firmware_catalog.rb
|
243
243
|
- lib/idrac/jobs.rb
|
244
|
+
- lib/idrac/license.rb
|
244
245
|
- lib/idrac/lifecycle.rb
|
245
246
|
- lib/idrac/power.rb
|
246
247
|
- lib/idrac/session.rb
|