added service checks for nagios host including fqdn etc. so that nagios server can be treated both as nagios process and client

This commit is contained in:
Arne Teuke
2017-09-18 18:57:19 +02:00
parent e434c34c4d
commit e6256e44f5
3 changed files with 115 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ gem 'puppet-strings'
gem 'rake'
gem 'semantic_puppet'
gem 'rgen'
gem 'public_suffix', '<= 2.0.5'
# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'

View File

@@ -1,6 +1,6 @@
|Repo Name| version | Build Status|
|---|---|---|---|
|`cd_nagios`| 0.0.1.7 | [![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=cd_nagios)](https://jenkins.confdroid.com/job/cd_nagios/)|
|`cd_nagios`| 0.0.1.8 | [![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=cd_nagios)](https://jenkins.confdroid.com/job/cd_nagios/)|
### Synopsis
Nagios is a powerful open source software solution for monitoring your IT environments.

View File

@@ -40,7 +40,7 @@ class cd_nagios::server::service (
enable => true,
}
@@nagios_host { 'localhost':
@@nagios_host { 'localhost':
ensure => $ng_ping_ensure,
alias => 'localhost',
address => '127.0.0.1',
@@ -55,7 +55,7 @@ class cd_nagios::server::service (
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_service],
}
}
@@nagios_service { 'check_nagios_localhost':
check_command => $ng_nagios_service_cmd,
@@ -70,6 +70,117 @@ class cd_nagios::server::service (
contacts => 'ops',
}
@@nagios_host { $::fqdn:
ensure => $ng_ping_ensure,
alias => $::hostname,
address => $::fqdn,
use => 'linux-server',
target => $ng_target_host,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_user],
}
@@nagios_service { "root_partition_${::hostname}":
ensure => $ng_disk_ensure,
check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_root_partition",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
if $ng_enable_swap_check == true {
@@nagios_service { "Swap_Usage_${::hostname}":
ensure => $ng_swap_ensure,
check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_swap_usage",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
}
@@nagios_service { "Local_Users_${::hostname}":
ensure => $ng_users_ensure,
check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_local_users",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Total Processes_${::hostname}":
ensure => $ng_procs_tot_ens,
check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_total_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Zombie Processes_${::hostname}":
ensure => $ng_procs_z_ensure,
check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_zombie_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Current_Load_${::hostname}":
ensure => $ng_load_ensure,
check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_current_load",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
resources { [ 'nagios_host',
'nagios_hostgroup',
'nagios_hostdependency',