Coder Social home page Coder Social logo

sous-chefs / nagios Goto Github PK

View Code? Open in Web Editor NEW
124.0 46.0 271.0 1.84 MB

Development repository for the nagios cookbook

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

License: Apache License 2.0

Ruby 87.38% HTML 10.47% Perl 2.15%
chef-cookbook chef-resource nagios chef hacktoberfest managed-by-terraform

nagios's Introduction

nagios cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Installs and configures Nagios server. Chef nodes are automatically discovered using search, and Nagios host groups are created based on Chef roles and optionally environments as well.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Chef

Chef Infra Client version 15.3+ is required

Because of the heavy use of search, this recipe will not work with Chef Solo, as it cannot do any searches without a server.

This cookbook relies heavily on multiple data bags. See --Data Bag-- below.

The system running this cookbooks should have a role named 'monitoring' so that NRPE clients can authorize monitoring from that system. This role name is configurable via an attribute. See --Attributes-- below.

The functionality that was previously in the nagios::client recipe has been moved to its own NRPE cookbook at https://github.com/sous-chefs/nrpe

Platform

  • Debian 10+
  • Ubuntu 18.04+
  • Red Hat Enterprise Linux (CentOS) 7+

--Notes--: This cookbook has been tested on the listed platforms. It may work on other platforms with or without modification.

Cookbooks

  • apache2
  • nginx
  • nrpe
  • php
  • yum-epel
  • zap

Attributes

config

The config file contains the Nagios configuration options. Consult the nagios documentation for available settings and allowed options. Configuration entries of which multiple entries are allowed, need to be specified as an Array.

Example: default['nagios']['conf']['cfg_dir'] = [ '/etc/nagios/conf.d' , '/usr/local/nagios/conf.d' ]

default attributes

  • node['nagios']['user'] - Nagios user, default 'nagios'.

  • node['nagios']['group'] - Nagios group, default 'nagios'.

  • node['nagios']['plugin_dir'] - location where Nagios plugins go, default '/usr/lib/nagios/plugins'.

  • node['nagios']['multi_environment_monitoring'] - Chef server will monitor hosts in all environments, not just its own, default 'false'

  • node['nagios']['monitored_environments'] - If multi_environment_monitoring is 'true' nagios will monitor nodes in all environments. If monitored_environments is defined then nagios will monitor only hosts in the list of environments defined. For ex: ['prod', 'beta'] will monitor only hosts in 'prod' and 'beta' chef_environments. Defaults to '[]' - and all chef environments will be monitored by default.

  • node['nagios']['monitoring_interface'] - If set, will use the specified interface for all nagios monitoring network traffic. Defaults to nil

  • node['nagios']['exclude_tag_host'] - If set, hosts tagged with this value will be excluded from nagios monitoring. Defaults to ''

  • node['nagios']['server']['install_method'] - whether to install from package or source. Default chosen by platform based on known packages available for Nagios: debian/ubuntu 'package', redhat/centos/scientific: source

  • node['nagios']['server']['install_yum-epel'] - whether to install the EPEL repo or not (only applies to RHEL platform family). The default value is true. Set this to false if you do not wish to install the EPEL RPM; in this scenario you will need to make the relevant packages available via another method e.g. local repo, or install from source.

  • node['nagios']['server']['service_name'] - name of the service used for Nagios, default chosen by platform, debian/ubuntu "nagios3", redhat family "nagios", all others, "nagios"

  • node['nagios']['home'] - Nagios main home directory, default "/usr/lib/nagios3"

  • node['nagios']['conf_dir'] - location where main Nagios config lives, default "/etc/nagios3"

  • node['nagios']['resource_dir'] - location for recources, default "/etc/nagios3"

  • node['nagios']['config_dir'] - location where included configuration files live, default "/etc/nagios3/conf.d"

  • node['nagios']['log_dir'] - location of Nagios logs, default "/var/log/nagios3"

  • node['nagios']['cache_dir'] - location of cached data, default "/var/cache/nagios3"

  • node['nagios']['state_dir'] - Nagios runtime state information, default "/var/lib/nagios3"

  • node['nagios']['run_dir'] - where pidfiles are stored, default "/var/run/nagios3"

  • node['nagios']['docroot'] - Nagios webui docroot, default "/usr/share/nagios3/htdocs"

  • node['nagios']['enable_ssl'] - boolean for whether Nagios web server should be https, default false

  • node['nagios']['ssl_cert_file'] = Location of SSL Certificate File. default "/etc/nagios3/certificates/nagios-server.pem"

  • node['nagios']['ssl_cert_chain_file'] = Optional location of SSL Intermediate Certificate File. No default.

  • node['nagios']['ssl_cert_key'] = Location of SSL Certificate Key. default "/etc/nagios3/certificates/nagios-server.pem"

  • node['nagios']['ssl_protocols'] = The SSLProtocol string to pass to apache, defaults to "all -SSL3 -SSL2"

  • node['nagios']['ssl_ciphers'] = The SSLCipherSuite string to pass to apache, defaults to empty (which will result in this setting not being included in the apache config)

  • node['nagios']['http_port'] - port that the Apache/Nginx virtual site should listen on, determined whether ssl is enabled (443 if so, otherwise 80). Note: You will also need to configure the listening port for either NGINX or Apache within those cookbooks.

  • node['nagios']['server_name'] - common name to use in a server cert, default "nagios"

  • node['nagios']['server']['server_alias'] - alias name for the webserver for use with Apache. Defaults to nil

  • node['nagios']['ssl_req'] - info to use in a cert, default /C=US/ST=Several/L=Locality/O=Example/OU=Operations/CN=#{node['nagios']['server_name']}/emailAddress=ops@#{node['nagios']['server_name']}

  • node['nagios']['server']['version'] - version of the server source to download

  • node['nagios']['server']['checksum'] - checksum of the source files

  • node['nagios']['server']['source_url'] - nagios core source url

  • node['nagios']['server']['patch_url'] - url to download patches from if installing from source

  • node['nagios']['server']['patches'] - array of patch filenames to apply if installing from source

  • node['nagios']['url'] - URL to host Nagios from - defaults to nil and instead uses FQDN

  • node['nagios']['conf']['enable_notifications'] - set to 1 to enable notification.

  • node['nagios']['conf']['interval_length'] - minimum interval. Defaults to '1'.

  • node['nagios']['conf']['use_timezone'] - set the timezone for nagios AND apache. Defaults to UTC.

  • node['nagios']['conf']['use_large_installation_tweaks'] - Attribute to enable large installation tweaks. Defaults to 0.

  • node['nagios']['check_external_commands']

  • node['nagios']['default_contact_groups']

  • node['nagios']['default_user_name'] - Specify a defaut guest user to allow page access without authentication. --Only-- use this if nagios is running behind a secure webserver and users have been authenticated in some manner. You'll likely want to change node['nagios']['server_auth_require'] to all granted. Defaults to nil.

  • node['nagios']['sysadmin_email'] - default notification email.

  • node['nagios']['sysadmin_sms_email'] - default notification sms.

  • node['nagios']['server_auth_method'] - authentication with the server can be done with openid (using apache2::mod_auth_openid), cas (using apache2::mod_auth_cas),ldap (using apache2::mod_authnz_ldap), or htauth (basic). The default is htauth. "openid" will utilize openid authentication, "cas" will utilize cas authentication, "ldap" will utilize LDAP authentication, and any other value will use htauth (basic).

  • node['nagios']['cas_login_url'] - login url for cas if using cas authentication.

  • node['nagios']['cas_validate_url'] - validation url for cas if using cas authentication.

  • node['nagios']['cas_validate_server'] - whether to validate the server cert. Defaults to off.

  • node['nagios']['cas_root_proxy_url'] - if set, sets the url that the cas server redirects to after auth.

  • node['nagios']['ldap_bind_dn'] - DN used to bind to the server when searching for ldap entries.

  • node['nagios']['ldap_bind_password'] - bind password used with the DN provided for searching ldap.

  • node['nagios']['ldap_url'] - ldap url and search parameters.

  • node['nagios']['ldap_authoritative'] - accepts "on" or "off". controls other authentication modules from authenticating the user if this one fails.

  • node['nagios']['ldap_group_attribute'] - Set the Apache AuthLDAPGroupAttribute directive to a non-default value.

  • node['nagios']['ldap_group_attribute_is_dn'] - accepts "on" or "off". Set the Apache AuthLDAPGroupAttributeIsDN directive. Apache's default behavior is currently "on."

  • node['nagios']['ldap_verify_cert'] - accepts "on" or "off". Set the Apache mod_ldap LDAPVerifyServerCert directive. Apache's default behavior is currently "on."

  • node['nagios']['ldap_trusted_mode'] - Set the Apache mod_ldap LDAPTrustedMode directive.

  • node['nagios']['ldap_trusted_global_cert'] - Set the Apache mod_ldap LDAPTrustedGlobalCert directive.

  • node['nagios']['users_databag'] - the databag containing users to search for. defaults to users

  • node['nagios']['users_databag_group'] - users databag group considered Nagios admins. defaults to sysadmin

  • node['nagios']['services_databag'] - the databag containing services to search for. defaults to nagios_services

  • node['nagios']['servicegroups_databag'] - the databag containing servicegroups to search for. defaults to nagios_servicegroups

  • node['nagios']['templates_databag'] - the databag containing templates to search for. defaults to nagios_templates

  • node['nagios']['hostgroups_databag'] - the databag containing hostgroups to search for. defaults to nagios_hostgroups

  • node['nagios']['hosttemplates_databag'] - the databag containing host templates to search for. defaults to nagios_hosttemplates

  • node['nagios']['eventhandlers_databag'] - the databag containing eventhandlers to search for. defaults to nagios_eventhandlers

  • node['nagios']['unmanagedhosts_databag'] - the databag containing unmanagedhosts to search for. defaults to nagios_unmanagedhosts

  • node['nagios']['serviceescalations_databag'] - the databag containing serviceescalations to search for. defaults to nagios_serviceescalations

  • node['nagios']['hostescalations_databag'] - the databag containing hostescalations to search for. defaults to nagios_hostescalations

  • node['nagios']['contacts_databag'] - the databag containing contacts to search for. defaults to nagios_contacts

  • node['nagios']['contactgroups_databag'] - the databag containing contactgroups to search for. defaults to nagios_contactgroups

  • node['nagios']['servicedependencies_databag'] - the databag containing servicedependencies to search for. defaults to nagios_servicedependencies

  • node['nagios']['host_name_attribute'] - node attribute to use for naming the host. Must be unique across monitored nodes. Defaults to hostname

  • node['nagios']['regexp_matching'] - Attribute to enable regexp matching. Defaults to 0.

  • node['nagios']['templates'] - These set directives in the default host template. Unless explicitly overridden, they will be inherited by the host definitions for each discovered node and nagios_unmanagedhosts data bag. For more information about these directives, see the Nagios documentation for host definitions.

  • node['nagios']['hosts_template'] - Host template you want to inherit properties/variables from, default 'server'. For more information, see the nagios doc on Object Inheritance.

  • node['nagios']['brokers'] - Hash of broker modules to include in the config. Hash key is the path to the broker module, the value is any parameters to pass to it.

  • node['nagios']['nagios_config']['template_cookbook'] - Look for template file in the cookbook mentioned in the attribute. Defaults to nagios

  • node['nagios']['resources']['template_cookbook'] - Look for template file in the cookbook mentioned in the attribute. Defaults to nagios

  • node['nagios']['htauth']['template_cookbook'] - Look for template file in the cookbook mentioned in the attribute. Defaults to nagios

  • node['nagios']['nagios_config']['template_file'] - Template file to be rendered. Defaults to nagios.cfg.erb

  • node['nagios']['resources']['template_file'] - Template file to be rendered. Defaults to resource.cfg.erb

  • node['nagios']['htauth']['template_file'] - Template file to be rendered. Defaults to htpasswd.users.erb

  • node['nagios']['default_host']['flap_detection'] - Defaults to true.

  • node['nagios']['default_host']['process_perf_data'] - Defaults to false.

  • node['nagios']['default_host']['check_period'] - Defaults to '24x7'.

  • node['nagios']['default_host']['check_interval'] - In seconds. Must be divisible by node['nagios']['interval_length']. Defaults to 15.

  • node['nagios']['default_host']['retry_interval'] - In seconds. Must be divisible by node['nagios']['interval_length']. Defaults to 15.

  • node['nagios']['default_host']['max_check_attempts'] - Defaults to 1.

  • node['nagios']['default_host']['check_command'] - Defaults to the pre-defined command 'check-host-alive'.

  • node['nagios']['default_host']['notification_interval'] - In seconds. Must be divisible by node['nagios']['interval_length']. Defaults to 300.

  • node['nagios']['default_host']['notification_options'] - Defaults to 'd,u,r'.

  • node['nagios']['default_host']['action_url'] - Defines a action url. Defaults to nil.

  • node['nagios']['default_service']['process_perf_data'] - Defaults to false.

  • node['nagios']['default_service']['action_url'] - Defines a action url. Defaults to nil.

  • node['nagios']['server']['web_server'] - web server to use. supports Apache or Nginx, default "apache"

  • node['nagios']['server']['nginx_dispatch'] - nginx dispatch method. supports cgi or php, default "cgi"

  • node['nagios']['server']['stop_apache'] - stop apache service if using nginx, default false

  • node['nagios']['server']['redirect_root'] - if using Apache, should http://server/ redirect to http://server/nagios3 automatically, default false

  • node['nagios']['server']['normalize_hostname'] - If set to true, normalize all hostnames in hosts.cfg to lowercase. Defaults to false.

These are nagios cgi.config options.

  • node['nagios']['cgi']['show_context_help'] - Defaults to 1
  • node['nagios']['cgi']['authorized_for_system_information'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_configuration_information'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_system_commands'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_all_services'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_all_hosts'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_all_service_commands'] - Defaults to '-'
  • node['nagios']['cgi']['authorized_for_all_host_commands'] - Defaults to '-'
  • node['nagios']['cgi']['default_statusmap_layout'] - Defaults to 5
  • node['nagios']['cgi']['default_statuswrl_layout'] - Defaults to 4
  • node['nagios']['cgi']['result_limit'] - Defaults to 100
  • node['nagios']['cgi']['escape_html_tags'] - Defaults to 0
  • node['nagios']['cgi']['action_url_target'] - Defaults to '_blank'
  • node['nagios']['cgi']['notes_url_target'] - Defaults to '_blank'
  • node['nagios']['cgi']['lock_author_names'] - Defaults to 1
  • node['nagios']['cgi']['template_cookbook'] - Look for template file in the cookbook mentioned in the attribute. Defaults to nagios
  • node['nagios']['cgi']['template_file'] - Template file to be rendered. Defaults to cgi.cfg.erb

Recipes

default recipe

Includes the correct client installation recipe based on platform, either nagios::server_package or nagios::server_source.

The server recipe sets up Apache as the web front end by default. This recipe also does a number of searches to dynamically build the hostgroups to monitor, hosts that belong to them and admins to notify of events/alerts.

Searches are confined to the node's chef_environment unless multi-environment monitoring is enabled.

The recipe does the following:

  1. Searches for users in 'users' databag belonging to a 'sysadmin' group, and authorizes them to access the Nagios web UI and also to receive notification e-mails.
  2. Searches all available roles/environments and builds a list which will become the Nagios hostgroups.
  3. Places nodes in Nagios hostgroups by role / environment membership.
  4. Installs various packages required for the server.
  5. Sets up configuration directories.
  6. Moves the package-installed Nagios configuration to a 'dist' directory.
  7. Disables the 000-default VirtualHost present on Debian/Ubuntu Apache2 package installations.
  8. Templates configuration files for services, contacts, contact groups, templates, hostgroups and hosts.
  9. Enables the Nagios web UI.
  10. Starts the Nagios server service

server_package

Installs the Nagios server from packages. Default for Debian / Ubuntu systems.

server_source

Installs the Nagios server from source. Default for Red Hat based systems as native packages for Nagios are not available in the default repositories.

pagerduty

Installs pagerduty plugin for nagios. If you only have a single pagerduty key, you can simply set a node['nagios']['pagerduty_key'] attribute on your server. For multiple pagerduty key configuration see Pager Duty under Data Bags.

This recipe was written based on the Nagios Integration Guide from PagerDuty which explains how to get an API key for your Nagios server.

Data Bags

See Wiki for more databag information

Pager Duty

You can define pagerduty contacts and keys by creating nagios_pagerduty data bags that contain the contact and the relevant key. Setting admin_contactgroup to "true" will add this pagerduty contact to the admin contact group created by this cookbook.

{
  "id": "pagerduty_critical",
  "admin_contactgroup": "true",
  "key": "a33e5ef0ac96772fbd771ddcccd3ccd0"
}

You can add these contacts to any contactgroups you create.

Monitoring Role

Create a role to use for the monitoring server. The role name should match the value of the attribute "node['nrpe']['server_role']" on your clients. By default, this is 'monitoring'. For example:

# roles/monitoring.rb
name 'monitoring'
description 'Monitoring server'
run_list(
  'recipe[nagios::default]'
)

default_attributes(
  'nagios' => {
    'server_auth_method' => 'htauth'
  }
)
knife role from file monitoring.rb

Usage

server setup

Create a role named 'monitoring', and add the nagios server recipe to the run_list. See --Monitoring Role-- above for an example.

Apply the nrpe cookbook to nodes in order to install the NRPE client

By default the Nagios server will only monitor systems in its same environment. To change this set the multi_environment_monitoring attribute. See --Attributes--

Create data bag items in the users data bag for each administer you would like to be able to login to the Nagios server UI. Pay special attention to the method you would like to use to authorization users (openid or htauth). See --Users-- and --Atttributes--

At this point you now have a minimally functional Nagios server, however the server will lack any service checks outside of the single Nagios Server health check.

defining checks

NRPE commands are defined in recipes using the nrpe_check LWRP provider in the nrpe cookbooks. For base system monitoring such as load, ssh, memory, etc you may want to create a cookbook in your environment that defines each monitoring command via the LWRP.

With NRPE commands created using the LWRP you will need to define Nagios services to use those commands. These services are defined using the nagios_services data bag and applied to roles and/or environments. See --Services--

enabling notifications

You need to set default['nagios']['notifications_enabled'] = 1 attribute on your Nagios server to enable email notifications.

For email notifications to work an appropriate mail program package and local MTA need to be installed so that /usr/bin/mail or /bin/mail is available on the system.

Example:

Include postfix cookbook to be installed on your Nagios server node.

Add override_attributes to your monitoring role:

# roles/monitoring.rb
name 'monitoring'
description 'Monitoring Server'
run_list(
  'recipe[nagios:default]',
  'recipe[postfix]'
)

override_attributes(
  'nagios' => { 'notifications_enabled' => '1' },
  'postfix' => { 'myhostname':'your_hostname', 'mydomain':'example.com' }
)

default_attributes(
  'nagios' => { 'server_auth_method' => 'htauth' }
)
knife role from file monitoring.rb

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

nagios's People

Contributors

bheuvel avatar caleb avatar damacus avatar detjensrobert avatar explody avatar jasmeralia avatar josephholsten avatar kitchen-porter avatar kplimack avatar leoditommaso avatar maigard avatar mdxp avatar messick avatar mpasternacki avatar mtsegoog avatar ovaistariq avatar ramereth avatar renovate[bot] avatar sbotman avatar scottso avatar sethvargo avatar shoekstra avatar snkutlu avatar stevendanna avatar tas50 avatar thoutenbos avatar timw077 avatar wilb avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nagios's Issues

.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

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

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)

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.

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'

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.

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)

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,

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

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

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.

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.

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.

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.

/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...)

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;                                                         
}  

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.

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.

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']}"]
...
...

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

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

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.

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...

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.

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

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

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?

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'

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.

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.

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

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.

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

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.

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

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.

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.