Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Better manamgement of hostgroups for removed nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Dec 23, 2012
1 parent f0d462c commit cf6090f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'example42-icinga'
version '2.0.9'
version '2.0.10'
author 'Alessandro Franceschi'
license 'Apache2'
project_page 'http://www.example42.com'
Expand Down
2 changes: 2 additions & 0 deletions files/hostgroups/#KeepMe
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


5 changes: 3 additions & 2 deletions manifests/hostgroup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
# }
#
define icinga::hostgroup (
$hostgroup = 'other'
$hostgroup = 'other',
$ensure = 'present',
) {

@@file { "icinga-hostgroup-member-${name}":
path => "${icinga::target::hostgroupsbuilddir}/${hostgroup},${name}",
ensure => present,
ensure => $ensure,
notify => Exec['hostgroups_build'],
tag => "icinga_hostgroup_${icinga::target::magic_tag}",
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/hostgroup_setup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
file { 'icinga-hostgroup-build_dir':
path => $icinga::target::hostgroupsbuilddir,
ensure => directory,
recurse => true,
purge => true,
# source => 'puppet:///icinga/hostgroups/',
notify => Exec['hostgroups_build'],
}

file { 'icinga-hostgroup-build_command':
Expand Down
2 changes: 1 addition & 1 deletion templates/icinga_build_hostgroups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hostgroups_build_dir=<%= scope.lookupvar('icinga::target::hostgroupsbuilddir') %
[ -d $backup_dir ] || mkdir -p $backup_dir
mv $hostgroups_dir/* $backup_dir/

for hg in $(ls $hostgroups_build_dir | cut -d ',' -f 1 | sort | uniq) ; do
for hg in $(ls $hostgroups_build_dir | grep -v "^#" | cut -d ',' -f 1 | sort | uniq) ; do
echo "# File generated by $0" > $hostgroups_dir/$hg.cfg
echo "define hostgroup {" >> $hostgroups_dir/$hg.cfg
echo " hostgroup_name $hg" >> $hostgroups_dir/$hg.cfg
Expand Down

0 comments on commit cf6090f

Please sign in to comment.