diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-08-11 16:16:22 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-08-11 16:16:22 +0000 |
| commit | cbb3323a0ad2ae65d0134e01b807faf8df99a2d2 (patch) | |
| tree | ad55125fb7f264d94d07d873e00f45c19097f4f6 /src | |
| parent | 150ed6cf4a06893d5ab64eb31c7efc06c4e05744 (diff) | |
| download | zabbix-cbb3323a0ad2ae65d0134e01b807faf8df99a2d2.tar.gz zabbix-cbb3323a0ad2ae65d0134e01b807faf8df99a2d2.tar.xz zabbix-cbb3323a0ad2ae65d0134e01b807faf8df99a2d2.zip | |
- added housekeeping procedure for table sessions (Alexei)
- changed width=\"X%\" to width=X% in *.php (Alexei)
- Status of a trigger will blink if it was changes during last 60
seconds (Alexei)
- Zabbix daemons to update triggers.lastchange when triggers.values
is changed (Alexei)
- added misc/init.d/debian/zabbix-[suckerd|trapperd] (Alexei)
- removed misc/init.d/debian/zabbix-server (Alexei)
- send_email() will timeout after 10 seconds (Alexei)
- DBadd_alarm() renamed to add_alarm() (Alexei)
- support for SCO OpenServer (Alexei). Thanks to Alexender Kirhenstein.
- ./configure will correctly define socklen_t (Alexei)
- <center> changed to <div align=center> (Alexei)
- reason of problem in screen IT Services (Alexei)
- added frontends.php/helpdesk.php (Alexei)
- added tables: problems, problems_comments,categories (Alexei)
- added "...#form" to button Change in form Configuration of Users (Alexei)
- "Just for information" changed to "Information" (Alexei)
- fixed ./configure to correctly find zlib (Alexei)
- housekeeping to delete no more than HousekeepingFrequency*3600 records
from table history and history_str at once (MySQL only) (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@450 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
| -rw-r--r-- | src/zabbix_sucker/zabbix_sucker.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c index 5e5e756a..78435403 100644 --- a/src/zabbix_sucker/zabbix_sucker.c +++ b/src/zabbix_sucker/zabbix_sucker.c @@ -785,10 +785,17 @@ int housekeeping_history(int now) item.lastdelete=atoi(DBget_field(result,i,1)); item.history=atoi(DBget_field(result,i,2)); -/* To be rewritten. Only one delete depending on item.value_type */ +#ifdef HAVE_MYSQL + sprintf (sql,"delete from history where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,CONFIG_HOUSEKEEPING_FREQUENCY*3600); +#else sprintf (sql,"delete from history where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history); +#endif DBexecute(sql); +#ifdef HAVE_MYSQL + sprintf (sql,"delete from history_str where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,CONFIG_HOUSEKEEPING_FREQUENCY*3600); +#else sprintf (sql,"delete from history_str where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history); +#endif DBexecute(sql); sprintf(sql,"update items set lastdelete=%d where itemid=%d",now,item.itemid); @@ -798,6 +805,16 @@ int housekeeping_history(int now) return SUCCEED; } +int housekeeping_sessions(int now) +{ + char sql[MAX_STRING_LEN+1]; + + sprintf (sql,"delete from sessions where lastaccess<%d",now-24*3600); + DBexecute(sql); + + return SUCCEED; +} + int housekeeping_alerts(int now) { char sql[MAX_STRING_LEN+1]; @@ -859,7 +876,7 @@ int main_alerter_loop() char sql[MAX_STRING_LEN+1]; - int i; + int i,res; DB_RESULT *result; DB_ALERT alert; @@ -899,7 +916,11 @@ int main_alerter_loop() if(strcmp(alert.type,ALERT_TYPE_EMAIL)==0) { - if(FAIL == send_mail(smtp_server,smtp_helo,smtp_email,alert.sendto,alert.subject,alert.message)) + /* Hardcoded value */ + alarm(10); + res = send_email(smtp_server,smtp_helo,smtp_email,alert.sendto,alert.subject,alert.message); + alarm(0); + if(FAIL == res) { zabbix_log( LOG_LEVEL_ERR, "Error sending email to '%s' Subject:'%s'", alert.sendto, alert.subject); sprintf(sql,"update alerts set retries=retries+1 where alertid=%d", alert.alertid); @@ -958,20 +979,23 @@ int main_housekeeping_loop() #ifdef HAVE_FUNCTION_SETPROCTITLE setproctitle("housekeeper [removing old values]"); #endif - housekeeping_history(now); #ifdef HAVE_FUNCTION_SETPROCTITLE setproctitle("housekeeper [removing old alarms]"); #endif - housekeeping_alarms(now); #ifdef HAVE_FUNCTION_SETPROCTITLE setproctitle("housekeeper [removing old alerts]"); #endif - housekeeping_alerts(now); + +#ifdef HAVE_FUNCTION_SETPROCTITLE + setproctitle("housekeeper [removing old sessions]"); +#endif + housekeeping_sessions(now); + zabbix_log( LOG_LEVEL_DEBUG, "Sleeping for %d hours", CONFIG_HOUSEKEEPING_FREQUENCY); #ifdef HAVE_FUNCTION_SETPROCTITLE |
