rackspace-cookbooks / rackspace_cloud_monitoring

DEPRECATED, use https://github.com/rackspace-cookbooks/rackspace_monitoring instead
Other
1 stars 1 forks source link

Monitoring doesn't work on OnMetal servers without manually set hostname #15

Open erulabs opened 9 years ago

erulabs commented 9 years ago

Hello friends!

Thanks for the excellent cookbook! I love it!

It looks like there is an issue when working with Rackspace OnMetal servers. The error comes from the function which generates the systems hostname: https://github.com/rackspace-cookbooks/rackspace_cloud_monitoring/blob/master/libraries/helpers.rb#L60

OnMetal has no such attribute node['cloud']['public_ipv4'] - so a manually set target_hostname needs to be assigned.

I'll play around a bit and try to find a better solution. I'd think "node.name" would suffice, but I'm not sure if that hostname needs to be an FQDN or not. If I can find a solution, I'll issue a nice PR for ya'll as I am interested in helping contribute to this repo!

Edit: It looks like OnMetal has simply node['ipaddress'] :+1:

Thanks!

jujugrrr commented 9 years ago

@erulabs Thanks for the feedback!

The scope is quite reduced so far, and only pure cloud is supported. If you submit a PR with the appropriate tests it would be awesome. Otherwise I'll try to to find time or resource to work on it.

If you start to look at the code you'll see some assumptions are made in order to reduce complexity (like this "there is always a public_ipv4"). Hopefully there is enough test to refactor the libraries to make it support more thing, or be more flexible!

The fix should be pretty easy, as we just need to fallback yo ipaddress from what you say. We can even add an onmetal context in specs as this public_ipv4 attribute is created in Chefspec : https://github.com/rackspace-cookbooks/rackspace_cloud_monitoring/blob/master/test/unit/spec/spec_helper.rb#L15