Skip to content

Commit 5f97444

Browse files
authored
Merge pull request #31 from jarretlavallee/fix/master/generate_metrics_timestamp
Update the system metrics timestamp key
2 parents 627c17c + b10a436 commit 5f97444

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

files/generate_system_metrics

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)