summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-06-19 10:31:34 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-06-19 10:31:34 +0000
commit24e4c0c1e651a3896b966be7ffb03c78e5b86e74 (patch)
treeb1bc101d5f7f99cf5768aec4b311934cc4923a10
parentb1cf4f71fb1e55fe840887e09aac2317e0c3ea9e (diff)
downloadzabbix-24e4c0c1e651a3896b966be7ffb03c78e5b86e74.tar.gz
zabbix-24e4c0c1e651a3896b966be7ffb03c78e5b86e74.tar.xz
zabbix-24e4c0c1e651a3896b966be7ffb03c78e5b86e74.zip
- link map's connector to a trigger, other changes
git-svn-id: svn://svn.zabbix.com/trunk@830 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog1
-rw-r--r--TODO5
-rw-r--r--create/mysql/schema.sql8
-rw-r--r--create/postgresql/schema.sql8
-rw-r--r--frontends/php/include/config.inc.php11
-rw-r--r--frontends/php/include/defines.inc.php4
-rw-r--r--frontends/php/map.php20
-rw-r--r--frontends/php/sysmap.php39
-rw-r--r--src/zabbix_sucker/pinger.c67
-rw-r--r--upgrades/dbpatches/1.0beta9_to_1.0beta10/mysql/patch.sql7
-rw-r--r--upgrades/dbpatches/1.0beta9_to_1.0beta10/postgresql/patch.sql7
-rw-r--r--zabbix.spec5
12 files changed, 158 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index fd600d65..c2446531 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes for 1.0beta10:
+ - link map's connector to a trigger
- added parameter ListenIP to zabbix_agentd.conf (Alexei)
- added pinger.c and pinger.h (Alexei)
- fixed search of SNMP header files and libs (Alexei)
diff --git a/TODO b/TODO
index 320f4453..18b06a5a 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@
- add MRTG-like graphs + periodic recalculation of aggregate functions
- why '-lsnmp' added to the agent's Makefile
- add support for agent forwarding (proxy)
- - link map's line to a trigger
- proofread Zabbix Manual - Ted Rolle <ted@users.sourceforge.net>
- add complete support for SNMP trapping
- ability to add a library of userwritten c-functions with dlopen/dlsym to
@@ -54,7 +53,6 @@ nu i massu matematicheskih mozhno - dlja super-advanced chuvakov:
graphs:
- - 2000->2K
- min value (0 or automatic)
- customisation of font size
- link items to show them in one graph (network in/out)
@@ -166,14 +164,12 @@ I made changes to the PHP frontend and zabbix_sucker.c to enable the user to spe
- mass-adding of actions
- BUG. zabbix_sucker should accept parameter regardless of "\n" at the end of line
- - update docs related to WIN32 agent
- get rid of long select lists in user forms
- do not send notifications at certain periods of time. Do not monitor services at certain periods of time.
- decrease number of TCP connections between server and agent
- add triggers for all hosts at once
- check Rickard's multithreaded agent
- check new Mariusz patches
- - improve performance of Alarms and Alerts in PHP frontend
- default user name for DB acess should be the same (root)
- add support for downtimes, user availablity, etc
- get rid of false warning messages (like unable to insert ...)
@@ -225,7 +221,6 @@ WIN32 Agent:
- make links look different if something is already registered (as for medias,
actions, etc)
- update trigger status to UNKNOWN if cannot evaluate function
- - when doing UserParameter do not return FAIL in case of timeout
LATER:
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index 9df92ecb..08bd6de4 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -84,6 +84,8 @@ CREATE TABLE sysmaps_links (
sysmapid int(4) DEFAULT '0' NOT NULL,
shostid1 int(4) DEFAULT '0' NOT NULL,
shostid2 int(4) DEFAULT '0' NOT NULL,
+ -- may be NULL
+ triggerid int(4),
PRIMARY KEY (linkid)
) type=InnoDB;
@@ -505,6 +507,8 @@ CREATE TABLE stats (
month int(4) DEFAULT '0' NOT NULL,
day int(4) DEFAULT '0' NOT NULL,
hour int(4) DEFAULT '0' NOT NULL,
- value double(16,4) DEFAULT '0.0000' NOT NULL,
- PRIMARY KEY (itemid,year,month,day,hour),
+ value_max double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_min double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_avg double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,year,month,day,hour)
) type=InnoDB;
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index 6a82cb8e..8619d9dd 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -363,6 +363,8 @@ CREATE TABLE sysmaps_links (
sysmapid int4 DEFAULT '0' NOT NULL,
shostid1 int4 DEFAULT '0' NOT NULL,
shostid2 int4 DEFAULT '0' NOT NULL,
+-- may be NULL
+ triggerid int4,
PRIMARY KEY (linkid),
FOREIGN KEY (sysmapid) REFERENCES sysmaps,
FOREIGN KEY (shostid1) REFERENCES sysmaps_hosts,
@@ -515,8 +517,10 @@ CREATE TABLE stats (
month int4 DEFAULT '0' NOT NULL,
day int4 DEFAULT '0' NOT NULL,
hour int4 DEFAULT '0' NOT NULL,
- value float8 DEFAULT '0.0000' NOT NULL,
- PRIMARY KEY (itemid,year,month,day,hour),
+ value_max float8 DEFAULT '0.0000' NOT NULL,
+ value_min float8 DEFAULT '0.0000' NOT NULL,
+ value_avg float8 DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,year,month,day,hour)
);
VACUUM ANALYZE;
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 58c7c18f..e7c3527f 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -2345,9 +2345,16 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return DBexecute($sql);
}
- function add_link($sysmapid,$shostid1,$shostid2)
+ function add_link($sysmapid,$shostid1,$shostid2,$triggerid)
{
- $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2) values ($sysmapid,$shostid1,$shostid2)";
+ if($triggerid == 0)
+ {
+ $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid) values ($sysmapid,$shostid1,$shostid2,NULL)";
+ }
+ else
+ {
+ $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid) values ($sysmapid,$shostid1,$shostid2,$triggerid)";
+ }
return DBexecute($sql);
}
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 79da5b04..cfc2f89e 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -2,4 +2,8 @@
define("SERVICE_ALGORITHM_NONE",0);
define("SERVICE_ALGORITHM_MAX",1);
define("SERVICE_ALGORITHM_MIN",2);
+
+ define("TRIGGER_VALUE_FALSE",0);
+ define("TRIGGER_VALUE_TRUE",1);
+ define("TRIGGER_VALUE_UNKNOWN",2);
?>
diff --git a/frontends/php/map.php b/frontends/php/map.php
index b599b3a7..5eb1243f 100644
--- a/frontends/php/map.php
+++ b/frontends/php/map.php
@@ -66,11 +66,12 @@
# Draw connectors
- $result=DBselect("select shostid1,shostid2 from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]);
+ $result=DBselect("select shostid1,shostid2,triggerid from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]);
for($i=0;$i<DBnum_rows($result);$i++)
{
$shostid1=DBget_field($result,$i,0);
$shostid2=DBget_field($result,$i,1);
+ $triggerid=DBget_field($result,$i,2);
$result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid1");
$x1=DBget_field($result1,0,0);
@@ -80,7 +81,22 @@
$x2=DBget_field($result1,0,0);
$y2=DBget_field($result1,0,1);
- ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$black);
+ if(isset($triggerid))
+ {
+ $trigger=get_trigger_by_triggerid($triggerid);
+ if($trigger["value"] == TRIGGER_VALUE_TRUE)
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$red);
+ }
+ else
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$black);
+ }
+ }
+ else
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$black);
+ }
}
# Draw hosts
diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php
index f52d3730..11b40acd 100644
--- a/frontends/php/sysmap.php
+++ b/frontends/php/sysmap.php
@@ -34,7 +34,7 @@
}
if($HTTP_GET_VARS["register"]=="add link")
{
- $result=add_link($HTTP_GET_VARS["sysmapid"],$HTTP_GET_VARS["shostid1"],$HTTP_GET_VARS["shostid2"]);
+ $result=add_link($HTTP_GET_VARS["sysmapid"],$HTTP_GET_VARS["shostid1"],$HTTP_GET_VARS["shostid2"],$HTTP_GET_VARS["triggerid"]);
show_messages($result,"Link added","Cannot add link");
}
if($HTTP_GET_VARS["register"]=="delete_link")
@@ -134,10 +134,11 @@
echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
echo "<TD WIDTH=10% NOSAVE><B>Host 1</B></TD>";
echo "<TD WIDTH=10% NOSAVE><B>Host 2</B></TD>";
+ echo "<TD><B>Link status indicator</B></TD>";
echo "<TD WIDTH=10% NOSAVE><B>Actions</B></TD>";
echo "</TR>";
- $result=DBselect("select linkid,shostid1,shostid2 from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]." order by linkid");
+ $result=DBselect("select linkid,shostid1,shostid2,triggerid from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]." order by linkid");
$col=0;
for($i=0;$i<DBnum_rows($result);$i++)
{
@@ -154,14 +155,30 @@
$linkid=DBget_field($result,$i,0);
$shostid1=DBget_field($result,$i,1);
$shostid2=DBget_field($result,$i,2);
+ $triggerid=DBget_field($result,$i,3);
$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);
+ if(isset($triggerid))
+ {
+ $trigger=get_trigger_by_triggerid($triggerid);
+ $description=$trigger["description"];
+ if( strstr($description,"%s"))
+ {
+ $description=expand_trigger_description($triggerid);
+ }
+ }
+ else
+ {
+ $description="-";
+ }
+
echo "<TD>$label1</TD>";
echo "<TD>$label2</TD>";
+ echo "<TD>$description</TD>";
echo "<TD><A HREF=\"sysmap.php?sysmapid=".$HTTP_GET_VARS["sysmapid"]."&register=delete_link&linkid=$linkid\">Delete</A></TD>";
echo "</TR>";
}
@@ -311,6 +328,24 @@
}
echo "</SELECT>";
+ show_table2_v_delimiter();
+ echo "Link status indicator";
+ show_table2_h_delimiter();
+ $result=DBselect("select triggerid,description from triggers order by description");
+ echo "<select class=\"biginput\" name=\"triggerid\" size=1>";
+ echo "<OPTION VALUE='0' SELECTED>-";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $triggerid_=DBget_field($result,$i,0);
+ $description_=DBget_field($result,$i,1);
+ if( strstr($description_,"%s"))
+ {
+ $description_=expand_trigger_description($triggerid_);
+ }
+ echo "<OPTION VALUE='$triggerid_'>$description_";
+ }
+ echo "</SELECT>";
+
show_table2_v_delimiter2();
echo "<input type=\"submit\" name=\"register\" value=\"add link\">";
show_table2_header_end();
diff --git a/src/zabbix_sucker/pinger.c b/src/zabbix_sucker/pinger.c
index 12c83d61..a8a23ffb 100644
--- a/src/zabbix_sucker/pinger.c
+++ b/src/zabbix_sucker/pinger.c
@@ -64,7 +64,7 @@ int create_host_file(void)
if( f == NULL)
{
- zabbix_log( LOG_LEVEL_CRIT, "Cannot hosts file [%s] [%s]",
+ zabbix_log( LOG_LEVEL_ERR, "Cannot hosts file [%s] [%s]",
"/tmp/zabbix_suckerd.pinger", strerror(errno));
return FAIL;
}
@@ -95,8 +95,58 @@ int create_host_file(void)
return SUCCEED;
}
+
+int do_ping(void)
+{
+ FILE *f;
+ static char c[MAX_STRING_LEN+1];
+
+ f=popen("/usr/sbin/fping ...","r");
+ if(f==0)
+ {
+ zabbix_log( LOG_LEVEL_ERR, "Cannot execute /usr/sbin/fping [%s]",
+ strerror(errno));
+ return FAIL;
+ }
+
+ fgets(c,MAX_STRING_LEN,f);
+
+ pclose(f);
+
+ return SUCCEED;
+}
+
+int update_items(void)
+{
+ char sql[MAX_STRING_LEN+1];
+ int i,now;
+
+ now=time(NULL);
+ sprintf(sql,"select h.useip,h.ip,h.host from hosts h where (h.status=%d or (h.status=%d and h.disable_until<=%d))", HOST_STATUS_MONITORED, HOST_STATUS_UNREACHABLE, now);
+ result = DBselect(sql);
+
+ for(i=0;i<DBnum_rows(result);i++)
+ {
+ host.useip=atoi(DBget_field(result,i,0));
+ host.ip=DBget_field(result,i,1);
+ host.host=DBget_field(result,i,2);
+
+ if(HOST_USE_IP == host.useip)
+ {
+ fprintf(f,"%s\n",host.ip);
+ }
+ else
+ {
+ fprintf(f,"%s\n",host.host);
+ }
+ }
+ DBfree_result(result);
+}
+
int main_pinger_loop(void)
{
+ int ret = SUCCEED;
+
for(;;)
{
#ifdef HAVE_FUNCTION_SETPROCTITLE
@@ -104,11 +154,17 @@ int main_pinger_loop(void)
#endif
DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
- create_host_file();
+ ret = create_host_file();
-/* do_ping();
+ if( SUCCEED == ret)
+ {
+ ret = do_ping();
+ }
- update_items();*/
+ if( SUCCEED == ret)
+ {
+ ret = update_items();
+ }
DBclose();
#ifdef HAVE_FUNCTION_SETPROCTITLE
@@ -116,4 +172,7 @@ int main_pinger_loop(void)
#endif
sleep(CONFIG_PINGER_FREQUENCY);
}
+
+ /* Never reached */
+ return ret;
}
diff --git a/upgrades/dbpatches/1.0beta9_to_1.0beta10/mysql/patch.sql b/upgrades/dbpatches/1.0beta9_to_1.0beta10/mysql/patch.sql
index ebe6717b..55e32ce8 100644
--- a/upgrades/dbpatches/1.0beta9_to_1.0beta10/mysql/patch.sql
+++ b/upgrades/dbpatches/1.0beta9_to_1.0beta10/mysql/patch.sql
@@ -1,5 +1,6 @@
alter table items add units varchar(10) DEFAULT '' NOT NULL;
alter table items add multiplier int(4) DEFAULT '' NOT NULL;
+alter table sysmaps_links add triggerid int(4);
update items set units='bps' where key_ like "netload%";
update items set units='bytes' where key_ like "memory[%]";
@@ -19,6 +20,8 @@ CREATE TABLE stats (
month int(4) DEFAULT '0' NOT NULL,
day int(4) DEFAULT '0' NOT NULL,
hour int(4) DEFAULT '0' NOT NULL,
- value double(16,4) DEFAULT '0.0000' NOT NULL,
- PRIMARY KEY (itemid,year,month,day,hour),
+ value_max double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_min double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_avg double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,year,month,day,hour)
) type=InnoDB;
diff --git a/upgrades/dbpatches/1.0beta9_to_1.0beta10/postgresql/patch.sql b/upgrades/dbpatches/1.0beta9_to_1.0beta10/postgresql/patch.sql
index 9737dd88..3dfd53be 100644
--- a/upgrades/dbpatches/1.0beta9_to_1.0beta10/postgresql/patch.sql
+++ b/upgrades/dbpatches/1.0beta9_to_1.0beta10/postgresql/patch.sql
@@ -1,5 +1,6 @@
alter table items add units varchar(10) DEFAULT '' NOT NULL;
alter table items add multiplier int4 DEFAULT '' NOT NULL;
+alter table sysmaps_links add triggerid int4;
update items set units='bps' where key_ like "netload%";
update items set units='bytes' where key_ like "memory[%]";
@@ -16,6 +17,8 @@ CREATE TABLE stats (
month int4 DEFAULT '0' NOT NULL,
day int4 DEFAULT '0' NOT NULL,
hour int4 DEFAULT '0' NOT NULL,
- value float8 DEFAULT '0.0000' NOT NULL,
- PRIMARY KEY (itemid,year,month,day,hour),
+ value_max float8 DEFAULT '0.0000' NOT NULL,
+ value_min float8 DEFAULT '0.0000' NOT NULL,
+ value_avg float8 DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,year,month,day,hour)
);
diff --git a/zabbix.spec b/zabbix.spec
index 833de211..a7c204c5 100644
--- a/zabbix.spec
+++ b/zabbix.spec
@@ -1,5 +1,5 @@
Name: zabbix
-Version: 1.0beta9
+Version: 1.0beta10
Release: 1
Group: System Environment/Daemons
License: LGPL
@@ -124,6 +124,9 @@ install -m 755 misc/init.d/redhat/8.0/zabbix_agentd %{buildroot}%{_sysconfdir}/r
%attr(0755,root,root) %{_libdir}/%{name}/php
%changelog
+* Alexei Vladishev <alex@gobbo.caves.lv>
+- update to 1.0beta10
+
* Tue Jun 01 2003 Harald Holzer <hholzer@may.co.at>
- update to 1.0beta9
- move phpfrontend config to /etc/zabbix