Comments (13)
I will take a look for you tomorrow.
Basically you first need to create the command.
It's probably an order issue with the data bag import.
But unable to check this at the moment.
Greetings sander
Sent from my iPhone
On 30 Mar 2015, at 23:16, Joshua Seidel <[email protected]mailto:[email protected]> wrote:
anyone know how to get passed this? i cant get this to do updates, when i create contacts, it either asks me for the commands in the contact databag or throws the error in the subject.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/353.
from nagios.
@sbotman thanks sander, also if i want to disable or limit the search by a attribute?
we want to create a nagios instance for each region. so usva should only find nodes that start with usva-. is there a way to disable finding things by environment and only find things by "region"?
from nagios.
@blueharford Joshua, can you please test if this branch is working for you https://github.com/tas50/nagios/tree/fixing_353
About the search question:
We have disabled the default config and databag loading by setting the attributes within a wrapper cookbook:
default['nagios']['server']['load_default_config'] = false
default['nagios']['server']['load_databag_config'] = false
Then we use partial search (to offload the searches) to lookup the nodes and grab all the attributes that we would like to enable.
example:
nodes = []
multi_env = node['nagios']['monitored_environments']
multi_env_search = multi_env.empty? ? '' : ' AND (chef_environment:' + multi_env.join(' OR chef_environment:') + ')'
if node['nagios']['multi_environment_monitoring']
nodes = partial_search(:node, "name:*#{multi_env_search}",
:keys => { 'hostname' => ['hostname'],
'name' => ['name'],
'fqdn' => ['fqdn'],
'os' => ['os'],
'family' => ['platform_family'],
'roles' => ['roles'],
'env' => ['chef_environment'],
'nagios' => ['nagios'],
}
)
else
nodes = partial_search(:node, "name:* AND chef_environment:#{node.chef_environment}",
:keys => { 'hostname' => ['hostname'],
'name' => ['name'],
'fqdn' => ['fqdn'],
'os' => ['os'],
'family' => ['platform_family'],
'roles' => ['roles'],
'env' => ['chef_environment'],
'nagios' => ['nagios'],
}
)
end
nodes.each do |v|
Chef::Log.debug("Nagios: Adding host to configuration with name: #{v['name']}")
if v[node['nagios']['hostname_selection']].nil?
host = Nagios::Host.create(v['name'])
else
host = Nagios::Host.create(v[node['nagios']['hostname_selection']])
end
groups = v['roles'].nil? ? [] : v['roles']
groups += [v['os']] unless v['os'].nil?
groups += [v['env']] unless v['env'].nil?
groups.each do |group|
hg = Nagios::Hostgroup.create(group)
hg.push(host)
host.push(hg)
end
end
search(:role, '*:*') do |role|
Nagios::Hostgroup.create(role.name)
end
Something like this.... If this doesn't help you then we might need to talk about this :)
from nagios.
hmm so i want the databags to be used but i just want to customize the search for what gets added.
so all databags load, but when it searches for nodes in chef, instead of it looking by environment i'd like it to look at the first 3 letters of the node name for matching.
from nagios.
Recipe: nagios::default
-
directory[/etc/nagios/dist] action create (up to date)
-
directory[/var/lib/nagios] action create (up to date)
-
directory[/var/lib/nagios/rw] action create (up to date)
-
execute[archive-default-nagios-object-definitions] action run (skipped due to not_if)
-
directory[/etc/nagios/certificates] action create (up to date)
-
bash[Create SSL Certificates] action run
- execute "bash" "/tmp/chef-script20150401-14297-1lz48q9"
-
template[/etc/nagios/nagios.cfg] action create (up to date)
-
template[/etc/nagios/cgi.cfg] action create (up to date)
-
nagios_resourcelist_items[update] action update
Error executing action
update
on resource 'nagios_resourcelist_items[update]'RuntimeError
Nagios::Contact fail: Cannot find command host_notify_by_email please define it first.
Cookbook Trace:
/var/chef/cache/cookbooks/nagios/libraries/base.rb:245:in
block in notification_commands' /var/chef/cache/cookbooks/nagios/libraries/base.rb:241:in
each'
/var/chef/cache/cookbooks/nagios/libraries/base.rb:241:innotification_commands' /var/chef/cache/cookbooks/nagios/libraries/contact.rb:76:in
host_notification_commands='
/var/chef/cache/cookbooks/nagios/libraries/base.rb:276:inblock in update_hash_options' /var/chef/cache/cookbooks/nagios/libraries/base.rb:274:in
update_hash_options'
/var/chef/cache/cookbooks/nagios/libraries/base.rb:269:inupdate_options' /var/chef/cache/cookbooks/nagios/libraries/contact.rb:88:in
import'
/var/chef/cache/cookbooks/nagios/providers/resourcelist_items.rb:61:inupdate_object' /var/chef/cache/cookbooks/nagios/providers/resourcelist_items.rb:26:in
block (2 levels) in class_from_file'
/var/chef/cache/cookbooks/nagios/providers/resourcelist_items.rb:21:in `block in class_from_file'Resource Declaration:
In /var/chef/cache/cookbooks/nagios/recipes/default.rb
169: nagios_resourcelist_items 'update'
170:Compiled Resource:
Declared in /var/chef/cache/cookbooks/nagios/recipes/default.rb:169:in `from_file'
nagios_resourcelist_items("update") do
action :update
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :nagios_resourcelist_items
cookbook_name "nagios"
recipe_name "default"
end
from nagios.
@sbotman it works if i add pagerduty as a contact.. but then it doesnt configure it right as defined in pagerduty.rb . should default.rb be calling pagerduty.rb if so where?
from nagios.
Hi Joshua, did you also test the branch https://github.com/tas50/nagios/tree/fixing_353 ?
from nagios.
@sbotman i grabbed the last commit then made the change. but im not finding it clear on how to invoke pagerduty.
im seeing this in the contacts.cfg
Skipping pagerduty because missing email.
from nagios.
@sbotman ok so apparently it created a pagerduty.conf with the contact. so i had to add include_recipe "nagios::pagerduty" in default right before the update resource and all is happy.
from nagios.
Great!
To be very honest, I personally never used the data bag setup. And if we use it, we don't do very much with it. Yesterday GitBytes opened issue #354 which took me some time to fix. Think that these changes are also useful for your setup and it would be great if you can test that branch. The fix provided here above is also merged into that branch.
Please let me know the result :)
Cheers Sander
from nagios.
@sbotman yea it works. the only issue i have now. is that i dont want it to scan by environment. i'd likefor their to be an option where i can do default['nagios']['node']['hostname_match'] = 'b1p' would only auto add servers that node name starts with b1p. since we have mutltiple regions
from nagios.
@blueharford if you have setup your chef-environments per region, then you can use the following attributes:
default['nagios']['multi_environment_monitoring'] = false
default['nagios']['monitored_environments'] = []
Otherwise you will need to create some custom code like the example I gave here above.
The configuration is fully provider driven and you can put all your needs within recipes, please check the wiki https://github.com/tas50/nagios/wiki. If this still doesn't help you, you can contact me on skype under [email protected] and I will help you.
Cheers Sander
from nagios.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from nagios.
Related Issues (20)
- Negative values should not be interpreted as normal items for auto-creation HOT 1
- pop() should work, Hash does not have a keys? method
- pop() should work, argument errors HOT 2
- How to know the host problem ID and Service problem ID in nagios XI for particualr host HOT 2
- systemd service should match configured command_file location HOT 1
- why was Centos 6 removed in #534 HOT 2
- Issue for "nagios.configtest error" on nagios versions >=4.3.3 HOT 2
- server_source recipe calls nonexistent php recipe HOT 2
- Fetching nagios host objects from Nagios Instance HOT 2
- Chef not pulling in Unmanaged Hosts HOT 2
- Dangerfile should use failure instead of fail
- Remove .rubocop.yml with Dangerfile HOT 1
- Update Changelog HOT 2
- Run latest cookstyle
- Update builds to be parallel HOT 1
- Problem with hostgroups HOT 2
- Dependency Dashboard
- Use the service "servicegroups" directive or the servicegroup "members" directive, but not both
- Commas missing from update to metadata.rb HOT 1
- Enable Wiki
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nagios.