File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,8 @@ module SystemMetrics
109109 #combine the arrays into a hash starting from the deal with the unmatched columns in the front
110110 data_hash = Hash [ headers_line . reverse . zip ( averages_line . reverse ) . reverse ]
111111 # remove anything that doesn't have a number for an average like "Average:" or "all"
112- data_hash . select { |k , v | v =~ /\A [-+]?[0-9]*\. ?[0-9]+\Z / }
112+ data_hash . select! { |k , v | v =~ /\A [-+]?[0-9]*\. ?[0-9]+\Z / }
113+ data_hash . transform_values! ( &:to_f )
113114 end
114115
115116 # Convert the inputted sar output into json and raise errors if the sar output is invalid
@@ -124,7 +125,7 @@ module SystemMetrics
124125 # @return [string] json of sar output
125126 def convert_sar_output_to_json ( sar_output , time_stamp_obj )
126127 hostkey = @hostname . gsub ( '.' , '-' )
127- dataset = { 'time_stamp_obj ' => time_stamp_obj . utc . iso8601 , 'servers' => { } }
128+ dataset = { 'timestamp ' => time_stamp_obj . utc . iso8601 , 'servers' => { } }
128129 metrics_data = parse_sar_output ( sar_output )
129130 dataset [ 'servers' ] [ hostkey ] = { @metric_type => metrics_data }
130131 json_dataset = JSON . pretty_generate ( dataset )
You can’t perform that action at this time.
0 commit comments