[sysmon-help] Logs filling up

Jared Mauch jared at puck.nether.net
Tue Dec 16 11:51:31 EST 2003


	Here's a patch that should help those of you that are having
troubles with the warning logs.  It will properly restrict messages
to once per second.

	I'm getting close to releasing the next version
of sysmon, so if you're not seeing this problem, if you can hold off
for a few more days you should get some better code than what this
provides.

	- jared

Index: syswatch.c
===================================================================
RCS file: /home/jared/src/sysmon/cvs/sysmon/src/syswatch.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- syswatch.c	10 Dec 2003 04:25:24 -0000	1.159
+++ syswatch.c	16 Dec 2003 16:38:03 -0000	1.160
@@ -1,4 +1,4 @@
-/* $Id: syswatch.c,v 1.159 2003/12/10 04:25:24 jared Exp $ */
+/* $Id: syswatch.c,v 1.160 2003/12/16 16:38:03 jared Exp $ */
 #include "config.h"
 
 /* Normal global vars */
@@ -1193,6 +1193,9 @@
 	queuehead = NULL;
 }
 
+/*
+ * This makes sure that something being monitored isn't "Dead"
+ */
 void wakeup_checks()
 {
 	/* wake up checks that need timeout */
@@ -1300,7 +1303,9 @@
 do_watch(char *cmdname, int listenport, char *myhostname)
 {
 	struct all_elements_list *hupdata = NULL;
+	time_t now_t, last_t;
 
+	last_t = 0;
 	setup_client_listen(listenport);
 	if (!disable_icmp)
 	{
@@ -1320,13 +1325,18 @@
 			queue_checks();   /* queue checks ready for us */
 		}
 
-		wakeup_checks();  /* wakeup any "stale" checks */
+		time(&now_t);
+		if (now_t > last_t)
+		{
+			wakeup_checks();  /* wakeup any "stale" checks */
+			last_t = now_t;
+		}
 
 		service_checks(); /* do checks that are ready for us */
 
 		needssleep();     /* if we need a sleep, do it here */
 
-		do_tree_periodic(); /* Do periodic checks/tests */
+		do_tree_periodic(now_t); /* Do periodic checks/tests */
 
 		/* dump current network status to a file */
 		if ((html != -1) && (statuschanged))
@@ -1339,7 +1349,7 @@
 		{
 			service_checks();
 			wakeup_checks();
-			do_tree_periodic();
+			do_tree_periodic(now_t);
 			needssleep();
 		}
 		if (stop_daemon)
@@ -1508,12 +1518,8 @@
 /*
  *
  */
-void do_tree_periodic()
+void do_tree_periodic(time_t now)
 {
-	time_t now;
-	
-	time(&now);
-
 	zombiecollect();
 
 	/* walk tree and check for now valid dns entries */



More information about the Sysmon-help mailing list