-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(FACT-2040) Added solaris memory resolver
- Loading branch information
Showing
32 changed files
with
937 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class Available | ||
FACT_NAME = 'memory.swap.available' | ||
ALIASES = 'swapfree' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:available_bytes]) | ||
end | ||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class AvailableBytes | ||
FACT_NAME = 'memory.swap.available_bytes' | ||
ALIASES = 'swapfree_mb' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
fact_value = fact_value[:available_bytes] if fact_value | ||
|
||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), | ||
Facter::ResolvedFact.new(ALIASES, Facter::FactsUtils::UnitConverter.bytes_to_mb(fact_value), :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class Capacity | ||
FACT_NAME = 'memory.swap.capacity' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
fact_value = fact_value[:capacity] if fact_value | ||
|
||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class Total | ||
FACT_NAME = 'memory.swap.total' | ||
ALIASES = 'swapsize' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:total_bytes]) | ||
end | ||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class TotalBytes | ||
FACT_NAME = 'memory.swap.total_bytes' | ||
ALIASES = 'swapsize_mb' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
fact_value = fact_value[:total_bytes] if fact_value | ||
|
||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), | ||
Facter::ResolvedFact.new(ALIASES, Facter::FactsUtils::UnitConverter.bytes_to_mb(fact_value), :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class Used | ||
FACT_NAME = 'memory.swap.used' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:used_bytes]) | ||
end | ||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module Swap | ||
class UsedBytes | ||
FACT_NAME = 'memory.swap.used_bytes' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:swap) | ||
fact_value = fact_value[:used_bytes] if fact_value | ||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class Available | ||
FACT_NAME = 'memory.system.available' | ||
ALIASES = 'memoryfree' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:available_bytes]) | ||
end | ||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class AvailableBytes | ||
FACT_NAME = 'memory.system.available_bytes' | ||
ALIASES = 'memoryfree_mb' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
fact_value = fact_value[:available_bytes] if fact_value | ||
|
||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), | ||
Facter::ResolvedFact.new(ALIASES, Facter::FactsUtils::UnitConverter.bytes_to_mb(fact_value), :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class Capacity | ||
FACT_NAME = 'memory.system.capacity' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
fact_value = fact_value[:capacity] if fact_value | ||
|
||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class Total | ||
FACT_NAME = 'memory.system.total' | ||
ALIASES = 'memorysize' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:total_bytes]) | ||
end | ||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class TotalBytes | ||
FACT_NAME = 'memory.system.total_bytes' | ||
ALIASES = 'memorysize_mb' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
fact_value = fact_value[:total_bytes] if fact_value | ||
|
||
[Facter::ResolvedFact.new(FACT_NAME, fact_value), | ||
Facter::ResolvedFact.new(ALIASES, Facter::FactsUtils::UnitConverter.bytes_to_mb(fact_value), :legacy)] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class Used | ||
FACT_NAME = 'memory.system.used' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
if fact_value | ||
fact_value = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(fact_value[:used_bytes]) | ||
end | ||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Facts | ||
module Solaris | ||
module Memory | ||
module System | ||
class UsedBytes | ||
FACT_NAME = 'memory.system.used_bytes' | ||
|
||
def call_the_resolver | ||
fact_value = Facter::Resolvers::Solaris::Memory.resolve(:system) | ||
fact_value = fact_value[:used_bytes] if fact_value | ||
Facter::ResolvedFact.new(FACT_NAME, fact_value) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.