[hobbit] FILE checks

Henrik Stoerner henrik at hswn.dk
Tue Jun 6 18:33:04 CEST 2006


On Tue, Jun 06, 2006 at 03:56:51PM -0000, SigurĂ°ur Bjarnason wrote:
> 
>         FILE /var/log/messages yellow SIZE>0 MTIME<600 TRACK
> 
> Everything is working except the graph for the FILE check is not showing up ?... any ideas ?

Congratulations! You found the first bug in the beta :-)

It wasn't tracking filesizes for log-files. This should solve it.


Regards,
Henrik

-------------- next part --------------
--- hobbitd/hobbitd_client.c	2006/06/04 21:03:41	1.84
+++ hobbitd/hobbitd_client.c	2006/06/06 16:32:33
@@ -11,7 +11,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char rcsid[] = "$Id: hobbitd_client.c,v 1.84 2006/06/04 21:03:41 henrik Exp $";
+static char rcsid[] = "$Id: hobbitd_client.c,v 1.85 2006/06/06 16:32:29 henrik Exp $";
 
 #include <stdio.h>
 #include <string.h>
@@ -874,6 +874,17 @@
 			sfn = swalk->sname+8;
 			sprintf(sectionname, "logfile:%s", sfn);
 			onecolor = check_file(hinfo, clientclass, sfn, swalk->sdata, sectionname, filesummary, &sz, &trackit, &anyrules);
+			if (trackit) {
+				/* Save the size data for later DATA message to track file sizes */
+#ifdef _LARGEFILE_SOURCE
+				sprintf(msgline, "%s:%lld\n", sfn, sz);
+#else
+				sprintf(msgline, "%s:%ld\n", sfn, sz);
+#endif
+				addtobuffer(sizedata, msgline);
+				anyszdata = 1;
+			}
+
 			if (!anyrules) {
 				/* Dont clutter the display with logfiles unless they have rules */
 				continue;


More information about the Xymon mailing list