xymon

Check-in [82738771cf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:logfetch: Make skip/current location text override-able via ENV git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7613 44351d6e-118b-4698-b696-ce33095ecaa4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/4.3.19
Files: files | file ages | folders
SHA3-256: 82738771cf7bf69b3739fe6bc4c3589cd1f01fadcee2565ec1a74c234110b848
User & Date: jccleaver@users.sf.net 2015-03-24 00:49:23
Context
2015-03-24
01:34
logfetch should send final lines in low-maxbytes, multi-trigger situations, not first lines after last trigger. Add more verbose debugging. git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7614 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 9ad9c6d449 user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
00:49
logfetch: Make skip/current location text override-able via ENV git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7613 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 82738771cf user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
00:18
Allow --debug=stderr into set_debugfile() git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7612 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: b8c9f53093 user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to client/logfetch.c.

32
33
34
35
36
37
38




39
40
41
42
43
44
45
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
...
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
....
1234
1235
1236
1237
1238
1239
1240



1241
1242
1243
1244
1245
1246
1247
#ifdef SCO_SV
#include <cpio.h>
#define S_ISSOCK(m)   (((m) & S_IFMT) == C_ISSOCK)
#endif

#include "libxymon.h"





/* Is it ok for these to be hardcoded ? */
#define MAXCHECK   102400   /* When starting, dont look at more than 100 KB of data */
#define MAXMINUTES 30
#define POSCOUNT ((MAXMINUTES / 5) + 1)		/* 0 = current run */
#define DEFAULTSCROLLBACK (POSCOUNT - 1)	/* How far back to begin processing data, in runs */
#define LINES_AROUND_TRIGGER 5

................................................................................
}


char *logdata(char *filename, logdef_t *logdef)
{
	static char *buf, *replacement = NULL;
	char *startpos, *fillpos, *triggerstartpos, *triggerendpos, *curpos = NULL;
	char *curpostxt = "<...CURRENT...>\n";
	FILE *fd;
	struct stat st;
	size_t bytesread, bytesleft;
	int openerr, i, status, triggerlinecount, done;
	char *linepos[2*LINES_AROUND_TRIGGER+1];
	int lpidx;
	int scrollback = DEFAULTSCROLLBACK;
................................................................................
		goto cleanup;
	}

	bytesread = (fillpos - startpos);
	*(buf + bytesread) = '\0';

	if (bytesread > logdef->maxbytes) {
		char *skiptxt = "<...SKIPPED...>\n";

	        if (triggerptrs != NULL) {
		       size_t triggerbytes, nontriggerbytes, skiptxtbytes;
		       char *pos;
		       size_t size;

		       /* Sum the number of bytes required to hold all the trigger content (start -> end anchors) */
................................................................................
		fprintf(stderr, "Missing config or status file arguments\n");
		return 1;
	}

	if (loadconfig(cfgfn) != 0) return 1;
	loadlogstatus(statfn);




	for (walk = checklist; (walk); walk = walk->next) {
		int idx;
		char *data;
		checkdef_t *fwalk;

		switch (walk->checktype) {
		  case C_LOG:







>
>
>
>







 







<







 







<







 







>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
138
139
140
141
142
143
144

145
146
147
148
149
150
151
...
458
459
460
461
462
463
464

465
466
467
468
469
470
471
....
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
#ifdef SCO_SV
#include <cpio.h>
#define S_ISSOCK(m)   (((m) & S_IFMT) == C_ISSOCK)
#endif

#include "libxymon.h"

/* Set via xgetenv */
static char skiptxt[512];
static char curpostxt[512];

/* Is it ok for these to be hardcoded ? */
#define MAXCHECK   102400   /* When starting, dont look at more than 100 KB of data */
#define MAXMINUTES 30
#define POSCOUNT ((MAXMINUTES / 5) + 1)		/* 0 = current run */
#define DEFAULTSCROLLBACK (POSCOUNT - 1)	/* How far back to begin processing data, in runs */
#define LINES_AROUND_TRIGGER 5

................................................................................
}


char *logdata(char *filename, logdef_t *logdef)
{
	static char *buf, *replacement = NULL;
	char *startpos, *fillpos, *triggerstartpos, *triggerendpos, *curpos = NULL;

	FILE *fd;
	struct stat st;
	size_t bytesread, bytesleft;
	int openerr, i, status, triggerlinecount, done;
	char *linepos[2*LINES_AROUND_TRIGGER+1];
	int lpidx;
	int scrollback = DEFAULTSCROLLBACK;
................................................................................
		goto cleanup;
	}

	bytesread = (fillpos - startpos);
	*(buf + bytesread) = '\0';

	if (bytesread > logdef->maxbytes) {


	        if (triggerptrs != NULL) {
		       size_t triggerbytes, nontriggerbytes, skiptxtbytes;
		       char *pos;
		       size_t size;

		       /* Sum the number of bytes required to hold all the trigger content (start -> end anchors) */
................................................................................
		fprintf(stderr, "Missing config or status file arguments\n");
		return 1;
	}

	if (loadconfig(cfgfn) != 0) return 1;
	loadlogstatus(statfn);

	snprintf(skiptxt, sizeof(skiptxt), "%s\n", xgetenv("LOGFETCHSKIPTEXT"));
	snprintf(curpostxt, sizeof(curpostxt), "%s\n", xgetenv("LOGFETCHCURRENTTEXT"));

	for (walk = checklist; (walk); walk = walk->next) {
		int idx;
		char *data;
		checkdef_t *fwalk;

		switch (walk->checktype) {
		  case C_LOG:

Changes to lib/environ.c.

141
142
143
144
145
146
147


148
149
150
151
152
153
154
	{ "HTMLCONTENTTYPE", "text/html" },
	{ "HOLIDAYFORMAT", "%d/%m" },
	{ "WEEKSTART", "1" },
	{ "XYMONBODYCSS", "$XYMONSKIN/xymonbody.css" },
	{ "XYMONBODYMENUCSS", "$XYMONMENUSKIN/xymonmenu.css" },
	{ "XYMONBODYHEADER", "file:$XYMONHOME/etc/xymonmenu.cfg" },
	{ "XYMONBODYFOOTER", "" },


	{ "XYMONALLOKTEXT", "<FONT SIZE=+2 FACE=\"Arial, Helvetica\"><BR><BR><I>All Monitored Systems OK</I></FONT><BR><BR>" },
	{ "HOSTPOPUP", "CDI" },
	{ "STATUSLIFETIME", "30" },
	{ NULL, NULL }
};

char *xgetenv(const char *name)







>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	{ "HTMLCONTENTTYPE", "text/html" },
	{ "HOLIDAYFORMAT", "%d/%m" },
	{ "WEEKSTART", "1" },
	{ "XYMONBODYCSS", "$XYMONSKIN/xymonbody.css" },
	{ "XYMONBODYMENUCSS", "$XYMONMENUSKIN/xymonmenu.css" },
	{ "XYMONBODYHEADER", "file:$XYMONHOME/etc/xymonmenu.cfg" },
	{ "XYMONBODYFOOTER", "" },
	{ "LOGFETCHSKIPTEXT", "<...SKIPPED...>" },
	{ "LOGFETCHCURRENTTEXT", "<...CURRENT...>" },
	{ "XYMONALLOKTEXT", "<FONT SIZE=+2 FACE=\"Arial, Helvetica\"><BR><BR><I>All Monitored Systems OK</I></FONT><BR><BR>" },
	{ "HOSTPOPUP", "CDI" },
	{ "STATUSLIFETIME", "30" },
	{ NULL, NULL }
};

char *xgetenv(const char *name)