summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-06-24 14:05:36 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-06-24 14:05:36 +0000
commit054a546ff167d60bb13d0ecfc79dc1c1bce2cff0 (patch)
tree883c99ede4a0b156f8dd5128a041a7a480bd4ecb /frontends/php
parent15377955b388639cbfdcbbe684e09f2bde30cafa (diff)
downloadzabbix-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')
-rw-r--r--frontends/php/include/config.inc45
-rw-r--r--frontends/php/map.html128
-rw-r--r--frontends/php/maps.html72
-rw-r--r--frontends/php/sysmap.html226
-rw-r--r--frontends/php/sysmaps.html6
5 files changed, 474 insertions, 3 deletions
diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc
index ad2c4fdc..fc2d28bc 100644
--- a/frontends/php/include/config.inc
+++ b/frontends/php/include/config.inc
@@ -303,9 +303,24 @@
?>
</font>
</td>
+ <td colspan=1 bgcolor=FFFFFF align=center valign="top" width="15%">
+ <font face="Arial,Helvetica" size=2>
+ <a href="maps.html">
+<?
+ if($page["file"]=="maps.html")
+ {
+ echo "<b>[NETWORK MAPS]</b></a>";
+ }
+ else
+ {
+ echo "NETWORK MAPS</a>";
+ }
+?>
+ </font>
+ </td>
</tr>
<tr>
- <td colspan=2 bgcolor=FFFFFF align=center valign="top" width="15%">
+ <td colspan=3 bgcolor=FFFFFF align=center valign="top" width="15%">
<font face="Arial,Helvetica" size=2>
<a href="report1.html">
<?
@@ -665,6 +680,10 @@
{
$sql="delete from sysmaps where sysmapid=$sysmapid";
$result=DBexecute($sql);
+ $sql="delete from sysmaps_hosts where sysmapid=$sysmapid";
+ $result=DBexecute($sql);
+ $sql="delete from sysmaps_links where sysmapid=$sysmapid";
+ $result=DBexecute($sql);
}
# Delete Action by userid
@@ -863,6 +882,20 @@
$result=DBexecute($sql);
}
+ function add_link($sysmapid,$shostid1,$shostid2)
+ {
+ $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2) values ($sysmapid,$shostid1,$shostid2)";
+ $result=DBexecute($sql);
+ }
+
+ # Add Host to system map
+
+ function add_host_to_sysmap($sysmapid,$hostid,$label,$x,$y)
+ {
+ $sql="insert into sysmaps_hosts (sysmapid,hostid,label,x,y) values ($sysmapid,$hostid,'$label',$x,$y)";
+ $result=DBexecute($sql);
+ }
+
# Add Host definition
function add_host($host,$port,$status)
@@ -924,6 +957,16 @@
$result=DBexecute($sql);
}
+ # Delete Host from sysmap definition
+
+ function delete_sysmaps_host($shostid)
+ {
+ $sql="delete from sysmaps_hosts where shostid=$shostid";
+ $result=DBexecute($sql);
+ $sql="delete from sysmaps_links where shostid1=$shostid or shostid2=$shostid";
+ $result=DBexecute($sql);
+ }
+
# Delete Host
function delete_host($hostid)
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);
+?>
diff --git a/frontends/php/maps.html b/frontends/php/maps.html
new file mode 100644
index 00000000..b172ecce
--- /dev/null
+++ b/frontends/php/maps.html
@@ -0,0 +1,72 @@
+<?
+ include "include/config.inc";
+ $page["title"] = "Network maps";
+ $page["file"] = "maps.html";
+ show_header($page["title"],0);
+?>
+
+<?
+ show_table_header_begin();
+ echo "NETWORK MAPS";
+
+ show_table_v_delimiter();
+
+ echo "<font size=2>";
+
+ $lasthost="";
+ $result=DBselect("select sysmapid,name from sysmaps order by name");
+
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $sysmapid_=DBget_field($result,$i,0);
+ $name=DBget_field($result,$i,1);
+ if( isset($sysmapid) && ($sysmapid == $sysmapid_) )
+ {
+ echo "<b>[";
+ }
+ echo "<a href='maps.html?sysmapid=$sysmapid_'>$name</a>";
+ if(isset($sysmapid) && ($sysmapid == $sysmapid_) )
+ {
+ echo "]</b>";
+ }
+ echo " ";
+ }
+
+ echo "</font>";
+ show_table_header_end();
+ echo "<br>";
+
+?>
+
+<?
+ if(isset($sysmapid))
+ {
+ $result=DBselect("select name from sysmaps where sysmapid=$sysmapid");
+ $map=DBget_field($result,0,0);
+ }
+ else
+ {
+ $map="Select map to display";
+ }
+
+ show_table_header($map);
+ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=#EEEEEE>";
+ echo "<TR BGCOLOR=#DDDDDD>";
+ echo "<TD ALIGN=CENTER>";
+ if(isset($sysmapid))
+ {
+ echo "<IMG SRC=\"map.html?noedit=1&sysmapid=$sysmapid\">";
+ }
+ else
+ {
+ echo "...";
+ }
+ echo "</TD>";
+ echo "</TR>";
+ echo "</TABLE>";
+?>
+
+<?
+ show_footer();
+?>
diff --git a/frontends/php/sysmap.html b/frontends/php/sysmap.html
new file mode 100644
index 00000000..cebe1de5
--- /dev/null
+++ b/frontends/php/sysmap.html
@@ -0,0 +1,226 @@
+<?
+ include "include/config.inc";
+ $page["title"] = "Configuration of system map";
+ $page["file"] = "sysmap.html";
+ show_header($page["title"],0);
+?>
+
+<?
+ show_table_header("CONFIGURATION OF SYSTEM MAP");
+ echo "<br>";
+?>
+
+<?
+ if(isset($register))
+ {
+ if($register=="add")
+ {
+ add_host_to_sysmap($sysmapid,$hostid,$label,$x,$y);
+ }
+ if($register=="add link")
+ {
+ add_link($sysmapid,$shostid1,$shostid2);
+ }
+ if($register=="delete")
+ {
+ delete_sysmaps_host($shostid);
+ }
+ }
+?>
+
+<?
+ $result=DBselect("select name from sysmaps where sysmapid=$sysmapid");
+ $map=DBget_field($result,0,0);
+ show_table_header($map);
+ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=#DDDDDD>";
+ echo "<TD ALIGN=CENTER>";
+ echo "<IMG SRC=\"map.html?noedit=1&sysmapid=$sysmapid\">";
+ echo "</TD>";
+ echo "</TR>";
+ echo "</TABLE>";
+
+ show_table_header("DISPLAYED HOSTS");
+ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Host</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Label</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>X</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Y</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>";
+ echo "</TR>";
+
+ $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y from sysmaps_hosts sh,hosts h where sh.sysmapid=$sysmapid and h.hostid=sh.hostid");
+ echo "<CENTER>";
+ $col=0;
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ if($col==1)
+ {
+ echo "<TR BGCOLOR=#EEEEEE>";
+ $col=0;
+ } else
+ {
+ echo "<TR BGCOLOR=#DDDDDD>";
+ $col=1;
+ }
+
+ $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);
+
+ echo "<TD>$host</TD>";
+ echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid\">$label</a></TD>";
+ echo "<TD>$x</TD>";
+ echo "<TD>$y</TD>";
+ echo "<TD><A HREF=\"sysmap.html?register=delete&sysmapid=$sysmapid&shostid=$shostid\">Delete</A></TD>";
+ echo "</TR>";
+ }
+ echo "</TABLE>";
+?>
+
+<?
+ show_table_header("CONNECTORS");
+ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>ID</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Host 1</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Host 2</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>";
+ echo "</TR>";
+
+ $result=DBselect("select linkid,shostid1,shostid2 from sysmaps_links order by linkid");
+ echo "<CENTER>";
+ $col=0;
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ if($col==1)
+ {
+ echo "<TR BGCOLOR=#EEEEEE>";
+ $col=0;
+ } else
+ {
+ echo "<TR BGCOLOR=#DDDDDD>";
+ $col=1;
+ }
+
+ $linkid=DBget_field($result,$i,0);
+ $shostid1=DBget_field($result,$i,1);
+ $shostid2=DBget_field($result,$i,2);
+
+ $result1=DBselect("select label from sysmaps_hosts where shostid=$shostid1");
+ $label1=DBget_field($result1,0,0);
+ $result1=DBselect("select label from sysmaps_hosts where shostid=$shostid2");
+ $label2=DBget_field($result1,0,0);
+
+ echo "<TD>$linkid</TD>";
+ echo "<TD>$label1</TD>";
+ echo "<TD>$label2</TD>";
+ echo "<TD><A HREF=\"sysmap.html?register=delete_link&linkid=$linkid\">Delete</A></TD>";
+ echo "</TR>";
+ }
+ echo "</TABLE>";
+?>
+
+
+
+
+
+
+
+
+<?
+ echo "<br>";
+ show_table2_header_begin();
+ echo "New host to display";
+
+ show_table2_v_delimiter();
+ echo "<form method=\"post\" action=\"sysmap.html?sysmapid=$sysmapid\">";
+ echo "Host";
+ show_table2_h_delimiter();
+ $result=DBselect("select hostid,host from hosts order by host");
+ echo "<select name=\"hostid\" size=1>";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $hostid=DBget_field($result,$i,0);
+ $host=DBget_field($result,$i,1);
+ echo "<OPTION VALUE='$hostid'>$host";
+ }
+ echo "</SELECT>";
+
+ show_table2_v_delimiter();
+ echo "Label";
+ show_table2_h_delimiter();
+ echo "<input name=\"label\" size=32 value=\"\">";
+
+ show_table2_v_delimiter();
+ echo "Coordinate X";
+ show_table2_h_delimiter();
+ echo "<input name=\"x\" size=5 value=\"0\">";
+
+ show_table2_v_delimiter();
+ echo "Coordinate Y";
+ show_table2_h_delimiter();
+ echo "<input name=\"y\" size=5 value=\"0\">";
+
+ show_table2_v_delimiter2();
+ echo "<input type=\"submit\" name=\"register\" value=\"add\">";
+
+ show_table2_header_end();
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+<?
+ echo "<br>";
+ show_table2_header_begin();
+ echo "New connector";
+
+ show_table2_v_delimiter();
+ echo "<form method=\"post\" action=\"sysmap.html?sysmapid=$sysmapid\">";
+ echo "Host 1";
+ show_table2_h_delimiter();
+ $result=DBselect("select shostid,label from sysmaps_hosts where sysmapid=$sysmapid order by label");
+ echo "<select name=\"shostid1\" size=1>";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $shostid=DBget_field($result,$i,0);
+ $label=DBget_field($result,$i,1);
+ echo "<OPTION VALUE='$shostid'>$label";
+ }
+ echo "</SELECT>";
+
+ show_table2_v_delimiter();
+ echo "<form method=\"post\" action=\"sysmap.html?sysmapid=$sysmapid\">";
+ echo "Host 2";
+ show_table2_h_delimiter();
+ $result=DBselect("select shostid,label from sysmaps_hosts where sysmapid=$sysmapid order by label");
+ echo "<select name=\"shostid2\" size=1>";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $shostid=DBget_field($result,$i,0);
+ $label=DBget_field($result,$i,1);
+ echo "<OPTION VALUE='$shostid'>$label";
+ }
+ echo "</SELECT>";
+
+ show_table2_v_delimiter2();
+ echo "<input type=\"submit\" name=\"register\" value=\"add link\">";
+
+ show_table2_header_end();
+?>
+
+<?
+ show_footer();
+?>
diff --git a/frontends/php/sysmaps.html b/frontends/php/sysmaps.html
index ed105bc9..955e3b56 100644
--- a/frontends/php/sysmaps.html
+++ b/frontends/php/sysmaps.html
@@ -52,16 +52,18 @@
$name=DBget_field($result,$i,1);
$width=DBget_field($result,$i,2);
$height=DBget_field($result,$i,3);
- echo "<TD><a href=\"sysmaps.html?sysmapid=$sysmapid\">$name</a></TD>";
+ echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid\">$name</a></TD>";
echo "<TD>$width</TD>";
echo "<TD>$height</TD>";
- echo "<TD><A HREF=\"sysmaps.html?register=delete&sysmapid=$sysmapid\">Delete</A></TD>";
+ echo "<TD><A HREF=\"sysmaps.html?sysmapid=$sysmapid#form\">Change</A> - <A HREF=\"sysmaps.html?register=delete&sysmapid=$sysmapid\">Delete</A></TD>";
echo "</TR>";
}
echo "</TABLE>";
?>
<?
+ echo "<a name=\"form\"></a>";
+
echo "<br>";
show_table2_header_begin();
echo "New system map";