-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended and refined example3, especially README
- Loading branch information
Showing
5 changed files
with
172 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
examples/example3/site/profile/manifests/backuppc/server.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class profile::backuppc::server { | ||
class { '::backuppc::server': } | ||
create_resources('backuppc::server::user', hiera('backuppc_users', [])) | ||
|
||
# Icinga CheckCommand and Apply Rules | ||
@@icinga2::object::checkcommand { 'backuppc': | ||
import => [ | ||
'plugin-check-command', | ||
], | ||
command => [ | ||
'sudo', '-u', 'backuppc', | ||
'PluginContribDir + /check_backuppc', | ||
], | ||
arguments => { | ||
'-w' => '$backuppc_wtime$', | ||
'-c' => '$backuppc_ctime$', | ||
'-H' => { | ||
'value' => '$backuppc_desired$', | ||
'set_if' => '$backuppc_desired$', | ||
}, | ||
'-x' => { | ||
'value' => '$backuppc_exclude$', | ||
'set_if' => '$backuppc_exclude$', | ||
}, | ||
'-V' => { | ||
'set_if' => '$backuppc_version$' | ||
}, | ||
'-a' => { | ||
'set_if' => '$backuppc_archiveonly$', | ||
}, | ||
'-b' => { | ||
'set_if' => '$backuppc_backuponly$', | ||
}, | ||
'-s' => { | ||
'set_if' => '$backuppc_statusonly$', | ||
}, | ||
}, | ||
vars => { | ||
'backuppc_wtime' => '2', | ||
'backuppc_ctime' => '4', | ||
}, | ||
target => '/etc/icinga2/zones.d/global-templates/backuppc-command.conf', | ||
} | ||
|
||
@@file { '/etc/icinga2/conf.d/services/backuppc.conf': | ||
ensure => file, | ||
owner => 'nagios', | ||
group => 'nagios', | ||
tag => 'icinga2::config::exported', | ||
source => [ | ||
"puppet:///modules/1024/icinga/services/backuppc.conf", | ||
], | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
examples/example3/site/profile/manifests/icinga/applyrules.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
class profile::icinga::applyrules { | ||
|
||
# Global apply rules | ||
# We attempt to export them with the respective services where possible. | ||
# However, that only works if the service is unique on the infrastructure and would | ||
# not lead to duplicate resources. | ||
# | ||
# All multi-use (apply) services are defined here. | ||
# | ||
# We do not use "icinga2::object::service" but files with the "icinga2::config::file" tag. See the | ||
# example's README on why this is the case. | ||
|
||
file { '/etc/icinga2/conf.d/services/nginx.conf': | ||
ensure => file, | ||
owner => 'nagios', | ||
group => 'nagios', | ||
tag => 'icinga2::config::file', | ||
source => [ | ||
"puppet:///modules/1024/icinga/services/nginx.conf", | ||
], | ||
} | ||
|
||
file { '/etc/icinga2/conf.d/services/postgres.conf': | ||
ensure => file, | ||
owner => 'nagios', | ||
group => 'nagios', | ||
tag => 'icinga2::config::file', | ||
source => [ | ||
"puppet:///modules/1024/icinga/services/postgres.conf", | ||
], | ||
} | ||
|
||
file { '/etc/icinga2/conf.d/services/elasticsearch.conf': | ||
ensure => file, | ||
owner => 'nagios', | ||
group => 'nagios', | ||
tag => 'icinga2::config::file', | ||
source => [ | ||
"puppet:///modules/1024/icinga/services/elasticsearch.conf", | ||
], | ||
} | ||
|
||
# Collect any files exported and tagged elsewhere (can be created inside | ||
# services or master zone) | ||
# We need to use a different tag then icinga itself (icinga2::config::file) | ||
# or the agent will try to collect any resources tagged so on himself. | ||
File <<| ensure != 'directory' and tag == 'icinga2::config::exported' |>> { | ||
require => [ | ||
File['icinga2_masterzone'], | ||
File['icinga2_services'], | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class profile::nginx { | ||
|
||
# This profile can be used by many nodes and thus the node configuration is | ||
# in the hiera file for the respective node! | ||
class { '::nginx': | ||
manage_repo => true, | ||
package_source => 'nginx-stable' | ||
}-> | ||
class { '::collectd::plugin::nginx': | ||
url => 'http://localhost:8433/nginx-status', | ||
} | ||
|
||
# Icinga: install check into PluginContribDir | ||
# (PluginContribDir could be a fact "icinga2 variable get PluginContribDir", | ||
# but for that to work, puppet would probably have to run twice…) | ||
file { '/usr/lib/nagios/plugins/check_nginx_status.pl': | ||
ensure => file, | ||
mode => '+x', | ||
source => [ | ||
'puppet:///modules/1024/icinga/plugins/check_nginx_status.pl', | ||
], | ||
require => Package['monitoring-plugins-standard'], | ||
} | ||
|
||
} |