summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--TODO11
-rw-r--r--create/mysql/schema.sql1
-rw-r--r--create/postgresql/schema.sql1
-rw-r--r--frontends/php/config.php1
-rw-r--r--frontends/php/include/defines.inc.php5
-rw-r--r--frontends/php/include/forms.inc.php10
-rw-r--r--frontends/php/include/locales/en_gb.inc.php3
-rw-r--r--frontends/php/include/maps.inc.php8
-rw-r--r--frontends/php/index.php14
-rw-r--r--frontends/php/map.php65
-rwxr-xr-xgo3
-rw-r--r--src/libs/zbxdbhigh/db.c63
-rw-r--r--src/zabbix_server/server.c56
-rw-r--r--src/zabbix_server/trapper/trapper.c2
-rw-r--r--src/zabbix_server/trapper/trapper.h2
16 files changed, 146 insertions, 102 deletions
diff --git a/ChangeLog b/ChangeLog
index e2bb9686..60266a43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
Changes for 1.1beta6:
+ - added support of icon label locations (Alexei)
+ - added new column sysmaps.label_location (Alexei)
+ - better processing of server startup/shutdown (Alexei)
- improved proc.num for Linux, added parameter 'comm' (Eugene)
- fixed two different units in two graph axes (Alexei)
- renamed latestalarms.php and alerts.php (Alexei)
diff --git a/TODO b/TODO
index 55848390..27707ccc 100644
--- a/TODO
+++ b/TODO
@@ -13,8 +13,6 @@
- make failed: http://www.zabbix.com/forum/showthread.php?t=1957
- check if ZABBIX server accepts values returned by W32 agent
- - clear error message if user/name password are wrong for zabbix_server
- - configurable location (left,right,top, bottom) of label for icons
- set host to unrechable if unreachable within N seconds
- explain how templates work in the documentation
- execution of commands on monitored hosts in case of pre-defined events
@@ -211,20 +209,11 @@ graphs:
- link items to show them in one graph (network in/out)
- snmp oid symbolic representation
- - periodically check unsupported items (NxInterval). Can be configurable.
- Latest values->Host->[Show not monitored]
HP:
- add threshold,min,max line for user-defined graphs
- -
-Vel viens wishlists ir pie "IT Services", pielikt pie
-/~zabbix/report3.php?serviceid=1&year=2003
-
- Ka ir reziims, ka paraada visus downtime attieciigajaa meenesii (vai gadaa/nedeelaa).
-(Tipa : time - subservice/trigers - priority - ...)
-
-
- [3] Windows event log checking.
- [4] Latest values. Link to page which shows list of all triggers-related
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index c366fcfc..20661a96 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -126,6 +126,7 @@ CREATE TABLE sysmaps (
height int(4) DEFAULT '0' NOT NULL,
background varchar(64) DEFAULT '' NOT NULL,
label_type int(4) DEFAULT '0' NOT NULL,
+ label_location int(1) DEFAULT '0' NOT NULL,
PRIMARY KEY (sysmapid),
UNIQUE (name)
) type=InnoDB;
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index aceb8912..21f1de6b 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -416,6 +416,7 @@ CREATE TABLE sysmaps (
height int4 DEFAULT '0' NOT NULL,
background varchar(64) DEFAULT '' NOT NULL,
label_type int4 DEFAULT '0' NOT NULL,
+ label_location int2 DEFAULT '0' NOT NULL,
PRIMARY KEY (sysmapid)
);
diff --git a/frontends/php/config.php b/frontends/php/config.php
index 03198787..db826c7b 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -45,6 +45,7 @@
<?php
$fields=array(
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
"config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,3,4,5"), NULL),
"alert_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535),'in_array({config},array(0,5))&&({save}=="Save")'),
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index dadc08f3..315171f2 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -101,6 +101,11 @@
define("MAP_LABEL_TYPE_STATUS",3);
define("MAP_LABEL_TYPE_NOTHING",4);
+ define("MAP_LABEL_LOC_BOTTOM", 0);
+ define("MAP_LABEL_LOC_LEFT", 1);
+ define("MAP_LABEL_LOC_RIGHT", 2);
+ define("MAP_LABEL_LOC_TOP", 3);
+
define("ITEM_TYPE_ZABBIX",0);
define("ITEM_TYPE_SNMPV1",1);
define("ITEM_TYPE_TRAPPER",2);
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index b0ed0e8d..bf6926ff 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -1976,6 +1976,7 @@
$height = $row["height"];
$background = $row["background"];
$label_type = $row["label_type"];
+ $label_location = $row["label_location"];
}
else
{
@@ -1984,6 +1985,7 @@
$height = get_request("height",600);
$background = get_request("background","");
$label_type = get_request("label_type",0);
+ $label_location = get_request("label_location",0);
}
@@ -2012,6 +2014,14 @@
$cmbLabel->AddItem(4,S_NOTHING);
$frmMap->AddRow(S_ICON_LABEL_TYPE,$cmbLabel);
+ $cmbLocation = new CComboBox("label_location",$label_location);
+
+ $cmbLocation->AddItem(0,S_BOTTOM);
+ $cmbLocation->AddItem(1,S_LEFT);
+ $cmbLocation->AddItem(2,S_RIGHT);
+ $cmbLocation->AddItem(3,S_TOP);
+ $frmMap->AddRow(S_ICON_LABEL_LOCATION,$cmbLocation);
+
$frmMap->AddItemToBottomRow(new CButton("save",S_SAVE));
if(isset($_REQUEST["sysmapid"]))
{
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 060e00c3..afd7e0fc 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -474,6 +474,9 @@
"S_NO_MAPS_DEFINED"=> "No maps defined",
"S_CONFIGURATION_OF_NETWORK_MAPS"=> "CONFIGURATION OF NETWORK MAPS",
"S_CREATE_MAP"=> "Create Map",
+ "S_ICON_LABEL_LOCATION"=> "Icon label location",
+ "S_BOTTOM"=> "Bottom",
+ "S_TOP"=> "Top",
// map.php
"S_OK_BIG"=> "OK",
diff --git a/frontends/php/include/maps.inc.php b/frontends/php/include/maps.inc.php
index 90a08797..7169e26e 100644
--- a/frontends/php/include/maps.inc.php
+++ b/frontends/php/include/maps.inc.php
@@ -71,7 +71,7 @@
# Update System Map
- function update_sysmap($sysmapid,$name,$width,$height,$background,$label_type)
+ function update_sysmap($sysmapid,$name,$width,$height,$background,$label_type,$label_location)
{
if(!check_right("Network map","U",$sysmapid))
{
@@ -79,13 +79,13 @@
return 0;
}
- $sql="update sysmaps set name='$name',width=$width,height=$height,background='$background',label_type=$label_type where sysmapid=$sysmapid";
+ $sql="update sysmaps set name='$name',width=$width,height=$height,background='$background',label_type=$label_type,label_location=$label_location where sysmapid=$sysmapid";
return DBexecute($sql);
}
# Add System Map
- function add_sysmap($name,$width,$height,$background,$label_type)
+ function add_sysmap($name,$width,$height,$background,$label_type,$label_location)
{
if(!check_right("Network map","A",0))
{
@@ -93,7 +93,7 @@
return 0;
}
- $sql="insert into sysmaps (name,width,height,background,label_type) values ('$name',$width,$height,'$background',$label_type)";
+ $sql="insert into sysmaps (name,width,height,background,label_type,label_location) values ('$name',$width,$height,'$background',$label_type,$label_location)";
return DBexecute($sql);
}
diff --git a/frontends/php/index.php b/frontends/php/index.php
index 7fd9f857..668ca738 100644
--- a/frontends/php/index.php
+++ b/frontends/php/index.php
@@ -24,7 +24,19 @@
include "include/config.inc.php";
include "include/forms.inc.php";
-
+?>
+<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+// $fields=array(
+// "password"=> array(T_ZBX_STR, O_OPT, NULL, NULL, NULL),
+// "name"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL),
+// "register"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL),
+// "sessionid"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL),
+// "reconnect"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL)
+// );
+// check_fields($fields);
+?>
+<?php
if(isset($_REQUEST["password"]))
{
$password=$_REQUEST["password"];
diff --git a/frontends/php/map.php b/frontends/php/map.php
index a30d7b43..6b72ebba 100644
--- a/frontends/php/map.php
+++ b/frontends/php/map.php
@@ -305,20 +305,11 @@
$first_line=$ip;
}
- if($first_line!="")
- {
-
- $x1=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($first_line)/2;
- $y1=$y+ImageSY($img);
- ImageFilledRectangle($im,$x1-2, $y1,$x1+ImageFontWidth(2)*strlen($first_line), $y1+ImageFontHeight(2),$white);
- ImageString($im, 2, $x1, $y1, $first_line,$black);
- }
-
if($status == HOST_STATUS_NOT_MONITORED)
{
$color=$darkred;
# $label="Not monitored";
- $label="";
+ $second_line="";
}
else
{
@@ -326,35 +317,71 @@
{
$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);
- $label=$row1["description"];
+ $second_line=$row1["description"];
if ($row1["priority"] > 3)
$color=$red;
else
$color=$darkyellow;
- $label=expand_trigger_description_simple($row1["triggerid"]);
+ $second_line=expand_trigger_description_simple($row1["triggerid"]);
}
else if($count>1)
{
$color=$red;
- $label=$count." ".S_PROBLEMS_SMALL;
+ $second_line=$count." ".S_PROBLEMS_SMALL;
}
else
{
$color=$darkgreen;
- $label=S_OK_BIG;
+ $second_line=S_OK_BIG;
}
}
- $x1=$x+ImageSX($img)/2-ImageFontWidth(2)*strlen($label)/2;
- $y1=$y+ImageSY($img);
+
+ 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!="")
{
- $y1=$y1+ImageFontHeight(2);
+ 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,$x1-2, $y1,$x1+ImageFontWidth(2)*strlen($label), $y1+ImageFontHeight(2),$white);
- ImageString($im, 2, $x1, $y1, $label,$color);
+ 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);
}
}
diff --git a/go b/go
index a5a3f389..0eb157c7 100755
--- a/go
+++ b/go
@@ -28,7 +28,8 @@ cp /usr/share/automake-1.9/missing missing
echo Configuring...
export CFLAGS="-Wall"
#export CFLAGS="-Wall -pedantic"
-./configure --with-ldap --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
+#./configure --with-ldap --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
+./configure --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
echo Cleaning...
make clean 2>>WARNINGS >/dev/null
echo Making...
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 1eea3a2d..b4369c9b 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -54,70 +54,45 @@ void DBclose(void)
#endif
}
-static int have_db_err = 0;
-
/*
* Connect to the database.
* If fails, program terminates.
*/
void DBconnect(void)
{
- for(;;)
- {
- /* zabbix_log(LOG_LEVEL_ERR, "[%s] [%s] [%s]\n",dbname, dbuser, dbpassword ); */
+ /* zabbix_log(LOG_LEVEL_ERR, "[%s] [%s] [%s]\n",dbname, dbuser, dbpassword ); */
#ifdef HAVE_MYSQL
/* For MySQL >3.22.00 */
/* if( ! mysql_connect( &mysql, NULL, dbuser, dbpassword ) )*/
- mysql_init(&mysql);
+ mysql_init(&mysql);
- if( ! mysql_real_connect( &mysql, CONFIG_DBHOST, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBNAME, CONFIG_DBPORT, CONFIG_DBSOCKET,0 ) )
- {
- /* Don't print the log message EVERY loop */
- if ( ! have_db_err)
- {
- zabbix_log(LOG_LEVEL_ERR, "Failed to connect to database: Error: %s",mysql_error(&mysql) );
- zabbix_log(LOG_LEVEL_ERR, "Will retry to connect to the database every 30 seconds");
- have_db_err = 1;
- }
- }
- else
+ if( ! mysql_real_connect( &mysql, CONFIG_DBHOST, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBNAME, CONFIG_DBPORT, CONFIG_DBSOCKET,0 ) )
+ {
+ zabbix_log(LOG_LEVEL_ERR, "Failed to connect to database: Error: %s",mysql_error(&mysql) );
+ exit(FAIL);
+ }
+ else
+ {
+ if( mysql_select_db( &mysql, CONFIG_DBNAME ) != 0 )
{
- mysql.reconnect = 1;
-
- if( mysql_select_db( &mysql, CONFIG_DBNAME ) != 0 )
- {
- zabbix_log(LOG_LEVEL_ERR, "Failed to select database: Error: %s",mysql_error(&mysql) );
- exit( FAIL );
- }
- else
- {
- have_db_err = 0;
- break;
- }
+ zabbix_log(LOG_LEVEL_ERR, "Failed to select database: Error: %s",mysql_error(&mysql) );
+ exit(FAIL);
}
+ }
#endif
#ifdef HAVE_PGSQL
/* conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); */
/* conn = PQsetdb(NULL, NULL, NULL, NULL, dbname);*/
- conn = PQsetdbLogin(CONFIG_DBHOST, NULL, NULL, NULL, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD );
+ conn = PQsetdbLogin(CONFIG_DBHOST, NULL, NULL, NULL, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD );
/* check to see that the backend connection was successfully made */
- if (PQstatus(conn) != CONNECTION_OK && !have_db_err)
- {
- zabbix_log(LOG_LEVEL_ERR, "Connection to database '%s' failed.\n", CONFIG_DBNAME);
- zabbix_log(LOG_LEVEL_ERR, "%s", PQerrorMessage(conn));
- zabbix_log(LOG_LEVEL_ERR, "Will retry to connect to the database every 30 seconds");
- have_db_err = 1;
- }
- else
- {
- have_db_err = 0;
- break;
- }
-#endif
- sleep(30);
+ if (PQstatus(conn) != CONNECTION_OK)
+ {
+ zabbix_log(LOG_LEVEL_ERR, "Connection to database '%s' failed.\n", CONFIG_DBNAME);
+ exit(FAIL);
}
+#endif
}
/*
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index cfd9e7e2..6d94571b 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -124,15 +124,21 @@ void uninit(void)
{
zabbix_log( LOG_LEVEL_WARNING, "Cannot kill process. PID=[%d] [%s]", pids[i], strerror(errno));
}
+ else
+ {
+ zabbix_log( LOG_LEVEL_DEBUG, "%d. Killing PID=[%d]", i, pids[i]);
+ }
}
}
if(unlink(CONFIG_PID_FILE) != 0)
{
- zabbix_log( LOG_LEVEL_WARNING, "Cannot remove PID file [%s] [%s]",
+ zabbix_log( LOG_LEVEL_DEBUG, "Cannot remove PID file [%s] [%s]",
CONFIG_PID_FILE, strerror(errno));
}
+ zabbix_log( LOG_LEVEL_CRIT, "ZABBIX server is down.");
}
+ exit(FAIL);
}
/******************************************************************************
@@ -160,15 +166,13 @@ void signal_handler( int sig )
}
else if( SIGQUIT == sig || SIGINT == sig || SIGTERM == sig || SIGPIPE == sig )
{
- zabbix_log( LOG_LEVEL_ERR, "Got QUIT or INT or TERM or PIPE signal. Exiting..." );
+ zabbix_log( LOG_LEVEL_DEBUG, "Server [%d]. Got QUIT or INT or TERM or PIPE signal. Exiting...", server_num );
uninit();
- exit( FAIL );
}
else if( (SIGCHLD == sig) && (server_num == 0) )
{
- zabbix_log( LOG_LEVEL_WARNING, "One child process died. Exiting ...");
+ zabbix_log( LOG_LEVEL_CRIT, "One server process died. Shutting down...");
uninit();
- exit( FAIL );
}
/* else if( SIGCHLD == sig )
{
@@ -332,8 +336,6 @@ void init_config(void)
{0}
};
- char sql[MAX_STRING_LEN];
- DB_RESULT *result;
if(CONFIG_FILE == NULL)
{
@@ -360,15 +362,6 @@ void init_config(void)
CONFIG_FPING_LOCATION=strdup("/usr/sbin/fping");
}
- DBconnect();
-
- snprintf(sql,sizeof(sql)-1,"select refresh_unsupported from config");
- result = DBselect(sql);
-
- if(DBnum_rows(result)==1)
- {
- CONFIG_REFRESH_UNSUPPORTED = atoi(DBget_field(result,0,0));
- }
}
void trend(void)
@@ -425,14 +418,14 @@ int tcp_listen(const char *host, int port, socklen_t *addrlenp)
if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
{
- zabbix_log( LOG_LEVEL_CRIT, "Cannot bind to port %d. Another zabbix_server running ?", port);
- exit(1);
+ zabbix_log( LOG_LEVEL_CRIT, "Cannot bind to port %d. Another zabbix_server running? Shutting down...", port);
+ uninit();
}
if(listen(sockfd, LISTENQ) !=0 )
{
zabbix_log( LOG_LEVEL_CRIT, "listen() failed");
- exit(1);
+ uninit();
}
*addrlenp = sizeof(serv_addr);
@@ -468,6 +461,9 @@ int main(int argc, char **argv)
char host[128];
+ char sql[MAX_STRING_LEN];
+ DB_RESULT *result;
+
/* Parse the command-line. */
while ((ch = getopt(argc, argv, "c:h")) != EOF)
@@ -508,11 +504,22 @@ int main(int argc, char **argv)
if( FAIL == create_pid_file(CONFIG_PID_FILE))
{
- return -1;
+ exit(FAIL);
}
zabbix_log( LOG_LEVEL_WARNING, "Starting zabbix_server. ZABBIX %s.", ZABBIX_VERSION);
+ DBconnect();
+
+ snprintf(sql,sizeof(sql)-1,"select refresh_unsupported from config");
+ result = DBselect(sql);
+
+ if(DBnum_rows(result)==1)
+ {
+ CONFIG_REFRESH_UNSUPPORTED = atoi(DBget_field(result,0,0));
+ }
+ DBfree_result(result);
+
/* Need to set trigger status to UNKNOWN since last run */
/* DBconnect() already made in init_config() */
/* DBconnect();*/
@@ -558,11 +565,18 @@ int main(int argc, char **argv)
for(i = CONFIG_SUCKERD_FORKS; i< CONFIG_SUCKERD_FORKS+CONFIG_TRAPPERD_FORKS; i++)
{
- pids[i] = child_trapper_make(i, listenfd, addrlen);
+ pids[i-1] = child_trapper_make(i, listenfd, addrlen);
}
/* First instance of zabbix_server performs housekeeping procedures */
zabbix_log( LOG_LEVEL_WARNING, "server #%d started [Housekeeper]",server_num);
+
+ for(i=0;i<CONFIG_SUCKERD_FORKS+CONFIG_TRAPPERD_FORKS-1;i++)
+ {
+ zabbix_log( LOG_LEVEL_WARNING, "%d. PID=[%d]", i, pids[i]);
+ }
+ zabbix_log( LOG_LEVEL_CRIT, "ZABBIX server is up.");
+
main_housekeeper_loop();
}
else if(server_num == 1)
diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c
index 5513323d..989ebdbd 100644
--- a/src/zabbix_server/trapper/trapper.c
+++ b/src/zabbix_server/trapper/trapper.c
@@ -250,7 +250,7 @@ pid_t child_trapper_make(int i,int listenfd, int addrlen)
}
else
{
-/* server_num=i; */
+ server_num=i;
}
/* never returns */
diff --git a/src/zabbix_server/trapper/trapper.h b/src/zabbix_server/trapper/trapper.h
index ac987262..efc42652 100644
--- a/src/zabbix_server/trapper/trapper.h
+++ b/src/zabbix_server/trapper/trapper.h
@@ -20,6 +20,8 @@
#ifndef ZABBIX_TRAPPER_H
#define ZABBIX_TRAPPER_H
+extern int server_num;
+
extern int CONFIG_TIMEOUT;
extern void signal_handler( int sig );