summaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'frontends')
-rw-r--r--frontends/php/chart3.php4
-rw-r--r--frontends/php/chart4.php4
-rw-r--r--frontends/php/chart5.php4
-rw-r--r--frontends/php/chart_diff.php4
-rw-r--r--frontends/php/chart_sla.php2
-rw-r--r--frontends/php/include/classes.inc.php10
-rw-r--r--frontends/php/include/config.inc.php58
-rw-r--r--frontends/php/include/db.inc.php5
-rw-r--r--frontends/php/include/local_en.inc.php1
-rw-r--r--frontends/php/items.php33
-rw-r--r--frontends/php/latest.php2
-rw-r--r--frontends/php/map.php93
-rw-r--r--frontends/php/sysmap.php59
-rw-r--r--frontends/php/sysmaps.php41
-rw-r--r--frontends/php/trend.php4
-rw-r--r--frontends/php/triggers.php18
16 files changed, 237 insertions, 105 deletions
diff --git a/frontends/php/chart3.php b/frontends/php/chart3.php
index 92a59521..688677fc 100644
--- a/frontends/php/chart3.php
+++ b/frontends/php/chart3.php
@@ -98,7 +98,7 @@
{
// show_table_header("<font color=\"AA0000\">No permissions !</font>");
// show_footer();
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
exit;
}
@@ -301,6 +301,6 @@
$end_time=time(NULL);
ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/chart4.php b/frontends/php/chart4.php
index 2a7000c0..bc9de8d9 100644
--- a/frontends/php/chart4.php
+++ b/frontends/php/chart4.php
@@ -92,7 +92,7 @@
{
// show_table_header("<font color=\"AA0000\">No permissions !</font>");
// show_footer();
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
exit;
}
@@ -205,6 +205,6 @@
$end_time=time(NULL);
ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/chart5.php b/frontends/php/chart5.php
index f8a8ab1b..574a3b5b 100644
--- a/frontends/php/chart5.php
+++ b/frontends/php/chart5.php
@@ -90,7 +90,7 @@
// if(!check_right_on_trigger("R",$_GET["triggerid"]))
// {
-// ImagePng($im);
+// ImageOut($im);
// ImageDestroy($im);
// exit;
// }
@@ -225,6 +225,6 @@
$end_time=time(NULL);
ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/chart_diff.php b/frontends/php/chart_diff.php
index 2f0b1de9..1c5db867 100644
--- a/frontends/php/chart_diff.php
+++ b/frontends/php/chart_diff.php
@@ -91,7 +91,7 @@
{
// show_table_header("<font color=\"AA0000\">No permissions !</font>");
// show_footer();
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
exit;
}
@@ -210,6 +210,6 @@
ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://www.zabbix.com", $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/chart_sla.php b/frontends/php/chart_sla.php
index fa022666..003a4c58 100644
--- a/frontends/php/chart_sla.php
+++ b/frontends/php/chart_sla.php
@@ -79,6 +79,6 @@
ImageString($im, 2,1,1, $s , $white);
$s=sprintf("%2.2f%%", $problem);
ImageString($im, 2,$sizeX-45,1, $s , $white);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/include/classes.inc.php b/frontends/php/include/classes.inc.php
index ec2e68f2..7973e92e 100644
--- a/frontends/php/include/classes.inc.php
+++ b/frontends/php/include/classes.inc.php
@@ -184,7 +184,7 @@
function setWidth($width)
{
-// Avoid sizeX==0, to prevent division bu zero later
+// Avoid sizeX==0, to prevent division by zero later
if($width>0)
{
$this->sizeX=$width;
@@ -321,7 +321,7 @@
{
$this->drawGrid();
ImageString($this->im, 2,$this->sizeX/2 -50,$this->sizeY+$this->shiftY+3, "NO PERMISSIONS" , $this->colors["Dark Red No Alpha"]);
- ImagePng($this->im);
+ ImageOut($this->im);
ImageDestroy($this->im);
exit;
}
@@ -333,7 +333,7 @@
ImageString($this->im, 2,$this->sizeX/2-50, $this->sizeY+$this->shiftY+3, "NO DATA FOUND FOR THIS PERIOD" , $this->colors["Dark Red No Alpha"]);
ImageStringUp($this->im,0,imagesx($this->im)-10,imagesy($this->im)-50, "http://www.zabbix.com", $this->colors["Gray"]);
- ImagePng($this->im);
+ ImageOut($this->im);
ImageDestroy($this->im);
exit;
}
@@ -434,7 +434,7 @@
unset($maxY);
for($i=0;$i<$this->num;$i++)
{
- if(!isset($maxY))
+ if(!isset($maxY)&&(isset($this->max[$i])))
{
if(count($this->max[$i])>0)
{
@@ -628,7 +628,7 @@
$str=sprintf("%0.2f",($end_time-$start_time));
ImageString($this->im, 0,imagesx($this->im)-120,imagesy($this->im)-12,"Generated in $str sec", $this->colors["Gray"]);
- ImagePng($this->im);
+ ImageOut($this->im);
ImageDestroy($this->im);
}
}
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 6e3d2b9f..64b6cf4b 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -683,6 +683,20 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return $graph;
}
+ function get_image_by_name($imagetype,$name)
+ {
+ $sql="select * from images where imagetype=$imagetype and name='$name'";
+ $result=DBselect($sql);
+ if(DBnum_rows($result) == 1)
+ {
+ return DBfetch($result);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
function get_item_by_itemid($itemid)
{
global $ERROR_MSG;
@@ -2665,7 +2679,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
# Update System Map
- function update_sysmap($sysmapid,$name,$width,$height)
+ function update_sysmap($sysmapid,$name,$width,$height,$background)
{
global $ERROR_MSG;
@@ -2675,7 +2689,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 0;
}
- $sql="update sysmaps set name='$name',width=$width,height=$height where sysmapid=$sysmapid";
+ $sql="update sysmaps set name='$name',width=$width,height=$height,background='$background' where sysmapid=$sysmapid";
return DBexecute($sql);
}
@@ -2719,7 +2733,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 0;
}
- $sql="insert into sysmaps (name,width,height,background) values ('$name',$width,$height,load_file('".$background["tmp_name"]."'))";
+ $sql="insert into sysmaps (name,width,height,background) values ('$name',$width,$height,'$background'))";
return DBexecute($sql);
}
@@ -2744,15 +2758,15 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
# Add Host to system map
- function add_host_to_sysmap($sysmapid,$hostid,$label,$x,$y,$icon)
+ function add_host_to_sysmap($sysmapid,$hostid,$label,$x,$y,$icon,$url,$icon_on)
{
- $sql="insert into sysmaps_hosts (sysmapid,hostid,label,x,y,icon) values ($sysmapid,$hostid,'$label',$x,$y,'$icon')";
+ $sql="insert into sysmaps_hosts (sysmapid,hostid,label,x,y,icon,url) values ($sysmapid,$hostid,'$label',$x,$y,'$icon','$url','$icon_on')";
return DBexecute($sql);
}
- function update_sysmap_host($shostid,$sysmapid,$hostid,$label,$x,$y,$icon)
+ function update_sysmap_host($shostid,$sysmapid,$hostid,$label,$x,$y,$icon,$url,$icon_on)
{
- $sql="update sysmaps_hosts set hostid=$hostid,label='$label',x=$x,y=$y,icon='$icon' where shostid=$shostid";
+ $sql="update sysmaps_hosts set hostid=$hostid,label='$label',x=$x,y=$y,icon='$icon',url='$url',icon_on='$icon_on' where shostid=$shostid";
return DBexecute($sql);
}
@@ -2774,7 +2788,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
while($row=DBfetch($result))
{
$item=get_item_by_itemid($row["itemid"]);
- $itemid=add_item($item["description"],$item["key_"],$hostid,$item["delay"],$item["history"],$item["status"],$item["type"],$item["snmp_community"],$item["snmp_oid"],$item["value_type"],"",161,$item["units"],$item["multiplier"],$item["delta"]);
+ $itemid=add_item($item["description"],$item["key_"],$hostid,$item["delay"],$item["history"],$item["status"],$item["type"],$item["snmp_community"],$item["snmp_oid"],$item["value_type"],"",161,$item["units"],$item["multiplier"],$item["delta"],$item["snmpv3_securityname"],$item["snmpv3_securitylevel"],$item["snmpv3_authpassphrase"],$item["snmpv3_privpassphrase"],$item["formula"]);
$sql="select distinct t.triggerid from triggers t,functions f where f.itemid=".$row["itemid"]." and f.triggerid=t.triggerid";
$result2=DBselect($sql);
@@ -4394,7 +4408,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
function get_map_imagemap($sysmapid)
{
$map="\n<map name=links>";
- $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");
+ $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y,h.status,sh.icon,sh.url 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);
@@ -4405,17 +4419,33 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$x=DBget_field($result,$i,5);
$y=DBget_field($result,$i,6);
$status=DBget_field($result,$i,7);
+ $icon=DBget_field($result,$i,8);
+ $url=DBget_field($result,$i,9);
if( ($status==0)||($status==2))
{
- if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1))
+ $sql="select image from images where imagetype=1 and name='$icon'";
+ $result2=DBselect($sql);
+ if(DBnum_rows($result2)==1)
+ {
+ $back=ImageCreateFromString(DBget_field($result2,0,0));
+ $sizex = imagesx($back);
+ $sizey = imagesy($back);
+ if($url=="")
+ {
+ $url="tr_status.php?hostid=$hostid&noactions=true&onlytrue=true&compact=true";
+ }
+ $map=$map."\n<area shape=rect coords=$x,$y,".($x+$sizex).",".($y+$sizey)." href=\"$url\" alt=\"$host\">";
+ }
+
+/* if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1))
{
$map=$map."\n<area shape=rect coords=$x,$y,".($x+48).",".($y+48)." href=\"tr_status.php?hostid=$hostid&noactions=true&onlytrue=true&compact=true\" alt=\"$host\">";
}
else
{
$map=$map."\n<area shape=rect coords=$x,$y,".($x+32).",".($y+32)." href=\"tr_status.php?hostid=$hostid&noactions=true&onlytrue=true&compact=true\" alt=\"$host\">";
- }
+ }*/
}
}
$map=$map."\n</map>";
@@ -4579,4 +4609,10 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
echo "</TR>";
echo "</TABLE>";
}
+
+ function ImageOut($image)
+ {
+// ImageJPEG($image);
+ ImagePNG($image);
+ }
?>
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 8a9174a5..c145a190 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -19,6 +19,9 @@
**/
?>
<?php
+
+// DATABASE CONFIGURATION
+
// $DB_TYPE ="POSTGRESQL";
$DB_TYPE ="MYSQL";
$DB_SERVER ="localhost";
@@ -26,6 +29,8 @@
$DB_USER ="root";
$DB_PASSWORD ="";
+// END OF DATABASE CONFIGURATION
+
$USER_DETAILS ="";
if($DB_TYPE == "MYSQL")
diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php
index 496c6f54..2fd9bbd4 100644
--- a/frontends/php/include/local_en.inc.php
+++ b/frontends/php/include/local_en.inc.php
@@ -308,6 +308,7 @@
define("S_CUSTOM_MULTIPLIER", "Custom multiplier");
define("S_DO_NOT_USE", "Do not use");
define("S_USE_MULTIPLIER", "Use multiplier");
+ define("S_SELECT_HOST_DOT_DOT_DOT", "Select host...");
// latestalarms.php
define("S_LATEST_ALARMS", "Latest alarms");
diff --git a/frontends/php/items.php b/frontends/php/items.php
index f4bce388..84cb9c39 100644
--- a/frontends/php/items.php
+++ b/frontends/php/items.php
@@ -40,6 +40,17 @@
?>
<?php
+ if(isset($_GET["groupid"])&&($_GET["groupid"]==0))
+ {
+ unset($_GET["groupid"]);
+ }
+ if(isset($_GET["hostid"])&&($_GET["hostid"]==0))
+ {
+ unset($_GET["hostid"]);
+ }
+?>
+
+<?php
if(isset($_GET["register"]))
{
if($_GET["register"]=="update")
@@ -129,9 +140,9 @@
?>
<?php
- show_table_header_begin();
+ show_table3_header_begin();
echo S_CONFIGURATION_OF_ITEMS_BIG;;
- show_table_v_delimiter();
+ show_table3_h_delimiter(40);
// Start of new code
echo "<form name=\"form2\" method=\"get\" action=\"items.php\">";
@@ -168,10 +179,16 @@
echo "&nbsp;".S_HOST."&nbsp;";
echo "<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">";
+ echo "<option value=\"0\" ".iif(!isset($_GET["hostid"]),"selected","").">".S_SELECT_HOST_DOT_DOT_DOT;
- $sql=iif(isset($_GET["groupid"]),
- "select h.hostid,h.host from hosts h,hosts_groups hg where h.status in (0,2) and hg.groupid=".$_GET["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host",
- "select h.hostid,h.host from hosts h where h.status in (0,2) group by h.hostid,h.host order by h.host");
+ if(isset($_GET["groupid"]))
+ {
+ $sql="select h.hostid,h.host from hosts h,hosts_groups hg where h.status in (0,2) and hg.groupid=".$_GET["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host";
+ }
+ else
+ {
+ $sql="select h.hostid,h.host from hosts h where h.status in (0,2) group by h.hostid,h.host order by h.host";
+ }
$result=DBselect($sql);
while($row=DBfetch($result))
@@ -206,8 +223,8 @@
{
echo "</TABLE><BR>";
}
- echo "<br>";
- show_table_header("<A HREF='items.php?hostid=".$row["hostid"]."'>".$row["host"]."</A>");
+// echo "<br>";
+// show_table_header("<A HREF='items.php?hostid=".$row["hostid"]."'>".$row["host"]."</A>");
echo "<form method=\"get\" action=\"items.php\">";
echo "<input class=\"biginput\" name=\"hostid\" type=hidden value=".$_GET["hostid"]." size=8>";
echo "<TABLE BORDER=0 COLS=13 align=center WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
@@ -217,7 +234,7 @@
// echo "<TD WIDTH=10% NOSAVE><B>".S_HOST."</B></TD>";
echo "<TD WIDTH=10% NOSAVE><B>".S_KEY."</B></TD>";
echo "<TD WIDTH=10% NOSAVE><B>".S_DESCRIPTION."</B></TD>";
- echo "<TD WIDTH=5% NOSAVE><B>".S_UPDATE_INTERVAL."</B></TD>";
+ echo "<TD WIDTH=5% NOSAVE><B>".nbsp(S_UPDATE_INTERVAL)."</B></TD>";
echo "<TD WIDTH=5% NOSAVE><B>".S_HISTORY."</B></TD>";
echo "<TD WIDTH=5% NOSAVE><B>".S_TRENDS."</B></TD>";
echo "<TD><B>".S_SHORT_NAME."</B></TD>";
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 4c03714c..53741039 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -88,7 +88,7 @@
echo "&nbsp;".S_HOST."&nbsp;";
echo "<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">";
- echo "<option value=\"0\"".iif(!isset($_GET["hostid"])||($_GET["hostid"]==0),"selected","").">Select host...";
+ echo "<option value=\"0\"".iif(!isset($_GET["hostid"])||($_GET["hostid"]==0),"selected","").">".S_SELECT_HOST_DOT_DOT_DOT;
if(isset($_GET["groupid"]))
{
diff --git a/frontends/php/map.php b/frontends/php/map.php
index c1b2cb4f..73c04652 100644
--- a/frontends/php/map.php
+++ b/frontends/php/map.php
@@ -28,13 +28,12 @@
$grid=50;
- $result=DBselect("select name,width,height,use_background,background from sysmaps where sysmapid=".$_GET["sysmapid"]);
+ $result=DBselect("select name,width,height,background from sysmaps where sysmapid=".$_GET["sysmapid"]);
$name=DBget_field($result,0,0);
$width=DBget_field($result,0,1);
$height=DBget_field($result,0,2);
- $use_background=DBget_field($result,0,3);
- $background=DBget_field($result,0,4);
+ $background=DBget_field($result,0,3);
// Header( "Content-type: text/html");
Header( "Content-type: image/png");
@@ -80,14 +79,27 @@
$y=imagesy($im);
# ImageFilledRectangle($im,0,0,$width,$height,$black);
- if($use_background==1)
+ if($background!="")
{
- $back=ImageCreateFromString($background);
- ImageCopy($im,$back,0,0,0,0,imagesx($back),imagesy($back));
+ $sql="select image from images where imagetype=2 and name='$background'";
+ $result2=DBselect($sql);
+ if(DBnum_rows($result2)==1)
+ {
+ $back=ImageCreateFromString(DBget_field($result2,0,0));
+ ImageCopy($im,$back,0,0,0,0,imagesx($back),imagesy($back));
+ }
+ else
+ {
+ ImageFilledRectangle($im,0,0,$width,$height,$white);
+ $x=imagesx($im)/2-ImageFontWidth(4)*strlen($name)/2;
+ ImageString($im, 4,$x,1, $name , $colors["Dark Red"]);
+ }
}
else
{
ImageFilledRectangle($im,0,0,$width,$height,$white);
+ $x=imagesx($im)/2-ImageFontWidth(4)*strlen($name)/2;
+ ImageString($im, 4,$x,1, $name , $colors["Dark Red"]);
}
if(!isset($_GET["border"]))
@@ -95,15 +107,15 @@
ImageRectangle($im,0,0,$width-1,$height-1,$colors["Black"]);
}
- $x=imagesx($im)/2-ImageFontWidth(4)*strlen($name)/2;
- ImageString($im, 4,$x,1, $name , $colors["Dark Red"]);
+// $x=imagesx($im)/2-ImageFontWidth(4)*strlen($name)/2;
+// ImageString($im, 4,$x,1, $name , $colors["Dark Red"]);
$str=date("m.d.Y H:i:s",time(NULL));
ImageString($im, 0,imagesx($im)-120,imagesy($im)-12,"$str", $gray);
if(!check_right("Network map","R",$_GET["sysmapid"]))
{
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
exit();
}
@@ -137,22 +149,41 @@
$color_on=DBget_field($result,$i,5);
$drawtype_on=DBget_field($result,$i,6);
- $result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid1");
+ $result1=DBselect("select x,y,icon from sysmaps_hosts where shostid=$shostid1");
$x1=DBget_field($result1,0,0);
$y1=DBget_field($result1,0,1);
+ $image1=get_image_by_name(1,DBget_field($result1,0,2));
- $result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid2");
+ $result1=DBselect("select x,y,icon from sysmaps_hosts where shostid=$shostid2");
$x2=DBget_field($result1,0,0);
$y2=DBget_field($result1,0,1);
+ $image2=get_image_by_name(1,DBget_field($result1,0,2));
- if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1))
+// Get image dimensions
+
+ if($image1!=0)
{
- $size=48/2;
+ $icon=ImageCreateFromString($image1["image"]);
+ $sizex1=imagesx($icon);
+ $sizey1=imagesx($icon);
}
else
{
- $size=32/2;
+ $sizex1=0;
+ $sizey1=0;
+ }
+ if($image2!=0)
+ {
+ $icon=ImageCreateFromString($image2["image"]);
+ $sizex2=imagesx($icon);
+ $sizey2=imagesx($icon);
}
+ else
+ {
+ $sizex2=0;
+ $sizey2=0;
+ }
+
if(isset($triggerid))
{
$trigger=get_trigger_by_triggerid($triggerid);
@@ -160,45 +191,45 @@
{
if($drawtype_on == GRAPH_DRAW_TYPE_BOLDLINE)
{
- ImageLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors[$color_on]);
- ImageLine($im,$x1+$size,$y1+$size+1,$x2+$size,$y2+$size+1,$colors[$color_on]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors[$color_on]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2+1,$x2+$sizex2/2,$y2+$sizey2/2+1,$colors[$color_on]);
}
else if($drawtype_on == GRAPH_DRAW_TYPE_DASHEDLINE)
{
- DashedLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors[$color_on]);
+ DashedLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors[$color_on]);
}
else
{
- ImageLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors[$color_on]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors[$color_on]);
}
}
else
{
if($drawtype_off == GRAPH_DRAW_TYPE_BOLDLINE)
{
- ImageLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors[$color_off]);
- ImageLine($im,$x1+$size,$y1+$size+1,$x2+$size,$y2+$size+1,$colors[$color_off]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors[$color_off]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2+1,$x2+$sizex2/2,$y2+$sizey2/2+1,$colors[$color_off]);
}
else if($drawtype_off == GRAPH_DRAW_TYPE_DASHEDLINE)
{
- DashedLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors[$color_off]);
+ DashedLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors[$color_off]);
}
else
{
- ImageLine($im,$x1+$size,$y1+$size+1,$x2+$size,$y2+$size+1,$colors[$color_off]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2+1,$x2+$sizex2/2,$y2+$sizey2/2+1,$colors[$color_off]);
}
}
}
else
{
- ImageLine($im,$x1+$size,$y1+$size,$x2+$size,$y2+$size,$colors["Black"]);
+ ImageLine($im,$x1+$sizex1/2,$y1+$sizey1/2,$x2+$sizex2/2,$y2+$sizey2/2,$colors["Black"]);
}
}
# Draw hosts
$icons=array();
- $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y,h.status,sh.icon from sysmaps_hosts sh,hosts h where sh.sysmapid=".$_GET["sysmapid"]." and h.hostid=sh.hostid");
+ $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y,h.status,sh.icon,sh.icon_on from sysmaps_hosts sh,hosts h where sh.sysmapid=".$_GET["sysmapid"]." and h.hostid=sh.hostid");
for($i=0;$i<DBnum_rows($result);$i++)
{
$host=DBget_field($result,$i,0);
@@ -210,6 +241,16 @@
$y=DBget_field($result,$i,6);
$status=DBget_field($result,$i,7);
$icon=DBget_field($result,$i,8);
+ $icon_on=DBget_field($result,$i,9);
+
+
+ $result1=DBselect("select count(distinct t.triggerid) 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 in (0,2) and i.status=0");
+ $count=DBget_field($result1,0,0);
+
+ if( ($status!=1)&&($count>0))
+ {
+ $icon=$icon_on;
+ }
if(@gettype($icons["$icon"])!="resource")
{
@@ -254,8 +295,6 @@
}
else
{
- $result1=DBselect("select count(distinct t.triggerid) 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 in (0,2) and i.status=0");
- $count=DBget_field($result1,0,0);
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 in (0,2) and i.status=0");
@@ -293,6 +332,6 @@
ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, S_ZABBIX_URL, $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php
index e1acb432..f3c45a9f 100644
--- a/frontends/php/sysmap.php
+++ b/frontends/php/sysmap.php
@@ -44,12 +44,12 @@
{
if($_GET["register"]=="add")
{
- $result=add_host_to_sysmap($_GET["sysmapid"],$_GET["hostid"],$_GET["label"],$_GET["x"],$_GET["y"],$_GET["icon"]);
+ $result=add_host_to_sysmap($_GET["sysmapid"],$_GET["hostid"],$_GET["label"],$_GET["x"],$_GET["y"],$_GET["icon"],$_GET["url"],$_GET["icon_on"]);
show_messages($result,"Host added","Cannot add host");
}
if($_GET["register"]=="update")
{
- $result=update_sysmap_host($_GET["shostid"],$_GET["sysmapid"],$_GET["hostid"],$_GET["label"],$_GET["x"],$_GET["y"],$_GET["icon"]);
+ $result=update_sysmap_host($_GET["shostid"],$_GET["sysmapid"],$_GET["hostid"],$_GET["label"],$_GET["x"],$_GET["y"],$_GET["icon"],$_GET["url"],$_GET["icon_on"]);
show_messages($result,"Host updated","Cannot update host");
}
if($_GET["register"]=="add link")
@@ -219,18 +219,23 @@
if(isset($_GET["shostid"]))
{
- $result=DBselect("select hostid,label,x,y,icon from sysmaps_hosts where shostid=".$_GET["shostid"]);
+ $result=DBselect("select hostid,label,x,y,icon,url,icon_on from sysmaps_hosts where shostid=".$_GET["shostid"]);
$hostid=DBget_field($result,0,0);
$label=DBget_field($result,0,1);
$x=DBget_field($result,0,2);
$y=DBget_field($result,0,3);
$icon=DBget_field($result,0,4);
+ $url=DBget_field($result,0,5);
+ $icon_on=DBget_field($result,0,6);
}
else
{
$label="";
$x=0;
$y=0;
+ $icon="";
+ $url="";
+ $icon_on="";
}
show_table2_header_begin();
@@ -267,38 +272,33 @@
echo "</SELECT>";
show_table2_v_delimiter();
- echo "Icon";
+ echo "Icon (OFF)";
show_table2_h_delimiter();
echo "<select class=\"biginput\" name=\"icon\" size=1>";
-/* $icons=array();
- if(function_exists("imagecreatetruecolor")&&@imagecreatetruecolor(1,1))
+ $result=DBselect("select name from images where imagetype=1 order by name");
+ for($i=0;$i<DBnum_rows($result);$i++)
{
- $icons[0]="Server";
- $icons[1]="Workstation";
- $icons[2]="Notebook";
- $icons[3]="Printer";
- $icons[4]="Hub";
- $icons[5]="UPS";
- $icons[6]="Network";
- $icons[7]="Phone";
- $icons[8]="Satellite";
- $num=9;
+ $name=DBget_field($result,$i,0);
+ if(isset($_GET["shostid"]) && ($icon==$name))
+ {
+ echo "<OPTION VALUE='".$name."' SELECTED>".$name;
+ }
+ else
+ {
+ echo "<OPTION VALUE='".$name."'>".$name;
+ }
}
- else
- {
- $icons[0]="Server";
- $icons[1]="Workstation";
- $icons[2]="Printer";
- $icons[3]="Hub";
- $num=4;
- }*/
+ echo "</SELECT>";
+
+ show_table2_v_delimiter();
+ echo "Icon (ON)";
+ show_table2_h_delimiter();
+ echo "<select class=\"biginput\" name=\"icon_on\" size=1>";
$result=DBselect("select name from images where imagetype=1 order by name");
-/* for($i=0;$i<$num;$i++)*/
for($i=0;$i<DBnum_rows($result);$i++)
{
$name=DBget_field($result,$i,0);
- if(isset($_GET["shostid"]) && ($icon==$name))
-// if(isset($_GET["hostid"]) && ($_GET["icon"]==$icons[$i]))
+ if(isset($_GET["shostid"]) && ($icon_on==$name))
{
echo "<OPTION VALUE='".$name."' SELECTED>".$name;
}
@@ -324,6 +324,11 @@
show_table2_h_delimiter();
echo "<input class=\"biginput\" name=\"y\" size=5 value=\"$y\">";
+ show_table2_v_delimiter();
+ echo nbsp("URL");
+ show_table2_h_delimiter();
+ echo "<input class=\"biginput\" name=\"url\" size=64 value=\"$url\">";
+
show_table2_v_delimiter2();
echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add\">";
if(isset($_GET["shostid"]))
diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php
index a3038fd7..3599407d 100644
--- a/frontends/php/sysmaps.php
+++ b/frontends/php/sysmaps.php
@@ -36,25 +36,25 @@
?>
<?php
- if(isset($_POST["register"]))
+ if(isset($_GET["register"]))
{
- if($_POST["register"]=="add")
+ if($_GET["register"]=="add")
{
- $result=add_sysmap($_POST["name"],$_POST["width"],$_POST["height"],$_FILES["background"]);
+ $result=add_sysmap($_GET["name"],$_GET["width"],$_GET["height"],$_GET["background"]);
show_messages($result,"Network map added","Cannot add network map");
print_r($_FILES);
echo $_FILES["background"]["tmp_name"];
}
- if($_POST["register"]=="update")
+ if($_GET["register"]=="update")
{
- $result=update_sysmap($_POST["sysmapid"],$_POST["name"],$_POST["width"],$_POST["height"]);
+ $result=update_sysmap($_GET["sysmapid"],$_GET["name"],$_GET["width"],$_GET["height"],$_GET["background"]);
show_messages($result,"Network map updated","Cannot update network map");
}
- if($_POST["register"]=="delete")
+ if($_GET["register"]=="delete")
{
- $result=delete_sysmap($_POST["sysmapid"]);
+ $result=delete_sysmap($_GET["sysmapid"]);
show_messages($result,"Network map deleted","Cannot delete network map");
- unset($_POST["sysmapid"]);
+ unset($_GET["sysmapid"]);
}
}
?>
@@ -115,16 +115,18 @@
if(isset($_GET["sysmapid"]))
{
- $result=DBselect("select s.sysmapid,s.name,s.width,s.height from sysmaps s where sysmapid=".$_GET["sysmapid"]);
+ $result=DBselect("select s.sysmapid,s.name,s.width,s.height,s.background from sysmaps s where sysmapid=".$_GET["sysmapid"]);
$name=DBget_field($result,0,1);
$width=DBget_field($result,0,2);
$height=DBget_field($result,0,3);
+ $background=DBget_field($result,0,4);
}
else
{
$name="";
$width=800;
$height=600;
+ $background="";
}
echo "<br>";
@@ -132,7 +134,7 @@
echo "New system map";
show_table2_v_delimiter();
- echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"sysmaps.php\">";
+ echo "<form method=\"get\" enctype=\"multipart/form-data\" action=\"sysmaps.php\">";
if(isset($_GET["sysmapid"]))
{
echo "<input class=\"biginput\" name=\"sysmapid\" type=\"hidden\" value=".$_GET["sysmapid"].">";
@@ -154,8 +156,23 @@
show_table2_v_delimiter();
echo "Background image";
show_table2_h_delimiter();
- echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10000000\">";
- echo "<input class=\"biginput\" type=\"file\" name=\"background\">";
+ echo "<select class=\"biginput\" name=\"background\" size=1>";
+ $result=DBselect("select name from images where imagetype=2 order by name");
+ echo "<OPTION VALUE=''>No image...";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $name=DBget_field($result,$i,0);
+ if(isset($_GET["sysmapid"]) && ($background==$name))
+// if(isset($_GET["hostid"]) && ($_GET["icon"]==$icons[$i]))
+ {
+ echo "<OPTION VALUE='".$name."' SELECTED>".$name;
+ }
+ else
+ {
+ echo "<OPTION VALUE='".$name."'>".$name;
+ }
+ }
+ echo "</SELECT>";
show_table2_v_delimiter2();
echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add\">";
diff --git a/frontends/php/trend.php b/frontends/php/trend.php
index fa94a141..e520a368 100644
--- a/frontends/php/trend.php
+++ b/frontends/php/trend.php
@@ -104,7 +104,7 @@
if(!check_right("Item","R",$_GET["itemid"]))
{
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
exit;
}
@@ -278,6 +278,6 @@ else
$end_time=time(NULL);
ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
- ImagePng($im);
+ ImageOut($im);
ImageDestroy($im);
?>
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index 93eba808..6721de74 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -38,6 +38,16 @@
}
?>
+<?php
+ if(isset($_GET["groupid"])&&($_GET["groupid"]==0))
+ {
+ unset($_GET["groupid"]);
+ }
+ if(isset($_GET["hostid"])&&($_GET["hostid"]==0))
+ {
+ unset($_GET["hostid"]);
+ }
+?>
<?php
if(isset($_GET["register"]))
@@ -177,10 +187,12 @@
echo "&nbsp;".S_HOST."&nbsp;";
echo "<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">";
+ echo "<option value=\"0\" ".iif(!isset($_GET["hostid"]),"selected","").">".S_SELECT_HOST_DOT_DOT_DOT;
- $sql=iif(isset($_GET["groupid"]),
- "select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status in (0,2) and h.hostid=i.hostid and hg.groupid=".$_GET["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host",
- "select h.hostid,h.host from hosts h,items i where h.status in (0,2) and h.hostid=i.hostid group by h.hostid,h.host order by h.host");
+ if(isset($_GET["groupid"]))
+ $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status in (0,2) and h.hostid=i.hostid and hg.groupid=".$_GET["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host";
+ else
+ $sql="select h.hostid,h.host from hosts h,items i where h.status in (0,2) and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
$result=DBselect($sql);
while($row=DBfetch($result))