Custodian is a lightweight resource monitor that makes it really easy and really awesome to sample metrics.
Start Custodian and configure it to expose metrics on port 5100:
$ custodian --port=5100
Custodian aggregates metrics from samplers, and ships with a whole bunch of them for popular figures like CPU, RAM and disk usage. That's interesting and all, but custom samplers are all the rage:
class RegisteredUsers < Custodian::Samplers::Sampler
describe "Registered users"
def self.sample
Users.count
end
end
Samplers are just Ruby classes that inherit from Custodian::Samplers::Sampler
and implement a sample
method, and you can load your own with the --samplers
option.
$ custodian --samplers=~/.samplers
Unless you're crazy about JSON, you'll want to consume Custodian's API with a client. There are no clients for Custodian yet, but you should totally make one.
Johannes Gorset made this. You should tweet me if you can't get it to work. In fact, you should tweet me anyway.