".HOST_STATUS_DELETED); while($row=DBfetch($result)) { $host=$row["host"]; $shostid=$row["shostid"]; $sysmapid=$row["sysmapid"]; $hostid=$row["hostid"]; $label=$row["label"]; $x=$row["x"]; $y=$row["y"]; $status=$row["status"]; $icon=$row["icon"]; $icon_on=$row["icon_on"]; $ip=$row["ip"]; $result1=DBselect("select count(distinct t.triggerid) as cnt from items i,functions f,triggers t,hosts h where h.hostid=i.hostid and i.hostid=$hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.value=1 and t.status=0 and h.status=".HOST_STATUS_MONITORED." and i.status=0"); $row1=DBfetch($result1); $count=$row1["cnt"]; if( ($status!=HOST_STATUS_NOT_MONITORED)&&($count>0)) { $icon=$icon_on; } if(@gettype($icons["$icon"])!="resource") { /* if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1)) { $icons[$icon]=ImageCreateFromPNG("images/sysmaps/$icon.png"); } else { $icons[$icon]=ImageCreateFromPNG("images/sysmaps/old/$icon.png"); } */ $sql="select image from images where imagetype=1 and name='".zbx_ads($icon)."'"; $result2=DBselect($sql); if(DBnum_rows($result2)!=1) { $icons[$icon] = imagecreatetruecolor(48,48); } else { $row2=DBfetch($result2); $icons[$icon]=ImageCreateFromString($row2["image"]); } } $img=$icons[$icon]; // imagecolortransparent ($img, imagecolorat ($img, 0, 0)); // imagecolortransparent ($img, 0, 0, 0); ImageCopy($im,$img,$x,$y,0,0,ImageSX($img),ImageSY($img)); $first_line=""; if($label_type==MAP_LABEL_TYPE_HOSTNAME) { $first_line=$host; } else if($label_type==MAP_LABEL_TYPE_HOSTLABEL) { $first_line=$label; } else if($label_type==MAP_LABEL_TYPE_IP) { $first_line=$ip; } if($status == HOST_STATUS_NOT_MONITORED) { $color=$darkred; # $label="Not monitored"; $second_line=""; } else { if($count==1) { $result1=DBselect("select distinct t.description,t.triggerid, t.priority from items i,functions f,triggers t,hosts h where h.hostid=i.hostid and i.hostid=$hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.value=1 and t.status=0 and h.status=".HOST_STATUS_MONITORED." and i.status=0"); $row1=DBfetch($result1); $second_line=$row1["description"]; if ($row1["priority"] > 3) $color=$red; else $color=$darkyellow; $second_line=expand_trigger_description_simple($row1["triggerid"]); } else if($count>1) { $color=$red; $second_line=$count." ".S_PROBLEMS_SMALL; } else { $color=$darkgreen; $second_line=S_OK_BIG; } } if($map["label_location"] == MAP_LABEL_LOC_TOP) { $x_first=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($first_line)/2; $y_first=$y-2*ImageFontHeight(2); $x_second=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($second_line)/2; $y_second=$y_first+ImageFontHeight(2); } else if($map["label_location"] == MAP_LABEL_LOC_LEFT) { $x_first=$x-ImageFontWidth(2)*strlen($first_line); $y_first=$y+ImageSY($img)/2-ImageFontHeight(2)/2; $x_second=$x-ImageFontWidth(2)*(strlen($first_line)+strlen($second_line))/2; $y_second=$y_first+ImageFontHeight(2); if($first_line=="") $y_second=$y_first+ImageFontHeight(2)/4; } else if($map["label_location"] == MAP_LABEL_LOC_RIGHT) { $x_first=$x+ImageSX($img); $y_first=$y+ImageSY($img)/2-ImageFontHeight(2)/2; $x_second=$x_first+ImageFontWidth(2)*(strlen($first_line)-strlen($second_line))/2; $y_second=$y_first+ImageFontHeight(2); if($first_line=="") $y_second=$y_first+ImageFontHeight(2)/4; } else { $x_first=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($first_line)/2; $y_first=$y+ImageSY($img); $x_second=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($second_line)/2; $y_second=$y_first+ImageFontHeight(2); if($first_line=="") $y_second=$y_first; } if($first_line!="") { ImageFilledRectangle($im,$x_first-2, $y_first,$x_first+ImageFontWidth(2)*strlen($first_line), $y_first+ImageFontHeight(2),$white); ImageString($im, 2, $x_first, $y_first, $first_line,$black); } if($label_type!=MAP_LABEL_TYPE_NOTHING) { ImageFilledRectangle($im,$x_second-2, $y_second,$x_second+ImageFontWidth(2)*strlen($second_line), $y_second+ImageFontHeight(2),$white); ImageString($im, 2, $x_second, $y_second, $second_line,$color); } } ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, S_ZABBIX_URL, $gray); if(MAP_OUTPUT_FORMAT == "JPG") ImageJPEG($im); else ImageOut($im); #default ImageDestroy($im); ?>