Code

- Corrected bug for nagios3 (Closes: #825)
authoropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Feb 2010 20:57:16 +0000 (20:57 +0000)
committeropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Feb 2010 20:57:16 +0000 (20:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15628 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/nagios/contrib/goNagios.pl

index 232c56d2225fb40d9bb8cfe170f0b0b5cf6e8990..528d41db891c4f78503809c2944a08cef38aa284 100755 (executable)
@@ -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]))
                {