summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-02-01 07:38:54 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-02-01 07:38:54 +0000
commit996d2edfdb0047e72763fa0eed6b0bacd325031d (patch)
tree71da0562b50dc292757790a752cc175c11886766
parent6abc1225a3ce26532620490876c2bfe55799198d (diff)
downloadzabbix-996d2edfdb0047e72763fa0eed6b0bacd325031d.tar.gz
zabbix-996d2edfdb0047e72763fa0eed6b0bacd325031d.tar.xz
zabbix-996d2edfdb0047e72763fa0eed6b0bacd325031d.zip
- added #include <time.h> into db.h (Alexei)
- added support for connection to MySQL via Unix socket (Alexei) - configure to find PostgreSQL in /usr/local/lib and /usr/local/include/pgsql (Alexei) - added set of user-defined parameters for monitoring MySQL servers. See misc/conf/zabbix_agent(d).conf (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@306 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog13
-rw-r--r--configure.in4
-rw-r--r--include/db.c6
-rw-r--r--include/db.h4
-rw-r--r--misc/conf/zabbix_agentd.conf10
-rw-r--r--misc/conf/zabbix_suckerd.conf4
-rw-r--r--misc/conf/zabbix_trapper.conf4
-rw-r--r--misc/conf/zabbix_trapperd.conf4
-rw-r--r--src/zabbix_agent/sysinfo.c2
-rw-r--r--src/zabbix_agent/zabbix_agent.c2
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c7
-rw-r--r--src/zabbix_trapper/zabbix_trapper.c7
-rw-r--r--src/zabbix_trapper/zabbix_trapperd.c9
13 files changed, 66 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ce2e87b..6978e07e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
Changes for 1.0beta2:
+(Add thanks to for Andris ...)
+(Is connection via Unix socket faster ?)
+(Add reconnect in case if server gone)
+(net_listen[] should be unsupported)
+ - added #include <time.h> into db.h (Alexei)
+ - added support for connection to MySQL via Unix socket (Alexei)
+ - configure to find PostgreSQL in /usr/local/lib and
+/usr/local/include/pgsql (Alexei)
+ - added set of user-defined parameters for monitoring MySQL
+servers. See misc/conf/zabbix_agent(d).conf (Alexei)
+ - check_service[smtp] will send QUIT. (Charlie)
- clean compilation on FreeBSD (Alexei)
- clean compilation on Solaris (Alexei)
- check_service[smtp] will send QUIT. Thanks to Charlie. (Alexei)
@@ -9,7 +20,7 @@ Changes for 1.0beta2:
Changes for 1.0beta1:
- - added startup scripts for RedHat. Thanks to Charlie Collins. (Alexei)
+ - added startup scripts for RedHat. (Charlie Collins)
- disabled unfinished "IT SERVICES" functionality (Alexei)
- support for parameter Server in zabbix_agent.conf (Alexei)
- added sample zabbix_trapper(d).conf to misc/conf (Alexei)
diff --git a/configure.in b/configure.in
index 26f0df64..61643e50 100644
--- a/configure.in
+++ b/configure.in
@@ -241,11 +241,15 @@ AC_ARG_WITH(pgsql,
PGSQL_INCDIR=/usr/include/pgsql
elif test -f /usr/include/postgresql/libpq-fe.h; then
PGSQL_INCDIR=/usr/include/postgresql
+ elif test -f /usr/local/include/pgsql/libpq-fe.h; then
+ PGSQL_INCDIR=/usr/local/include/pgsql
else
PGSQL_INCDIR=/usr/local/pgsql/include
fi
if test -f /usr/lib/libpq.a; then
PGSQL_LIBDIR=/usr/lib
+ elif test -f /usr/local/lib/libpq.a; then
+ PGSQL_LIBDIR=/usr/local/lib
else
PGSQL_LIBDIR=/usr/local/pgsql/lib
fi
diff --git a/include/db.c b/include/db.c
index 9e3289b0..dd4fa1a1 100644
--- a/include/db.c
+++ b/include/db.c
@@ -17,11 +17,13 @@
* Connect to database.
* If fails, program terminates.
*/
-void DBconnect( char *dbname, char *dbuser, char *dbpassword)
+void DBconnect( char *dbname, char *dbuser, char *dbpassword, char *dbsocket)
{
/* syslog(LOG_ERR, "[%s] [%s] [%s]\n",dbname, dbuser, dbpassword ); */
#ifdef HAVE_MYSQL
- if( ! mysql_connect( &mysql, NULL, dbuser, dbpassword ) )
+/* For MySQL >3.22.00 */
+/* if( ! mysql_connect( &mysql, NULL, dbuser, dbpassword ) )*/
+ if( ! mysql_real_connect( &mysql, NULL, dbuser, dbpassword, dbname, 0, dbsocket,0 ) )
{
syslog(LOG_ERR, "Failed to connect to database: Error: %s\n",mysql_error(&mysql) );
exit( FAIL );
diff --git a/include/db.h b/include/db.h
index fb1c8130..0cf28405 100644
--- a/include/db.h
+++ b/include/db.h
@@ -1,6 +1,8 @@
#ifndef MON_DB_H
#define MON_DB_H
+/* time_t */
+#include <time.h>
#include "config.h"
#ifdef HAVE_MYSQL
@@ -93,7 +95,7 @@ DB_ACTION
};
-void DBconnect( char *dbname, char *dbuser, char *dbpassword);
+void DBconnect( char *dbname, char *dbuser, char *dbpassword, char *dbsocket);
int DBexecute( char *query );
diff --git a/misc/conf/zabbix_agentd.conf b/misc/conf/zabbix_agentd.conf
index 2531a190..1efd02aa 100644
--- a/misc/conf/zabbix_agentd.conf
+++ b/misc/conf/zabbix_agentd.conf
@@ -24,3 +24,13 @@ DebugLevel=2
# Note that shell command should return numeric value
#UserParameter=system[test],who|wc -l
+
+### Set of parameter for monitoring MySQL server (v3.23.42 and later)
+### Change -u<username> and add -p<password> if required
+
+#UserParameter=mysql[ping],mysqladmin -uroot ping|grep alive|wc -l
+#UserParameter=mysql[uptime],mysqladmin -uroot status|cut -f2 -d":"|cut -f1 -d"T"
+#UserParameter=mysql[threads],mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q"
+#UserParameter=mysql[questions],mysqladmin -uroot status|cut -f4 -d":"|cut -f1 -d"S"
+#UserParameter=mysql[slowqueries],mysqladmin -uroot status|cut -f5 -d":"|cut -f1 -d"O"
+#UserParameter=mysql[qps],mysqladmin -uroot status|cut -f9 -d":"
diff --git a/misc/conf/zabbix_suckerd.conf b/misc/conf/zabbix_suckerd.conf
index 6e5cbcb8..d8e77825 100644
--- a/misc/conf/zabbix_suckerd.conf
+++ b/misc/conf/zabbix_suckerd.conf
@@ -36,3 +36,7 @@ DBUser=zabbix
# Comment this line if no password used
#DBPassword=<password>
+
+# Connect to MySQL using Unix socket?
+
+#DBSocket=/tmp/mysql.sock
diff --git a/misc/conf/zabbix_trapper.conf b/misc/conf/zabbix_trapper.conf
index 3692d7d6..95f25a37 100644
--- a/misc/conf/zabbix_trapper.conf
+++ b/misc/conf/zabbix_trapper.conf
@@ -23,3 +23,7 @@ DBUser=zabbix
# Comment this line if no password used
#DBPassword=<password>
+
+# Connect to MySQL usig Unix socket?
+
+#DBSocket=/tmp/mysql.sock
diff --git a/misc/conf/zabbix_trapperd.conf b/misc/conf/zabbix_trapperd.conf
index 8a8f7adb..6003e56b 100644
--- a/misc/conf/zabbix_trapperd.conf
+++ b/misc/conf/zabbix_trapperd.conf
@@ -28,3 +28,7 @@ DBUser=zabbix
# Comment this line if no password used
#DBPassword=<password>
+
+# Connect to MySQL using Unix socket?
+
+#DBSocket=/tmp/mysql.sock
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index 8a334e4c..81a82ffa 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -109,7 +109,7 @@ COMMAND commands[512]=
{"cksum[*]" ,CKSUM, "/etc/services"},
- {"filesize[*]" ,FILESIZE, "/var/log/syslog"},
+ {"filesize[*]" ,FILESIZE, "/etc/passwd"},
{"swap[free]" ,SWAPFREE, 0},
{"swap[total]" ,SWAPTOTAL, 0},
diff --git a/src/zabbix_agent/zabbix_agent.c b/src/zabbix_agent/zabbix_agent.c
index 07032ded..39128f22 100644
--- a/src/zabbix_agent/zabbix_agent.c
+++ b/src/zabbix_agent/zabbix_agent.c
@@ -1,4 +1,4 @@
-/*#define TEST_PARAMETERS*/
+#define TEST_PARAMETERS
#include "config.h"
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index 92ad5fe5..af07dc74 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -42,6 +42,7 @@ int CONFIG_HOUSEKEEPING_FREQUENCY = 1;
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
char *CONFIG_DBPASSWORD = NULL;
+char *CONFIG_DBSOCKET = NULL;
void signal_handler( int sig )
@@ -212,6 +213,10 @@ void process_config_file(void)
{
CONFIG_DBPASSWORD=strdup(value);
}
+ else if(strcmp(parameter,"DBSocket")==0)
+ {
+ CONFIG_DBSOCKET=strdup(value);
+ }
else
{
syslog( LOG_CRIT, "Unsupported parameter [%s] Line %d", parameter, lineno);
@@ -826,7 +831,7 @@ int main(int argc, char **argv)
init_snmp("zabbix_suckerd");
#endif
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD);
+ DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
if(sucker_num == 0)
{
diff --git a/src/zabbix_trapper/zabbix_trapper.c b/src/zabbix_trapper/zabbix_trapper.c
index 1aa887bd..b586a9f8 100644
--- a/src/zabbix_trapper/zabbix_trapper.c
+++ b/src/zabbix_trapper/zabbix_trapper.c
@@ -30,6 +30,7 @@
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
char *CONFIG_DBPASSWORD = NULL;
+char *CONFIG_DBSOCKET = NULL;
void signal_handler( int sig )
{
@@ -120,6 +121,10 @@ void process_config_file(void)
{
CONFIG_DBPASSWORD=strdup(value);
}
+ else if(strcmp(parameter,"DBSocket")==0)
+ {
+ CONFIG_DBSOCKET=strdup(value);
+ }
else
{
syslog( LOG_CRIT, "Unsupported parameter [%s] Line %d", parameter, lineno);
@@ -185,7 +190,7 @@ int main()
value=atof(value_string);
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD);
+ DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
ret=process_data(server,key,value);
diff --git a/src/zabbix_trapper/zabbix_trapperd.c b/src/zabbix_trapper/zabbix_trapperd.c
index a8a1f4fb..c900abeb 100644
--- a/src/zabbix_trapper/zabbix_trapperd.c
+++ b/src/zabbix_trapper/zabbix_trapperd.c
@@ -36,6 +36,7 @@ int CONFIG_TRAPPERD_FORKS = TRAPPERD_FORKS;
char *CONFIG_DBNAME = NULL;
char *CONFIG_DBUSER = NULL;
char *CONFIG_DBPASSWORD = NULL;
+char *CONFIG_DBSOCKET = NULL;
void signal_handler( int sig )
{
@@ -136,6 +137,10 @@ void process_config_file(void)
{
CONFIG_DBPASSWORD=strdup(value);
}
+ else if(strcmp(parameter,"DBSocket")==0)
+ {
+ CONFIG_DBSOCKET=strdup(value);
+ }
else
{
syslog( LOG_CRIT, "Unsupported parameter [%s] Line %d", parameter, lineno);
@@ -153,7 +158,7 @@ void process_config_file(void)
exit(1);
}
// Check, if we are able to connect
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD);
+ DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
}
int process(char *s)
@@ -314,7 +319,7 @@ void child_main(int i,int listenfd, int addrlen)
syslog( LOG_WARNING, "zabbix_trapperd %ld started",(long)getpid());
- DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD);
+ DBconnect(CONFIG_DBNAME, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBSOCKET);
for(;;)
{