Sure. I will work up a pull request, but if you want something sooner:
in server.rb:
Additional nodes to be monitored which aren't managed by chef can be
added through nagios.additional_hosts attributes
add_nodes = Array.new
add_nodes = node['nagios']['additional_hosts'] if
node['nagios'].attribute?('additional_hosts')
Iterate over the hosts defined in the environment and add them to the
hostgroups and nodes
if (add_nodes && !add_nodes.empty?)
add_nodes.each do |add_node|
service_hosts[add_node['hostgroups']] = add_node['host_name']
role_list << add_node['hostgroups'] unless role_list.include?
add_node['hostgroups']
end
end
In the environments that I have additional servers/devices that I want
monitored I add an array of hashes that contain "address", "host_name", and
"hostgroups" values. It looks like this:
"additional_hosts": [
{
"address": "192.168.30.72",
"host_name": "acient",
"hostgroups": "pillar_app"
},
{
"address": "192.168.30.50",
"host_name": "elderly",
"hostgroups": "foundation"
}
]
In the hosts.cfg.erb template I've added:
###################################################
Additional Servers
<% @add_nodes.each do |n| -%>
define host {
use server
<% n.each do |k,v| %>
<%= k + " " + v %>
<% end -%>
}
<% end -%>
I'm sure there is some other change that I'm forgetting, but hope that
helps.
Thanks,
Jake.
On Mon, Aug 13, 2012 at 10:57 AM, Tim Smith Tim.Smith@webtrends.com wrote:
Any chance you could share that clientless code? I was about to whip
something up to handle that exact scenario. I have a lot of old systems
that aren't managed with Chef and probably never will be that I still need
to monitor in some fashion.
On 13 August 2012 00:48, Tim Smith Tim.Smith@webtrends.com wrote:
I'd love to get feedback from the community on the current state of the
Nagios cookbook. Automated monitoring of systems is in my opinion probably
the coolest feature of a configuration management systems, and a large
number of people are using Nagios. The Nagios cookbook needed / needs some
love though. I've been doing a lot of work on the cookbook lately since it
was lacking functionality I needed and was outright broken in a lot of
ways. I know there's a lot left to do and hopefully you guys can provide
some input on what's necessary.
If you used the cookbook and it didn't work for you what problems did
you run into?
If you had to modify the cookbook with hard coded values (my biggest
issue) for your environment what was lacking that forced you to do this?
In general what would you like to see that isn't there yet?
The main problem I have with the nagios cookbook was monitoring systems
not covered by chef without hard coding them into recipes or templates for
things like firewalls, routers, switches, printers, etc. I ended up hacking
the code to support a data_bag "clientless" which I could list items in
there and the nagios checks that apply to them.
What I've added that hopefully should get merged in the next release
cycle:
- Defining Event handlers from data bags
- Optional support for monitoring hosts in multiple environments
- Support for environments with Windows hosts without applying Linux
checks that will always fail
- Support for defining nagios host groups from chef search queries
stored in data bags
- Install Nagios 3.4.1 not 3.2.3 when installing from source
- Support for installing the server from source, while installing the
client from package (if you just want a newer server than Ubuntu packages)
- Fixed source installs of the server to actually work
Look forward to this alot of these are why I am stilled force to run my
pre-chef nagios solution as well to cover them.
What I still need to get pushed upstream
- Support for installing NRPE via EPEL packages on RHEL distros
instead of compiling from source
- Ability to define blacklisted chef environments (preprod/dev) where
host/service alerting is disabled
- The Nagios user needs passwordless sudo out of the box to perform
most NRPE checks
So if you have some time let me know your experiences
*Tim Smith*
Operations Engineer, SaaS Operations
M: +1 707.738.8132
TW: @tas50
webtrends http://www.webtrends.com/
Real-Time Relevance. Remarkable ROI.™
London | Portland | San Francisco | Melbourne | Tokyo