Hello everyone,
I hope this is the correct place to ask about the sensu-puppet module. I could find no better place but if there is one, please let me know.
I’m working on puppetizing our sensu server deploy and configuration. It work quite well but there is one thing I can’t get to work and I can’t find any documentation on how it should work. I’m using the latest version of sensu and the puppet module.
The issue
After the initial puppet run I get this error
Error: /Stage[main]/Sensu::Rabbitmq::Config/Sensu_rabbitmq_config[sensu-26-0.foo.bar]: Could not evaluate: no implicit conversion of String into Integer
If I remove /etc/sensu/conf.d/rabbitmq.json the next puppet run will run fine but the following one fails with the same error.
I’m trying to use **rabbitmq_cluster (**https://github.com/sensu/sensu-puppet/blob/master/manifests/init.pp#L157-L159)
The only documentation I can find is that rabbitmq_cluster should be **"**Array of hashes. Rabbitmq Cluster configuration and connection information for one or more Cluster"
In hiera I have
sensu::rabbitmq_cluster:
-
port: 5671
host: 192.168.113.9
user: sensu
password: REDACTED
vhost: “sensu”
heartbeat: 30
prefetch: 50
ssl: {
cert_chain_file: “/etc/sensu/ssl/cert.pem”,
private_key_file: “/etc/sensu/ssl/key.pem”
}
-
port: 5671
host: 192.168.113.10
user: sensu
password: REDACTED
vhost: “sensu”
heartbeat: 30
prefetch: 50
ssl: {
cert_chain_file: “/etc/sensu/ssl/cert.pem”,
private_key_file: “/etc/sensu/ssl/key.pem”
}
-
port: 5671
host: 192.168.113.11
user: sensu
password: REDACTED
vhost: “sensu”
heartbeat: 30
prefetch: 50
ssl: {
cert_chain_file: “/etc/sensu/ssl/cert.pem”,
private_key_file: “/etc/sensu/ssl/key.pem”
}
That will generate a working /etc/sensu/conf.d/rabbitmq.json that looks like this
sensu-26-0 /root # cat /etc/sensu/conf.d/rabbitmq.json
{
“rabbitmq”: [
{
"port": 5671,
"host": "192.168.113.9",
"user": "sensu",
"password": "REDACTED",
"vhost": "sensu",
"heartbeat": 30,
"prefetch": 50,
"ssl": {
"cert_chain_file": "/etc/sensu/ssl/cert.pem",
"private_key_file": "/etc/sensu/ssl/key.pem"
}
},
{
"port": 5671,
"host": "192.168.113.10",
"user": "sensu",
"password": "REDACTED",
"vhost": "sensu",
"heartbeat": 30,
"prefetch": 50,
"ssl": {
"cert_chain_file": "/etc/sensu/ssl/cert.pem",
"private_key_file": "/etc/sensu/ssl/key.pem"
}
},
{
"port": 5671,
"host": "192.168.113.11",
"user": "sensu",
"password": "REDACTED",
"vhost": "sensu",
"heartbeat": 30,
"prefetch": 50,
"ssl": {
"cert_chain_file": "/etc/sensu/ssl/cert.pem",
"private_key_file": "/etc/sensu/ssl/key.pem"
}
}
]
}
That looks like what I want to see based on the latests Sensu documentation
https://sensuapp.org/docs/0.26/reference/rabbitmq.html#configure-sensu-to-use-the-rabbitmq-cluster
Problem/Cause
This behavior seems to be caused by https://github.com/sensu/sensu-puppet/blob/master/lib/puppet/provider/sensu_rabbitmq_config/json.rb which seems to be reading the active rabbitmq.json from disk before attempting to make changes. This read fails, or that is my interpretation to the situation. I do not know Ruby so I might very well be completely wrong. It also seems that the json.br does not know heartbeat and prefetch but leaving them out does not change the situation.
If anyone has used rabbitmq_cluster succesfully, could you please let me know how you structured your list of hashes.
Cheers,
AB