Closed willejs closed 9 years ago
@michaelklishin you are quite right. I have resolved the issue.
@sethrosenblum This is interesting, i tested this and didn't see this behaviour. I must have been doing something wrong. Moving the only_if before the variable function call would be the first logical step perhaps, changing the config value from nil to an empty hash would also be a fix but less efficient, but probably should be done too.
I presumed that only_if was called before resource compilation, but am obviously wrong. I am going to read the sourcecode now.
I will submit a patch for this tomorrow and test it.
@sethrosenblum see pr above.
thanks!
Do you have an example of a working hash for the metrics file? I'm trying to use (for example):
node.default['cassandra']['metrics_reporter']['config'] = {
"hostname1.test.com"=> {"public"=>"51", "private"=>"10"},
"hostname2.test.com"=> {"public"=>"192", "private"=>"12"}
}
However, it gets emitted as
---
hostname1.test.com: !ruby/hash:Chef::Node::ImmutableMash
public: '51'
private: '10'
hostname2.test.com: !ruby/hash:Chef::Node::ImmutableMash
public: '192'
private: '12'
You can see the ImmutableHash errors. I'm sure I'm missing something in my hash, so just a working example would be great. Thanks!
@dcparker88 I will add this to the readme.
node.override['cassandra']['metrics_reporter'] = {
"enabled" => true,
"config" => {
"graphite" => [{
"timeunit" =>"SECONDS",
"hosts" => [{
"host" => "graphite.somewhere.net",
"port" => 2003
}],
"prefix" => "servers.#{node.chef_environment}.#{node.name.gsub('.','-')}.cassandra",
"period" => 60,
"predicate" => {
"useQualifiedName" => true,
"patterns" => [
"^org.apache.cassandra.metrics.Cache.+",
"^org.apache.cassandra.metrics.ClientRequest.+",
"^org.apache.cassandra.metrics.CommitLog.+",
"^org.apache.cassandra.metrics.Compaction.+",
"^org.apache.cassandra.metrics.Connection.+",
"^org.apache.cassandra.metrics.DroppedMessage.+",
"^org.apache.cassandra.metrics.Streaming.+",
"^org.apache.cassandra.metrics.Storage.+",
"^org.apache.cassandra.metrics.ThreadPools.+"
]
}
}]
}
}
Thanks. Turned out to be an older version of chef on the vagrant box I was using.
This adds by default the graphite metrics reporter library as it is the most common usecase. In future one should be able to add several additional libraries, but for now this will do.