summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-02-27 09:55:29 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-02-27 09:55:29 +0000
commitc8b70e6fece0a0aed254bb34cdc02b07dcf8c08e (patch)
treeca55f7bb68147cf855d71009ef59bea4ae6b7946
parent63ee687649ff29546120f7e6ed9d18471f566b9f (diff)
downloadzabbix-c8b70e6fece0a0aed254bb34cdc02b07dcf8c08e.tar.gz
zabbix-c8b70e6fece0a0aed254bb34cdc02b07dcf8c08e.tar.xz
zabbix-c8b70e6fece0a0aed254bb34cdc02b07dcf8c08e.zip
Minor improvement related to the watchdog.
git-svn-id: svn://svn.zabbix.com/trunk@3840 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--src/libs/zbxdbhigh/db.c6
-rw-r--r--src/zabbix_server/watchdog/watchdog.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 9d520b0f..516b8569 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -91,8 +91,12 @@ void DBconnect(int flag)
******************************************************************************/
int DBping(void)
{
- return (ZBX_DB_DOWN == zbx_db_connect(CONFIG_DBHOST, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBNAME, CONFIG_DBSOCKET, CONFIG_DBPORT))? FAIL:SUCCEED;
+ int ret;
+ ret = (ZBX_DB_DOWN == zbx_db_connect(CONFIG_DBHOST, CONFIG_DBUSER, CONFIG_DBPASSWORD, CONFIG_DBNAME, CONFIG_DBSOCKET, CONFIG_DBPORT))? FAIL:SUCCEED;
+ DBclose();
+
+ return ret;
}
/******************************************************************************
diff --git a/src/zabbix_server/watchdog/watchdog.c b/src/zabbix_server/watchdog/watchdog.c
index bda68969..9fa20693 100644
--- a/src/zabbix_server/watchdog/watchdog.c
+++ b/src/zabbix_server/watchdog/watchdog.c
@@ -147,7 +147,7 @@ static void ping_database()
{
zabbix_log(LOG_LEVEL_DEBUG, "In ping_database()");
/* This is test SQL query, it does nothing */
- if(zbx_db_execute("update config set alert_usrgrpid=alert_usrgrpid where 0=1") == ZBX_DB_DOWN)
+ if(DBping() == FAIL)
{
zabbix_log(LOG_LEVEL_WARNING, "Watchdog: Database is down");
send_alerts();