diff --git a/nagios/manifests/init.pp b/nagios/manifests/init.pp index bab0403..6f55f8d 100644 --- a/nagios/manifests/init.pp +++ b/nagios/manifests/init.pp @@ -272,7 +272,7 @@ define nagios::contact::prowl($confdir=$nagios::server::confdir) { } -define nagios::host($confdir, $operatingsystem) { +define nagios::host($confdir, $osname, $osicon) { file { "${confdir}/host_${name}.cfg": ensure => present, @@ -288,21 +288,31 @@ define nagios::host($confdir, $operatingsystem) { target => "${confdir}/host_${name}.cfg" } -# file { "${confdir}/hostextinfo_${name}.cfg": -# ensure => present, -# mode => "0640", -# owner => "root", -# group => "nagios", -# before => Nagios_Hostextinfo[$name], -# require => File["/etc/nagios/conf.d"], -# } -# nagios_hostextinfo { $name: -# ensure => present, -# icon_image_alt => $operatingsystem, -# icon_image => "base/${operatingsystem}.png", -# statusmap_image => "base/${operatingsystem}.gd2", -# target => "${confdir}/hostextinfo_${name}.cfg" -# } + if $osicon != "NONE" { + case $::operatingsystem { + "debian","ubuntu": { + $iconpath = "base/" + } + default: { + $iconpath = "" + } + } + file { "${confdir}/hostextinfo_${name}.cfg": + ensure => present, + mode => "0640", + owner => "root", + group => "nagios", + before => Nagios_Hostextinfo[$name], + require => File["/etc/nagios/conf.d"], + } + nagios_hostextinfo { $name: + ensure => present, + icon_image_alt => $osname, + icon_image => "${iconpath}${osicon}.png", + statusmap_image => "${iconpath}${osicon}.gd2", + target => "${confdir}/hostextinfo_${name}.cfg" + } + } } @@ -331,7 +341,11 @@ define nagios::service($confdir, $host, $command, $description) { class nagios::target { @@nagios::host { $fqdn: - operatingsystem => inline_template("<%= operatingsystem.downcase %>") + osname => $::operatingsystem, + osicon => $::osfamily ? { + "" => "NONE", + default => inline_template("<%= osfamily.downcase %>") + }, } }