Files
ubicloud/rhizome/host/bin/collect-stats
Hadi Moshayedi 4c33fc8b35 Stats Collection Prototype
Automatically collects cpu & memory & network usage stats for each VM
every minute and appends it to `/vm/logs/$vmname.log`.

An example row in that log file looks like:

```
{"cpu_usage_usec":114769860,"memory_total_kb":8128676,
"memory_free_kb":6120912,"rx_bytes":313094089,
"tx_bytes":4107151,"timestamp":"2025-01-23T04:58:13Z"}
```

We will most likely revise where we store the stats. This is just a
prototype to try different pieces end-to-end. What & how we collect
stats is also subject to change.
2025-01-23 08:25:39 -08:00

18 lines
359 B
Ruby
Executable File

#!/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/stats_collection"
unless (vm_name = ARGV.shift)
puts "expected path to vm_name as argument"
exit 1
end
unless (slice_name = ARGV.shift)
puts "expected slice name as argument"
exit 1
end
stats_collection = StatsCollection.new(vm_name, slice_name)
stats_collection.record_stats