diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-06-24 14:05:36 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-06-24 14:05:36 +0000 |
| commit | 054a546ff167d60bb13d0ecfc79dc1c1bce2cff0 (patch) | |
| tree | 883c99ede4a0b156f8dd5128a041a7a480bd4ecb /frontends/php/map.html | |
| parent | 15377955b388639cbfdcbbe684e09f2bde30cafa (diff) | |
| download | zabbix-054a546ff167d60bb13d0ecfc79dc1c1bce2cff0.tar.gz zabbix-054a546ff167d60bb13d0ecfc79dc1c1bce2cff0.tar.xz zabbix-054a546ff167d60bb13d0ecfc79dc1c1bce2cff0.zip | |
Several changes:
- added map.html maps.html sysmap.html
- support for system (network) maps
git-svn-id: svn://svn.zabbix.com/trunk@105 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/map.html')
| -rw-r--r-- | frontends/php/map.html | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/frontends/php/map.html b/frontends/php/map.html new file mode 100644 index 00000000..0f91b263 --- /dev/null +++ b/frontends/php/map.html @@ -0,0 +1,128 @@ +<? + include "include/config.inc"; + +# PARAMETERS: + +# sysmapid +# noedit + + $result=DBselect("select name,width,height from sysmaps where sysmapid=$sysmapid"); + + $name=DBget_field($result,0,0); + $width=DBget_field($result,0,1);; + $height=DBget_field($result,0,2);; + + Header( "Content-type: text/html"); +# Header( "Content-type: image/png"); + Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT"); + + $im = imagecreate($width,$height); + + $red=ImageColorAllocate($im,255,0,0); + $darkred=ImageColorAllocate($im,150,0,0); + $green=ImageColorAllocate($im,0,255,0); + $darkgreen=ImageColorAllocate($im,0,150,0); + $blue=ImageColorAllocate($im,0,0,255); + $yellow=ImageColorAllocate($im,255,255,0); + $cyan=ImageColorAllocate($im,0,255,255); + $white=ImageColorAllocate($im,255,255,255); + $black=ImageColorAllocate($im,0,0,0); + + $x=imagesx($im); + $y=imagesy($im); + +# ImageFilledRectangle($im,0,0,$width,$height,$black); + ImageFilledRectangle($im,0,0,$width,$height,$white); + ImageRectangle($im,0,0,$width-1,$height-1,$black); + + if(!isset($noedit)) + { + for($x=32;$x<$width;$x+=32) + { + ImageDashedLine($im,$x,0,$x,$height,$black); + ImageString($im, 2, $x+2,2, $x , $black); + } + for($y=32;$y<$height;$y+=32) + { + ImageDashedLine($im,0,$y,$width,$y,$black); + ImageString($im, 2, 2,$y+2, $y , $black); + } + + ImageString($im, 2, 1,1, "Y X:" , $black); + } + +# Draw connectors + + $result=DBselect("select shostid1,shostid2 from sysmaps_links where sysmapid=$sysmapid"); + for($i=0;$i<DBnum_rows($result);$i++) + { + $shostid1=DBget_field($result,$i,0); + $shostid2=DBget_field($result,$i,1); + + $result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid1"); + $x1=DBget_field($result1,0,0); + $y1=DBget_field($result1,0,1); + + $result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid2"); + $x2=DBget_field($result1,0,0); + $y2=DBget_field($result1,0,1); + + ImageLine($im,$x1+22,$y1+22,$x2+22,$y2+22,$black); + } + +# Draw hosts + + $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y,h.status from sysmaps_hosts sh,hosts h where sh.sysmapid=$sysmapid and h.hostid=sh.hostid"); + for($i=0;$i<DBnum_rows($result);$i++) + { + $host=DBget_field($result,$i,0); + $shostid=DBget_field($result,$i,1); + $sysmapid=DBget_field($result,$i,2); + $hostid=DBget_field($result,$i,3); + $label=DBget_field($result,$i,4); + $x=DBget_field($result,$i,5); + $y=DBget_field($result,$i,6); + $status=DBget_field($result,$i,7); + + $img=ImageCreateFromPNG("images/sysmaps/host.png"); + ImageCopy($im,$img,$x,$y,0,0,ImageSX($img),ImageSY($img)); + + $x1=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($label)/2; + $y1=$y+ImageSY($img); + ImageFilledRectangle($im,$x1-2, $y1,$x1+ImageFontWidth(2)*strlen($label), $y1+ImageFontHeight(2),$white); + ImageString($im, 2, $x1, $y1, $label,$black); + + if($status == 1) + { + $color=$darkred; + $label="Not monitored"; + } + else + { + $result1=DBselect("select count(*) from items i,functions f,triggers t where i.hostid=$hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.iistrue=1 and h.status=0"); + $count=DBget_field($result,0,0); + if($count>0) + { + $color=$red; + $label="Problems"; + } + else + { + $color=$darkgreen; + $label="OK"; + } + } + $x1=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($label)/2; + $y1=$y+ImageSY($img)+ImageFontHeight(2); + ImageFilledRectangle($im,$x1-2, $y1,$x1+ImageFontWidth(2)*strlen($label), $y1+ImageFontHeight(2),$white); + ImageString($im, 2, $x1, $y1, $label,$color); + +# ImageFilledRectangle($im,$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($label)/2-2, $y+ImageSY($img),$x+ImageSX($img)/2+ImageFontWidth(2)*strlen($label)/2, $y+ImageSY($img)+ImageFontHeight(2),$white); +# ImageString($im, 2, $x+ImageSX($img)/2-ImageFontWidth(2)*strlen($label)/2, $y+ImageSY($img)+ImageFontHeight(2), $label,$color); + + ImageDestroy($img); + } + + ImagePng($im); + ImageDestroy($im); +?> |
