From a618986dd530fed95be3067390b63a8006254d35 Mon Sep 17 00:00:00 2001 From: opensides Date: Mon, 15 Feb 2010 20:57:16 +0000 Subject: [PATCH] - Corrected bug for nagios3 (Closes: #825) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15628 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/nagios/contrib/goNagios.pl | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gosa-plugins/nagios/contrib/goNagios.pl b/gosa-plugins/nagios/contrib/goNagios.pl index 232c56d22..528d41db8 100755 --- a/gosa-plugins/nagios/contrib/goNagios.pl +++ b/gosa-plugins/nagios/contrib/goNagios.pl @@ -116,7 +116,17 @@ my $password=$config_bind{masterPw}; $i=0; foreach $entry (@entries) { $stdout.="\nGroupe $i : \nName\t\t";$groupname[$i]=$entry->get_value('cn');$stdout.=$groupname[$i]; - $stdout.="\n\n\talias:\t\t";$groupdescription[$i]=$entry->get_value('description');$stdout.=$groupdescription[$i]; + + $stdout.="\n\n\talias:\t\t"; + $groupdescription[$i]=$entry->get_value('description'); + + if(defined($groupdescription[$i])) { + $stdout.=$groupdescription[$i]; + } else { + # We need a valid description entry, so we'll just use the groupname + $stdout.=$groupename[$i]; + } + $stdout.="\n\tmembers:\t"; $j=0; foreach $members($entry->get_value('memberUid')) @@ -250,9 +260,14 @@ sub modiffile_group() $stdout.="\n\n$nb_groupe group(s) added in file $file\n"; for($i=0;$i<$nb_groupe;$i++) { - $text.="\n\ndefine contact{\n"; + $text.="\n\ndefine contactgroup{\n"; $text.="\n\tcontactgroup_name \t".$groupname[$i]; - $text.="\n\talias \t\t\t".$groupdescription[$i]; + if(defined($groupdescription[$i])) { + $text.="\n\talias \t\t\t".$groupdescription[$i]; + } else { + # We need a valid alias entry, so we'll just use the groupname + $text.="\n\talias \t\t\t".$groupname[$i]; + } $text.="\n\tmembers \t\t"; while(defined($groupmembers[$i][$j])) { -- 2.30.2