Coder Social home page Coder Social logo

sous-chefs / nagios Goto Github PK

View Code? Open in Web Editor NEW
125.0 46.0 272.0 1.92 MB

Development repository for the nagios cookbook

Home Page: https://supermarket.chef.io/cookbooks/nagios

License: Apache License 2.0

Ruby 87.34% HTML 10.48% Perl 2.15% Shell 0.03%
chef-cookbook chef-resource nagios chef hacktoberfest managed-by-terraform

nagios's Issues

Stylesheets Missing

The apache config contains this:

Alias /stylesheets /etc/nagios3/stylesheets
Alias /nagios3/stylesheets /etc/nagios3/stylesheets

But /etc/nagios3/stylesheets doesn't exist, so the web interface is un-styled.

5.3.2 and newer - web_srv not defined

There is small bug in the server.rb or default.rb recipe. The 'web_serv' is not configured. You want to assing it value of node['nagios']['server']['web_server'] or use this attribute instead.

case node['nagios']['server_auth_method']
when 'openid'
  if web_srv == 'apache'

OS hostgroups are not being templated

   Processing object config file '/etc/nagios3/conf.d/commands.cfg'...
   Processing object config file '/etc/nagios3/conf.d/hostgroups.cfg'...
   Processing object config file '/etc/nagios3/conf.d/hosts.cfg'...
   Processing object config file '/etc/nagios3/conf.d/timeperiods.cfg'...
   Processing object config file '/etc/nagios3/conf.d/servicegroups.cfg'...
   Error: Could not find any hostgroup matching 'linux' (config file '/etc/nagios3/conf.d/hosts.cfg', starting on line 5)
      Error processing object config files!


   ***> One or more problems was encountered while processing the config files...

        Check your configuration file(s) to ensure that they contain valid
        directives and data defintions.  If you are upgrading from a previous
        version of Nagios, you should be aware that some variables/definitions
        may have been removed or modified in this version.  Make sure to read
        the HTML documentation regarding the config files, as well as the
        'Whats New' section to find out what has changed.

    * errors in config!
      ...fail!
   STDERR:
   ---- End output of /etc/init.d/nagios3 reload ----
   Ran /etc/init.d/nagios3 reload returned 6

pagerduty_key and pagerduty.key required on node when using nagios_pagerduty data bag

Chef run fails on nagios node puts pagerduty.key = null in the node.
Tried making it a number or string, as well as deleting it entirely and it would always come back as null.

Workaround is to have a fake value for both pagerduty.key and pagerduty_key:

"nagios": {
"pagerduty_key": "999",
"pagerduty": {
"key": "888"
},

After chef run completed successfully the node shows
"nagios": {
"pagerduty_key": "888",
"pagerduty": {
"key": "888"
},

/etc/nagios3/conf/pagerduty.cfg has a contact of 888 as well as my data bag one.

Please make that section in the node not required if using a data bag.

Failure when creating servicegroups

When a servicegroup data bag item is defined the cookbook will fail when trying to call Servicegroup.create, it is not defined.

================================================================================
Error executing action `update` on resource 'nagios_resourcelist_items[update]'
================================================================================


NoMethodError
-------------
undefined method `create' for Nagios::Servicegroup:Class


Cookbook Trace:
---------------
/var/chef/cache/cookbooks/nagios/providers/resourcelist_items.rb:60:in `update_object'
/var/chef/cache/cookbooks/nagios/providers/resourcelist_items.rb:46: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
  cookbook_name "nagios"
  recipe_name "default"
end

use only monitored node['nagios']['monitoring_interface'] - ip_to_monitor

If I propose to change last line in next code copy/paste from libraries.

UseCase:
I have node (that unlikly to other hosts has primary interface eth1 instead eth0. I was about to set node properties to node['nagios']['monitoring_interface'] on given node however the original def ip_to_monitor uses the monitoring server value for this attribute while calculating the node IP to be monitored.

The proposed change, (last two lines) From:

# decide whether to use internal or external IP addresses for this node
# if the nagios server is not in the cloud, always use public IP addresses for cloud nodes.
# if the nagios server is in the cloud, use private IP addresses for any
# cloud servers in the same cloud, public IPs for servers in other clouds
# (where other is defined by node['cloud']['provider'])
# if the cloud IP is nil then use the standard IP address attribute. This is a work around
# for OHAI incorrectly identifying systems on Cisco hardware as being in Rackspace
def ip_to_monitor(monitored_host, server_host = node)
  # if interface to monitor is specified implicitly use that
  if node['nagios']['monitoring_interface'] && node['network']["ipaddress_#{node['nagios']['monitoring_interface']}"]
    node['network']["ipaddress_#{node['nagios']['monitoring_interface']}"]
  # if server is not in the cloud and the monitored host is
  elsif server_host['cloud'].nil? && monitored_host['cloud']
    monitored_host['cloud']['public_ipv4'].include?('.') ? monitored_host['cloud']['public_ipv4'] : monitored_host['ipaddress']
  # if server host is in the cloud and the monitored node is as well, but they are not on the same provider
  elsif server_host['cloud'] && monitored_host['cloud'] && monitored_host['cloud']['provider'] != server_host['cloud']['provider']
    monitored_host['cloud']['public_ipv4'].include?('.') ? monitored_host['cloud']['public_ipv4'] : monitored_host['ipaddress']
  else
    monitored_host['ipaddress']
  end
end

To:
(use monitored_host instead of node - this should even fit's need of the monitoring server in case this behavior was not the original intention).

def ip_to_monitor(monitored_host, server_host = node)
  # if interface to monitor is specified implicitly use that
  if monitored_host['nagios']['monitoring_interface'] && monitored_host['network']["ipaddress_#{monitored_host['nagios']['monitoring_interface']}"]
    monitored_host['network']["ipaddress_#{monitored_host['nagios']['monitoring_interface']}"]
...
...

Code on master references an attribute node['nagios']['resource_dir'] but no default is set for rhel based nodes.

The default recipe references a directory resource. This resource name references the attribute node['nagios']['resource_dir'].

# resource.cfg differs on RPM and tarball based systems
if node['platform_family'] == 'rhel' || node['platform_family'] == 'fedora'
  directory node['nagios']['resource_dir'] do
    owner 'root'
    group node['nagios']['group']
    mode '0750'
  end
end

However no default attribute value exists on these system.

It appears this issue was introduced with this commit when the attribute was removed: b12467c

README potentially needs updating for additional Cookbook Dependencies?

I downloaded and installed the dependencies listed on the README, but when I attempted to compile the cookbooks on the Nagios Server, it failed due to additional cookbook dependencies listed in the chef-client log during convergence.

Below are a list of the additional cookbook dependencies that I had to download in order to get the chef-client to run recipe[nagios::default].

== Additional Cookbook dependencies ==
apt
bluepill
chef-sugar
iis
smf
mysql
ohai
perl
rbac
rsyslog
runit
smf
xml
yum
yum-mysql-community

Broken 5.3.4/5.3.5

The version of the nagios cookbook in the 5.3.4 tag is not the same as the 5.3.4 version on the community (supermarket) site.

The metadata file puts the version at 5.3.5 and the work to move NRPE functionality to another cookbook is committed.

I thought this was affecting the community cookbook but it's actually not so it's not a huge problem for us, but it is confusing...

Does not pick up ipaddress correctly

I want to use node['nagios']['monitoring_interface'] to specify that the NRPE should use this interface to communicate with nodes. However when using vagrant to test this, it was not putting in the ip address of the interface.

The clause && node['network']["ipaddress_#{node['nagios']['monitoring_interface']}"] on ip_to_monitor always fails for me. And some results online imply that this is not how you get the ip address of interface X.

However I'm new to chef & ruby, so I might have made something wrong.

libraries/timeperiod.rb - timeperiod regex check is too restrictive

def check_period(period)
  # should be HH:MM-HH:MM ([01]?[0-9]|2[0-3])\:[0-5][0-9]
  return period if period =~ /^([01]?[0-9]|2[0-3])\:[0-5][0-9]-([01]?[0-9]|2[0-4])\:[0-5][0-9]$/
  nil
end

Needs to allow for multiple time ranges
ex: '00:00-06:00,17:00-19:00' or '00:00-04:00,12:00-14:00,16:00-24:00'

Flapping of permissions by default on RHEL with source recipe

(I'm not sure if this is just poorly chosen default directories or not?)
Exhibit A: /var/log/nagios mode 755 https://github.com/tas50/nagios/blob/master/recipes/server_source.rb#L113

Exhibit B: /var/log/nagios mode 751
https://github.com/tas50/nagios/blob/master/recipes/default.rb#L208

This can be avoided in the current recipe code if the default state_dir is changed.

Same problem for conf_dir but this involves the nrpe::_source_nrpe recipe, so I'll tackle that later.

Shouldn't we install nagios::server_* before Apache2/nginx?

It seems Apache2 (at least) triggers a non-OK exit code when the document root for a vhost doesn't exist (see below). Apache2/nginx have a dependency on nagios being installed but not vice versa, so why not just install nagios::server_* before the web server?

Running handlers:
[2014-06-28T20:27:37+00:00] ERROR: Running exception handlers
Running handlers complete

[2014-06-28T20:27:37+00:00] ERROR: Exception handlers complete
[2014-06-28T20:27:37+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 4 resources updated in 10.48862277 seconds
[2014-06-28T20:27:37+00:00] ERROR: service[apache2](apache2::default line 188) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/apache2 start ----
STDOUT: * Starting web server apache2
Action 'start' failed.
The Apache error log may have more information.
...fail!
STDERR: Warning: DocumentRoot [/usr/share/nagios3/htdocs] does not exist
[Sat Jun 28 20:27:37 2014] [warn] NameVirtualHost *:80 has no VirtualHosts
---- End output of /etc/init.d/apache2 start ----
Ran /etc/init.d/apache2 start returned 1
[2014-06-28T20:27:37+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Enable wiki on repo

Tim,

Could you enable wiki on the repo so we can start write some documentation and make the readme shorter.

Thx.

Duplicate commands check-host-alive, check_nrpe

On Ubuntu 12.04, the nagios-plugins* packages already include checks with these names:

% grep check-host-alive *
ping.cfg:# 'check-host-alive' command definition
ping.cfg: command_name check-host-alive
ping.cfg:# 'check-host-alive_4' command definition
ping.cfg: command_name check-host-alive_4
% grep check_nrpe *
check_nrpe.cfg: command_name check_nrpe
check_nrpe.cfg: command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
check_nrpe.cfg: command_name check_nrpe_1arg
check_nrpe.cfg: command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

This causes Nagios not to startup due to duplicate command definitions.

Nagios doesn't start if no services are defined

Now that the server doesn't check itself there can exist a condition where no services are defined and the service will fail to start. It might make sense to define a bogus service is the service array is empty.

allow_empty_hostgroup_assignment activated on ubuntu 12.04 and package installation method

Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise

This block in nagios.cfg.erb:

<% if node['nagios']['server']['install_method'] == 'source' ||
(node['platform_family'] == 'debian' && node['platform_version'].to_i >= 7) ||
(node['platform_family'] == 'rhel' && node['platform_version'].to_i >= 6) ||
(node['platform_family'] == 'ubuntu' && node['platform_version'].to_f >= 14.04) -%>
allow_empty_hostgroup_assignment=1
<% end -%>

Is somehow returning true on my package installed nagios 3.2.3 and ubuntu 12.04, which barfs on the unknown variable. Please advise

create exceptions for vhost on nginx if php5-fpm is installed

This is possibly a a patch to submit, but using a base nagios::server runlist on a server that had previously had a pretty base lemp stack runlist run on it.

I had to add an additional location{} block to the vhost generated in order to parse php.

After this was done only then was I able to access the nagios v shell via the browser. Before that I was being served un parsed php files to download.

I am prposing to ad an , if node.fpm_group that the below block be added.

Alternativly I have configured something wrong and could use a pointer at debugging.

unsolved time outs

After I modify the vhost I am able to click around for a bit before getting time outs.

When I look at top I have several processes owned by perl-fcgi that are taking up high amounts of the cpu's resources.

runlist

"default_attributes": {
  "nagios": {
    "server_role": "monitoring",
    "server_auth_method": "htauth",
    "server": {
      "web_server": "nginx"
    }
  }
},
"override_attributes": {
  "nagios": {
    "server": {
    }
  }
},
"chef_type": "role",
"run_list": [
  "recipe[nagios::server]"
],

vhost block

location ~ \.php$ {                                                                             
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi_params;                                                                           
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                                 
  fastcgi_intercept_errors on;                                                                      
  fastcgi_pass unix:/var/run/php5-fpm.sock;                                                         
}  

Add host using custom host_template

Hi - I am trying to use a custom host template (defined in the host_templates databag) when adding a special type of VM to Nagios following your instructions here: https://github.com/tas50/nagios/wiki/host_templates

"You then use the host template by setting the node['nagios']['host_template'] attribute for a node. You could apply this with a role as follows:

role 'windows'

default_attributes(
nagios: {
host_template: 'windows-host'
}
)".

I see that the host definition is being updated in /etc/nagios/conf.d/templates.cfg, however, when I set the node['nagios']['host_template'] attribute in my special type of VM, Nagios does not use the right host template (the one set in the node attribute), but instead it uses the default one "server".

Gustavo

hostgroups config file fails on test generation

I have a simple wrapper cookbook that pulls in the default recipe and passes in attribute. I was previously using v5.3.5 on the master branch before this mornings pushes and now I'm using v6.0.0 from the Chef supermarket API.

My kitchen tests are failing because the cookbook is adding an incorrect hostgroup.

define host {
use server
address 10.0.2.15
host_name server-ubuntu-1204.vagrantup.com
hostgroups _default,all,linux,monitoring
}

Where is that _default coming from?

Error executing action `update` on resource 'nagios_resourcelist_items[update]'

I seem to still be having an issue bringing in my service group stuff.. Can anyone verify this isn't still an issue from the providers angle? Thank you for your time. See output below, should be using the latest version since Merge #350. If I am possibly missing something that should fix this I am happy to try things.

 * nagios_resourcelist_items[update] action update[2015-03-27T20:55:51+00:00] INFO: Processing nagios_resourcelist_items[update] action update (nagios::default line 169)
==============================================================================
           Error executing action `update` on resource 'nagios_resourcelist_items[update]'
==============================================================================

           NoMethodError
           -------------
           undefined method `create' for Nagios::Servicegroup:Class

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/nagios/providers/resourcelist_items.rb:60:in `update_object'

       /tmp/kitchen/cache/cookbooks/nagios/providers/resourcelist_items.rb:46:in `block (2 levels) in class_from_file'
           /tmp/kitchen/cache/cookbooks/nagios/providers/resourcelist_items.rb:21:in `block in class_from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/nagios/recipes/default.rb

           169: nagios_resourcelist_items 'update'
           170: 

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/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

       [2015-03-27T20:55:51+00:00] INFO: Running queued delayed notifications before re-raising exception
       [2015-03-27T20:55:51+00:00] INFO: template[/etc/nagios/nagios.cfg] sending reload action to service[nagios] (delayed)
         * service[nagios] action reload[2015-03-27T20:55:51+00:00] INFO: Processing service[nagios] action reload (nagios::default line 197)
       [2015-03-27T20:55:51+00:00] INFO: service[nagios] reloaded

           - reload service service[nagios]

       Running handlers:
       [2015-03-27T20:55:51+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2015-03-27T20:55:51+00:00] ERROR: Exception handlers complete
       [2015-03-27T20:55:51+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 3 resources updated in 51.925204806 seconds
       [2015-03-27T20:55:51+00:00] ERROR: nagios_resourcelist_items[update] (nagios::default line 169) had an error: NoMethodError: undefined method `create' for Nagios::Servicegroup:Class
       [2015-03-27T20:55:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Recipe pagerduty does not honor admin_contactgroup : true

I'm trying to get pagerduty to be the default contact for all alerts. However there does not appear to be functionality to achieve this. Any idea on how to make it work?

In the README, it states: "Setting admin_contactgroup to "true" will add this pagerduty contact to the admin contact group created by this cookbook." This doesn't work.

default.bats: service check assumes too much

In the Kitchen tests, default.bats includes this check:

service nagios3 status

…which fails in environments where either the service is not named "nagios3" or there is no "service" command. At least one or two environments currently in the Kitchen setup fail the test because of this.

I think a more robust check is needed. I'm experimenting with using this instead:

ps -C nagios | grep -q nagios

Of course, this still assumes some kind of Linux environment. I'm still a rookie with Kitchen, so I don't know the right way to make tests conditional on the underlying OS.

Apache VirtualHost not enabled - CentOS 6.5

Steps:

  1. Using Amazon CentOS AMI (ami-8997afe0), run the Nagios Server recipe (recipe[nagios::server])
  2. After installation, attempt to access the server via port 80

Result:

404 Error

Expected:

Nagios console to display (prompt for authentication)

Note: The call to enable the nagios3 virualhost seems to fail with odd file name: "nagois3.conf.conf"

  • execute[a2ensite nagios3.conf.conf] action run (skipped due to only_if)

I'm using Apache 2 community cookbook version 2.0.0

New "service-template" definition causes nagios to fail on startup

Looks like this PR causes nagios to error out on startup if no unmanaged hosts invoke the new service-template service.
#293

Things worked fine with the cookbook tagged 5.3.4, but switching to master (v5.3.5) broke nagios as shown below.

root@my-server:/etc/nagios/conf.d# service nagios restart
Running configuration check...

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Warning: use_embedded_perl_implicitly is deprecated and will be removed.
Warning: enable_embedded_perl is deprecated and will be removed.
Warning: sleep_time is deprecated and will be removed.
Warning: external_command_buffer_slots is deprecated and will be removed. All commands are always processed upon arrival
Warning: command_check_interval is deprecated and will be removed. Commands are always handled on arrival
   Read main config file okay...
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/etc/nagios/conf.d/templates.cfg', starting at line 29)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in service type objects (config file '/etc/nagios/conf.d/templates.cfg', starting at line 56)
Error: Service has no hosts and/or service_description (config file '/etc/nagios/conf.d/templates.cfg', starting on line 97)
   Error processing object config files!

Below is my /etc/nagios/conf.d/templates.cfg. Line 97 is the last service definition. Also, isn't the "service-template" definition redundant with the "default-service" definition anyway?

# Template definitions
#
# Autogenerated by Chef.

define contact {
  name                            default-contact
  service_notification_period     24x7
  host_notification_period        24x7
  service_notification_options    w,u,c,r,f,s
  host_notification_options       d,u,r,f,s
#  service_notification_commands   service-notify-by-email, service-notify-by-jabber
  service_notification_commands   service-notify-by-email
#  host_notification_commands      host-notify-by-email, host-notify-by-sms-gateway, host-notify-by-jabber
  host_notification_commands      host-notify-by-email
  register                        0
}

define contact {
  name                            sms-contact
  service_notification_period     24x7
  host_notification_period        24x7
  service_notification_options    w,u,c,r,f,s
  host_notification_options       d,u,r,f,s
  service_notification_commands   service-notify-by-sms-gateway
  host_notification_commands      host-notify-by-sms-gateway
  register                        0
}

define host {
  name                            default-host
  notifications_enabled           1
  event_handler_enabled           1
  flap_detection_enabled          1
  failure_prediction_enabled      1
  process_perf_data               0
  retain_status_information       1
  retain_nonstatus_information    1
  notification_period             24x7
  register                        0
}

define host {
  name                    server
  use                     default-host
  check_period            24x7
  check_interval          120.0
  retry_interval          15.0
  max_check_attempts      1
  check_command           check-host-alive
  notification_interval   1800.0
  notification_options    d,u,r
  contact_groups          admins
  register                0
}

define service {
  name                            default-service
  active_checks_enabled           1
  passive_checks_enabled          1
  parallelize_check               1
  obsess_over_service             1
  check_freshness                 0
  notifications_enabled           1
  event_handler_enabled           1
  flap_detection_enabled          1
  failure_prediction_enabled      1
  process_perf_data               0
  retain_status_information       1
  retain_nonstatus_information    1
  is_volatile                     0
  check_period                    24x7
  max_check_attempts              3
  check_interval                  120.0
  retry_interval                  15.0
  contact_groups                  admins
  notification_options            w,u,c,r
  notification_interval           1800.0
  notification_period             24x7
  register                        0
}

# Define the log monitoring template (monitoring logs is very different)
define service{
  name                            default-logfile
  use                             default-service
  check_period                    24x7
  max_check_attempts              1
  check_interval                  120.0
  retry_interval                  15.0
  contact_groups                  admins
  notification_options            w,u,c,r
  notification_period             24x7
  register                        0
  is_volatile                     1
  }

define service{
  name                            service-template
  max_check_attempts              3
  check_interval                  120.0
  retry_interval                  15.0
  notification_interval           1800.0
}


# Host templates defined by data bags

Add environment list support

When we use to multi_environment feauture, we can use environment_list for just what we want to see on nagios. Or environment_exception_list for what we dont want to.

nagios-nrpe-server is restarted during every chef run

A restart of nrpe is executed during every chef run.

Anyway to change this so that nrpe is only restarted if something changed or add an option to prevent a restart during every run?

service node['nagios']['nrpe']['service_name'] do
  action [:start, :enable]
  supports :restart => true, :status => false
end

.DS_Store files causing berks up failure in 6.0.0

$ berks upload nagios
E, [2014-10-22T16:32:36.399822 #5892] ERROR -- : Ridley::Errors::HTTPBadRequest: {"error":["Invalid element in array value of 'templates'."]}
$ find ~/.berkshelf/cookbooks/* -name '.DS_Store' -type f | xargs -n1 -p rm
rm /home/jpotkanski/.berkshelf/cookbooks/nagios-6.0.0/.DS_Store ?...y
rm /home/jpotkanski/.berkshelf/cookbooks/nagios-6.0.0/templates/.DS_Store ?...y
rm /home/jpotkanski/.berkshelf/cookbooks/nagios-6.0.0/templates/default/.DS_Store ?...y

Chef-zero fails with multi-environment enabled.

Hi,

I am trying to install nagios with chef-zero and vagrant.
I have created users data bag
I have created monitoring role
I have two environments
I have multi environment attribute set to true
when I provision my vm with vagrant, It fails at creating hostgroup template with error

Chef::Mixin::Template::TemplateError

comparison of String with nil failed

Compiled Resource:

Declared in /var/chef/cache/cookbooks/nagios/definitions/nagios_conf.rb:29:in `block in from_file'

template("/etc/nagios3/conf.d/hostgroups.cfg") do
params {:variables=>{:hostgroups=>["monitoring", "_default", "production", "staging", "linux", nil], :search_hostgroups=>[], :search_nodes=>{}}, :config_subdir=>true, :source=>"hostgroups.cfg.erb", :name=>"hostgroups"}
.

I am not sure about why its adding extra nil param to hostgroup search.

Please help.

user data bag and timeperiods

Does not seem to be a way to assign timeperiods to user data bags, but you can to nagios_contacts. But there is no way to assign nagios_contacts to notification groups. In 5.2.0, you got around this by adding a user data bag without an email and a nagios_contacts data bag with a time period. But now it appears that no longer works. Advice please.

Ubuntu 14.04 Apache installs fail due to CGI setup

service apache2 reload

  • Reloading web server apache2 *
  • The apache2 configtest failed. Not doing anything.
    Output of config test was:
    [Wed Jan 21 18:17:56.562318 2015] [:crit] [pid 12384:tid 140013584004992] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
    AH00013: Pre-configuration failed
    Action 'configtest' failed.
    The Apache error log may have more information.

On RHEL fails to load stylesheets

It's i simple bug, the default['nagios']['conf_dir'] points to /etc/nagios3 on ubuntu and /etc/nagios on centos. However the apache/nginx app templates for vhost defines path to (for example stylesheets) as node['nagios']['server']['vname'] which in all cases (platform_family) is "nagios3".

I think you should use " default['nagios']['conf_dir']" attribute in the templates. And update attributes to create path for conf_dir as etc+vname.

Files afffected - see:
https://github.com/tas50/nagios/search?q=stylesheets&ref=cmdform

apache config on Ubuntu 14.04 results in missing css style

Generated apache:

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName mvfdev2eae2e18.local
DocumentRoot /usr/share/nagios3/htdocs
CustomLog /var/log/apache2/nagios_access.log combined
ErrorLog /var/log/apache2/nagios_error.log

Alias /stylesheets /etc/nagios3/stylesheets
ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
Alias /nagios3 /usr/share/nagios3/htdocs

<Directory "/usr/lib/cgi-bin/nagios3">
Options ExecCGI

AuthName "Nagios Server" AuthType Basic AuthUserFile "/etc/nagios3/htpasswd.users" require valid-user

SetEnv TZ "UTC"

Should be:

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName mvfdev2eae2e18.local
DocumentRoot /usr/share/nagios3/htdocs
CustomLog /var/log/apache2/nagios_access.log combined
ErrorLog /var/log/apache2/nagios_error.log

Alias /stylesheets /etc/nagios3/stylesheets
Alias /nagios3/stylesheets /etc/nagios3/stylesheets
ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
Alias /nagios3 /usr/share/nagios3/htdocs

<Directory "/usr/lib/cgi-bin/nagios3">
Options ExecCGI

AuthName "Nagios Server" AuthType Basic AuthUserFile "/etc/nagios3/htpasswd.users" require valid-user

SetEnv TZ "UTC"

...or perhaps there is a better way to fix this but I don't have time to fix atm.

/etc/nagios/conf.d/servicegroups.cfg being generated with services but no hosts

I am running into an interesting feature..

Scenario:
Generating a servicegroups.cfg via (example) nagios_servicegroups/custom_servicegroup.json databag file:

{
  "id": "SS",
  "alias": "Some Alias",
  "notes": "SomeService Note"
}

and using the following (example) nagios_services/custom_service.json databag:

{
  "id": "SSMaster",
  "hostgroup_name": "SSMaster_list",
  "command_line": "$USER1$/check_something...",
  "servicegroups": "SS"
}

It would seem that when members are added to the servicegroups.cfg file, only the service description name (ex. ssmaster), is being added to the list and not ANY hosts (servicegroups.cfg):

line 7:      define servicegroup {
line 8:         servicegroup_name  SS
line 9:         members            ssmaster
line 10:    }

This breaks the nagios config check (nagios -v /etc/nagios/nagios.cfg) seemingly with output like this:

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
...
...
Error: Could not find a service matching host name 'ssmaster' and description 'nodeX' (config file '/etc/nagios/conf.d/servicegroups.cfg', starting on line 9)
Error: Could not expand member services specified in servicegroup (config file '/etc/nagios/conf.d/servicegroups.cfg', starting on line 9)
   Error processing object config files!

The 'nodeX' becomes other services if they are added to the services databag with the "servicegroups": "SS" line.

Is my method to deploy servicegroups wrong here? Am I missing something that could allow a better or no member list to be generated? If I comment out the members line in the servicegroups.cfg file, things seem to work properly...oddly enough because of the servicegroups SS line in the services.cfg file.

Any thoughts on this issue? Bottom line, members in the servicegroups.cfg file are only being populated with services and not hosts except in the case of a single service, then it grabs a seemingly random host and populates in wrong order (service,host or service,service.. instead of host,service,host,service...)

Cookbook breaks if node has tag = nil

On file recipes/default.rb, line 119:

if all_nodes.key?('tags') && all_nodes['tags'].include?(exclusion_tag)

If all_nodes is a Hash with a key pointing to a nil value (default config on opscode when no tag is set), then the cookbook breaks.

It should check:

if all_nodes.key?('tags') && not all_nodes['tags'].nil? && all_nodes['tags'].include?(exclusion_tag)

Cheers,

Limit Nagios monitoring to specified hostgroups?

This cookbook's current behavior is to populate Nagios hostgroup entries for all roles found in the current environment (or in all environments if node['nagios']['multi_environment_monitoring'] is true). This can make the Nagios web UI unwieldy, especially if one has many unused roles.

This behavior makes the nagios_hostgroups databag a bit redundant, and indeed the cookbook will throw an error if an item in that databag is a role that the cookbook already found by searching the Chef server.

Would it make sense to add a true/false option to control whether the cookbook will search all nodes for potential monitoring by Nagios, e.g. node['nagios']['specify_hostgroups'] ? Setting this option to true would limit the search of nodes to be monitored to only those specified in nagios_hostgroups data bag items.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.