[Sysfence-commit] sysfence TODO,1.11,1.12 datastruct.c,1.12,1.13 datastruct.h,1.10,1.11 mainloop.c,1
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-06-09 10:46:07
|
Update of /cvsroot/sysfence/sysfence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17138 Modified Files: TODO datastruct.c datastruct.h mainloop.c sysfence.c Log Message: * sffetch step is set to shortest step of all rules Index: datastruct.h =================================================================== RCS file: /cvsroot/sysfence/sysfence/datastruct.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- datastruct.h 3 Jun 2004 23:42:41 -0000 1.10 +++ datastruct.h 9 Jun 2004 10:45:56 -0000 1.11 @@ -179,6 +179,8 @@ typedef struct { // Main statistics database + int fetch_step; + double load[3]; long long int mem[ VA_LAST ]; long long int swap[ VA_LAST ]; @@ -200,5 +202,6 @@ int get_proc_num (sf_database *db, char statemask, uid_t *uid); char * def_2_string (sf_stat_def *def); char * uids_2_str (sf_list *hd); +int get_min_step (sf_rule **rule); /* $Id$ */ Index: datastruct.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/datastruct.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- datastruct.c 5 Jun 2004 12:49:40 -0000 1.12 +++ datastruct.c 9 Jun 2004 10:45:56 -0000 1.13 @@ -297,3 +297,16 @@ return buf; } +int get_min_step (sf_rule **rule) +{ + sf_rule *r; + int next; + + if (! *rule) return 10; // 10 is default + + r = *rule; + next = get_min_step (rule + 1); + if (r->step < next) return r->step; + else return next; +} + Index: TODO =================================================================== RCS file: /cvsroot/sysfence/sysfence/TODO,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- TODO 29 May 2004 16:42:04 -0000 1.11 +++ TODO 9 Jun 2004 10:45:56 -0000 1.12 @@ -7,15 +7,9 @@ So, current TODO is: - + watch number of processes - . group by UIDs - . group by state - e.g.: + ! stopped 'sfwatch' should exit after SIGTERM - nproc > 300 - nproc "http","mysql" > 20 - nproc zombie > 10 - nproc "http" zombie > 5 + ! uid list requires whitespace after separator + ports to other systems . *BSD - AFAIK, these support proc fs, so it looks easy Index: sysfence.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/sysfence.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- sysfence.c 5 Jun 2004 15:51:44 -0000 1.29 +++ sysfence.c 9 Jun 2004 10:45:56 -0000 1.30 @@ -124,6 +124,7 @@ proc_shm = shared_mem_attach (proc_shmid); /* initialize database */ + main_db->fetch_step = get_min_step (ruletab); main_db->fs = (sf_list *) fs_shm; main_db->proc = proc_shm; Index: mainloop.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/mainloop.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- mainloop.c 5 Jun 2004 12:49:40 -0000 1.17 +++ mainloop.c 9 Jun 2004 10:45:56 -0000 1.18 @@ -30,8 +30,6 @@ #include <syslog.h> #endif -int step = 10; - void rule_watch_loop (sf_rule *rule) { while (1) { @@ -90,7 +88,7 @@ semaphore_post (semid); signals_handling (SIGUNBLOCK); - sleep (step); + sleep (db->fetch_step); } } |