summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 19:41:55 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 19:41:55 +0000
commit3aaebd72e03febacca675489203a0c2e23861656 (patch)
treed7a435390b4114aec1335fbd11f0fed1c2c05066
parent2f691b3628c4589fe258def9564d78cd134d3ebb (diff)
downloadzabbix-3aaebd72e03febacca675489203a0c2e23861656.tar.gz
zabbix-3aaebd72e03febacca675489203a0c2e23861656.tar.xz
zabbix-3aaebd72e03febacca675489203a0c2e23861656.zip
- added parameter DBHost (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@446 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog5
-rw-r--r--doc/manual.lyx108
-rw-r--r--include/db.c6
-rw-r--r--include/db.h2
-rw-r--r--misc/conf/zabbix_suckerd.conf5
-rw-r--r--misc/conf/zabbix_trapper.conf5
-rw-r--r--misc/conf/zabbix_trapperd.conf5
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c10
-rw-r--r--src/zabbix_trapper/zabbix_trapper.c4
-rw-r--r--src/zabbix_trapper/zabbix_trapperd.c6
10 files changed, 142 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f9b12db3..e3f79949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
+Not ready yet:
+
+ - permissions for charts, graphs ,etc etc
+
Changes for 1.0beta5:
+ - added parameter DBHost (Alexei)
- added upgrades/dbpatches/1.0beta4_to_1.0beta5/ with patches (Alexei)
- added support for disktotal[*] (Alexei)
- added support for inodetotal[*] (Alexei)
diff --git a/doc/manual.lyx b/doc/manual.lyx
index 92884eab..9372faf5 100644
--- a/doc/manual.lyx
+++ b/doc/manual.lyx
@@ -4472,7 +4472,7 @@ zabbix
\begin_inset Tabular
-<lyxtabular version="2" rows="14" columns="4">
+<lyxtabular version="2" rows="15" columns="4">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="center" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="center" valignment="top" leftline="true" rightline="true" width="" special="">
@@ -4872,6 +4872,40 @@ User name for connecting to the database
\layout Standard
+DBHost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+No
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+localhost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="left" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+DB host name.
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="false" newpage="false">
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
DBSocket
\end_inset
</cell>
@@ -5556,7 +5590,7 @@ zabbix
\begin_inset Tabular
-<lyxtabular version="2" rows="9" columns="4">
+<lyxtabular version="2" rows="10" columns="4">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="center" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="center" valignment="top" leftline="true" rightline="false" width="" special="">
@@ -5741,6 +5775,40 @@ Experimental parameter.
\layout Standard
+DBHost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+No
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+localhost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+DB host name.
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="false" newpage="false">
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
DBName
\end_inset
</cell>
@@ -5908,7 +5976,7 @@ zabbix_trapperd
\begin_inset Tabular
-<lyxtabular version="2" rows="12" columns="4">
+<lyxtabular version="2" rows="13" columns="4">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="center" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="center" valignment="top" leftline="true" rightline="false" width="" special="">
@@ -6161,6 +6229,40 @@ Number of trappers to start
\layout Standard
+DBHost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+No
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+localhost
+\end_inset
+</cell>
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
+DB host name.
+\end_inset
+</cell>
+</row>
+<row topline="true" bottomline="false" newpage="false">
+<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
+\begin_inset Text
+
+\layout Standard
+
DBName
\end_inset
</cell>
diff --git a/include/db.c b/include/db.c
index a7bb3f07..11de117b 100644
--- a/include/db.c
+++ b/include/db.c
@@ -27,14 +27,14 @@ void DBclose(void)
* Connect to database.
* If fails, program terminates.
*/
-void DBconnect( char *dbname, char *dbuser, char *dbpassword, char *dbsocket)
+void DBconnect(char *dbhost, char *dbname, char *dbuser, char *dbpassword, char *dbsocket)
{
/* 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);
- if( ! mysql_real_connect( &mysql, NULL, dbuser, dbpassword, dbname, 3306, dbsocket,0 ) )
+ if( ! mysql_real_connect( &mysql, dbhost, dbuser, dbpassword, dbname, 3306, dbsocket,0 ) )
{
zabbix_log(LOG_LEVEL_ERR, "Failed to connect to database: Error: %s\n",mysql_error(&mysql) );
exit( FAIL );
@@ -48,7 +48,7 @@ void DBconnect( char *dbname, char *dbuser, char *dbpassword, char *dbsocket)
#ifdef HAVE_PGSQL
/* conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); */
/* conn = PQsetdb(NULL, NULL, NULL, NULL, dbname);*/
- conn = PQsetdbLogin(NULL, NULL, NULL, NULL, dbname, dbuser, dbpassword );
+ conn = PQsetdbLogin(dbhost, NULL, NULL, NULL, dbname, dbuser, dbpassword );
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
diff --git a/include/db.h b/include/db.h
index 86e62b6a..cb0d4901 100644
--- a/include/db.h
+++ b/include/db.h
@@ -115,7 +115,7 @@ DB_ALERT
int retries;
};
-void DBconnect( char *dbname, char *dbuser, char *dbpassword, char *dbsocket);
+void DBconnect(char *dbhost, char *dbname, char *dbuser, char *dbpassword, char *dbsocket);
void DBclose(void);
void DBvacuum(void);
diff --git a/misc/conf/zabbix_suckerd.conf b/misc/conf/zabbix_suckerd.conf
index 35a52fd7..02572f97 100644
--- a/misc/conf/zabbix_suckerd.conf
+++ b/misc/conf/zabbix_suckerd.conf
@@ -49,6 +49,11 @@ PidFile=/var/tmp/zabbix_suckerd.pid
#LogFile=/tmp/zabbix_suckerd.log
+# Database host name
+# Default is localhost
+
+#DBHost=localhost
+
# Database name
DBName=zabbix
diff --git a/misc/conf/zabbix_trapper.conf b/misc/conf/zabbix_trapper.conf
index 46863c38..cc25185a 100644
--- a/misc/conf/zabbix_trapper.conf
+++ b/misc/conf/zabbix_trapper.conf
@@ -21,6 +21,11 @@ Timeout=3
#LogFile=/tmp/zabbix_trapper.log
+# Database host name
+# Default is localhost
+
+#DBHost=localhost
+
# Database name
DBName=zabbix
diff --git a/misc/conf/zabbix_trapperd.conf b/misc/conf/zabbix_trapperd.conf
index 9b5948f0..6528aa09 100644
--- a/misc/conf/zabbix_trapperd.conf
+++ b/misc/conf/zabbix_trapperd.conf
@@ -38,6 +38,11 @@ PidFile=/tmp/zabbix_trapperd.pid
Timeout=3
+# Database host name
+# Default is localhost
+
+#DBHost=localhost
+
# Database name
DBName=zabbix
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index e6392604..5e5e756a 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -49,6 +49,7 @@ static int CONFIG_DISABLE_HOUSEKEEPING = 0;
static int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
static char *CONFIG_PID_FILE = NULL;
static char *CONFIG_LOG_FILE = NULL;
+static char *CONFIG_DBHOST = NULL;
static char *CONFIG_DBNAME = NULL;
static char *CONFIG_DBUSER = NULL;
static char *CONFIG_DBPASSWORD = NULL;
@@ -211,6 +212,7 @@ void init_config(void)
{"DebugLevel",&CONFIG_LOG_LEVEL,0,TYPE_INT,PARM_OPT,0,4},
{"PidFile",&CONFIG_PID_FILE,0,TYPE_STRING,PARM_OPT,0,0},
{"LogFile",&CONFIG_LOG_FILE,0,TYPE_STRING,PARM_OPT,0,0},
+ {"DBHost",&CONFIG_DBHOST,0,TYPE_STRING,PARM_OPT,0,0},
{"DBName",&CONFIG_DBNAME,0,TYPE_STRING,PARM_MAND,0,0},
{"DBUser",&CONFIG_DBUSER,0,TYPE_STRING,PARM_OPT,0,0},
{"DBPassword",&CONFIG_DBPASSWORD,0,TYPE_STRING,PARM_OPT,0,0},
@@ -867,7 +869,7 @@ int main_alerter_loop()
#ifdef HAVE_FUNCTION_SETPROCTITLE
setproctitle("connecting to the database");
#endif
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
sprintf(sql,"select smtp_server,smtp_helo,smtp_email from config");
result = DBselect(sql);
@@ -949,7 +951,7 @@ int main_housekeeping_loop()
#ifdef HAVE_FUNCTION_SETPROCTITLE
setproctitle("connecting to the database");
#endif
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
DBvacuum();
@@ -985,7 +987,7 @@ int main_sucker_loop()
int now;
int nextcheck,sleeptime;
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
for(;;)
{
#ifdef HAVE_FUNCTION_SETPROCTITLE
@@ -1065,7 +1067,7 @@ int main(int argc, char **argv)
zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd started");
/* Need to set trigger status to UNKNOWN since last run */
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
DBupdate_triggers_status_after_restart();
DBclose();
diff --git a/src/zabbix_trapper/zabbix_trapper.c b/src/zabbix_trapper/zabbix_trapper.c
index 9698311e..e99f988d 100644
--- a/src/zabbix_trapper/zabbix_trapper.c
+++ b/src/zabbix_trapper/zabbix_trapper.c
@@ -30,6 +30,7 @@
int CONFIG_TIMEOUT = TRAPPER_TIMEOUT;
int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
char *CONFIG_LOG_FILE = NULL;
+char *CONFIG_DBHOST = NULL;
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
char *CONFIG_DBPASSWORD = NULL;
@@ -60,6 +61,7 @@ void init_config(void)
{"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30},
{"DebugLevel",&CONFIG_LOG_LEVEL,0,TYPE_INT,PARM_OPT,1,3},
{"LogFile",&CONFIG_LOG_FILE,0,TYPE_STRING,PARM_OPT,0,0},
+ {"DBHost",&CONFIG_DBHOST,0,TYPE_STRING,PARM_OPT,0,0},
{"DBName",&CONFIG_DBNAME,0,TYPE_STRING,PARM_MAND,0,0},
{"DBUser",&CONFIG_DBUSER,0,TYPE_STRING,PARM_OPT,0,0},
{"DBPassword",&CONFIG_DBPASSWORD,0,TYPE_STRING,PARM_OPT,0,0},
@@ -126,7 +128,7 @@ int main()
/* ???
value=atof(value_string);*/
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
ret=process_data(0,server,key,value_string);
alarm(0);
diff --git a/src/zabbix_trapper/zabbix_trapperd.c b/src/zabbix_trapper/zabbix_trapperd.c
index 7a4b3cdb..801c327b 100644
--- a/src/zabbix_trapper/zabbix_trapperd.c
+++ b/src/zabbix_trapper/zabbix_trapperd.c
@@ -44,6 +44,7 @@ int CONFIG_NOTIMEWAIT = 0;
int CONFIG_CONNECTONEACH = 0;
char *CONFIG_PID_FILE = NULL;
char *CONFIG_LOG_FILE = NULL;
+char *CONFIG_DBHOST = NULL;
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
char *CONFIG_DBPASSWORD = NULL;
@@ -136,6 +137,7 @@ void init_config(void)
{"DebugLevel",&CONFIG_LOG_LEVEL,0,TYPE_INT,PARM_OPT,0,5},
{"PidFile",&CONFIG_PID_FILE,0,TYPE_STRING,PARM_OPT,0,0},
{"LogFile",&CONFIG_LOG_FILE,0,TYPE_STRING,PARM_OPT,0,0},
+ {"DBHost",&CONFIG_DBHOST,0,TYPE_STRING,PARM_OPT,0,0},
{"DBName",&CONFIG_DBNAME,0,TYPE_STRING,PARM_MAND,0,0},
{"DBUser",&CONFIG_DBUSER,0,TYPE_STRING,PARM_OPT,0,0},
{"DBPassword",&CONFIG_DBPASSWORD,0,TYPE_STRING,PARM_OPT,0,0},
@@ -360,7 +362,7 @@ void child_main(int i,int listenfd, int addrlen)
if(0 == CONFIG_CONNECTONEACH)
{
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
}
for(;;)
@@ -376,7 +378,7 @@ void child_main(int i,int listenfd, int addrlen)
if(1 == CONFIG_CONNECTONEACH)
{
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
+ DBconnect(CONFIG_DBHOST, CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
}
process_child(connfd);
if(1 == CONFIG_CONNECTONEACH)