Dedicate a Logical Volume for Nagios

A LV of 20GB is dedicated for Nagios which uses /var/nagios for all its data:
 - object_cache_file
 - status_file
 - temp_file
 - log_file
 - debug_file
 - log_archive_path

Change-Id: I5dc67e6326e21af48c59e3acf7fe31541c5af497
This commit is contained in:
Swann Croiset 2015-09-09 17:58:46 +02:00
parent 0f4fe35c19
commit c21f7232b9
4 changed files with 62 additions and 2 deletions

View File

@ -84,6 +84,16 @@ User Guide
- The name of the node where the plugin is deployed.
- The username and password to access Nagios web interface.
### Disks partitioning
The plugin uses:
- 20% of the first disk for the operating system by honoring the range of
15GB minimum and 50GB maximum.
- 20GB for Nagios data and logs (/var/nagios).
- 10GB for /var/log.
It is recommended to review the partitioning done by Fuel before the deployment
and adapt it to your requirements.
Testing
-------

View File

@ -36,6 +36,8 @@ class nagios(
$additional_freshness_latency = $nagios::params::additional_freshness_latency,
$check_external_commands = false,
$command_check_interval = $nagios::params::command_check_interval,
$data_dir = $nagios::params::data_dir,
$interval_length = $nagios::params::interval_length,
) inherits nagios::params {
@ -64,6 +66,31 @@ class nagios(
$service_freshness = bool2num($check_service_freshness)
$host_freshness = bool2num($check_host_freshness)
$external_command = bool2num($check_external_commands)
$cache_dir = "${data_dir}/cache/"
$object_cache_file = "${cache_dir}/objects.cache"
$status_file = "${cache_dir}/status.dat"
$temp_file = "${cache_dir}/nagios.tmp"
$log_file = "${data_dir}/nagios.log"
$debug_file = "${data_dir}/nagios.debug.log"
$log_archive_path = "${data_dir}/archives"
file { $data_dir:
ensure => directory,
owner => 'nagios',
before => Package[$service_name],
}
file { $cache_dir:
ensure => directory,
owner => 'nagios',
require => File[$data_dir];
}
file { $log_archive_path:
ensure => directory,
owner => 'nagios',
require => File[$data_dir];
}
augeas{ $main_config:
incl => $main_config,
@ -85,6 +112,12 @@ class nagios(
"set service_freshness_check_interval ${service_freshness_check_interval}",
"set check_external_commands ${external_command}",
"set command_check_interval ${command_check_interval}",
"set object_cache_file ${object_cache_file}",
"set status_file ${status_file}",
"set temp_file ${temp_file}",
"set log_file ${log_file}",
"set debug_file ${debug_file}",
"set log_archive_path ${log_archive_path}",
],
require => Package[$service_name],
notify => Class['nagios::server_service'],

View File

@ -62,6 +62,8 @@ class nagios::params {
$log_rotation_method = 'd'
$max_concurrent_checks = 0 # no limit
$data_dir = '/var/nagios'
# default Nagios contact
$default_contact_groups = ['admins']
$default_contact_email = 'root@localhost'

View File

@ -1,5 +1,20 @@
volumes: []
volumes:
- id: "nagios"
type: "vg"
min_size:
generator: "calc_gb_to_mb"
generator_args: [20]
label: "Nagios data"
volumes:
- mount: "/var/nagios"
type: "lv"
name: "nagios"
file_system: "ext4"
size:
generator: "calc_total_vg"
generator_args: ["nagios"]
volumes_roles_mapping:
infrastructure_alerting:
- {allocate_size: "min", id: "os"}
- {allocate_size: "all", id: "logs"}
- {allocate_size: "min", id: "logs"}
- {allocate_size: "min", id: "nagios"}