Class: Opstat::Plugins::OracleFrasSizes
- Inherits:
-
Task
- Object
- Task
- Opstat::Plugins::OracleFrasSizes
- Defined in:
- lib/plugins/oracle_fras_sizes.rb
Instance Method Summary collapse
-
#initialize(name, queue, config) ⇒ OracleFrasSizes
constructor
A new instance of OracleFrasSizes.
- #parse ⇒ Object
- #sql_cmd ⇒ Object
Constructor Details
#initialize(name, queue, config) ⇒ OracleFrasSizes
Returns a new instance of OracleFrasSizes.
7 8 9 10 11 12 13 |
# File 'lib/plugins/oracle_fras_sizes.rb', line 7 def initialize (name, queue, config) super(name, queue, config) self @su_user = config['su_user'] @db_user = config['db_user'] @db_password = config['db_password'] end |
Instance Method Details
#parse ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/plugins/oracle_fras_sizes.rb', line 35 def parse report = [] @cmd ||= sql_cmd.result(binding) oracle_output = IO.popen(@cmd) report = oracle_output.readlines.join oracle_output.close return report end |
#sql_cmd ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/plugins/oracle_fras_sizes.rb', line 15 def sql_cmd @query ||= ERB.new "su - <%= @su_user %> -c 'echo \" set pagesize 10000\n set heading on\n set linesize 150\n column dummy noprint\n column name format a60 heading \\\\\\\"Path\\\\\\\"\n column space_limit format 999999999999999 heading \\\"Total\\\"\n column space_used format 999999999999999 heading \\\"Used\\\"\n column number_of_files format 999999999999999 heading \\\"Files\\\"\n\n select name,\n space_limit,\n space_used,\n number_of_files\n from v\\\\\\$recovery_file_dest;\n \"|sqlplus -S <%= @db_user %>/<%= @db_password %>' \n" end |