[chef] Re: Nagios Service for Hostgroup without any Nodes


Chronological Thread 
  • From: Nikhil Shah < >
  • To: " " < >
  • Cc: " " < >
  • Subject: [chef] Re: Nagios Service for Hostgroup without any Nodes
  • Date: Thu, 19 Sep 2013 18:43:04 -0400

I'm sure there is a better solution, but couldn't you just not pass the loadbancer role for the environment "staging". When you are ready to implement a LB in staging u could always do something like knife node edit XXXX, add that role to staging and run chef- client (unless you have a ton of these servers).

Thanks,

Nikhil Shah

On Sep 19, 2013, at 6:13 PM, Graham Christensen < "> > wrote:

Hello,

I'm a bit hung up on a problem with the Nagios cookbook when using host groups without any nodes. Here's the situation:

 I have a `loadbalancer-snowflake` role. This is so I can monitor the loadbalancers without rebuilding them (which I will, but not for a few months.)

In the `production` environment, I have a few of these nodes. However, in the `staging` environment, I don't have any of them.

The effect of this is it creates the host group block:

define hostgroup {
  hostgroup_name loadbalancer-snowflake
  alias loadbalancer-snowflake
}

And the command block (this is on the server, since it is performed remotely):

define command {
  command_name    check_loadbalancer-snowflake-http
  command_line    $USER1$/check_http -I $HOSTADDRESS$ -e "HTTP/1.1 200" -w 3 -c 5
}

However when it adds the service block:

define service {
  service_description loadbalancer-snowflake-http
  hostgroup_name loadbalancer-snowflake
  check_command check_loadbalancer-snowflake-http
  use default-service
}


it complains about "Could not expand hostgroups and/or hosts specified in service". This is because the Hostgroup is empty.

Has anyone experienced before? Is there a good solution to it? I considered altering it to not output the service if no hosts exist for it, but then found this monstrosity: https://github.com/opscode-cookbooks/nagios/blob/master/templates/default/services.cfg.erb#L17

I'd be willing to submit a PR to alter this behavior, but it looks like this might require a semi-substantial change. Any feedback to that point?

This cookbook could use refactoring :)

Graham



Archive powered by MHonArc 2.6.16.

§