"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xymonnet/xymonnet.c" between
xymon-4.3.29.tar.gz and xymon-4.3.30.tar.gz

About: Xymon is a system for monitoring servers, applications and networks (like Big Brother; former name "hobbit").

xymonnet.c  (xymon-4.3.29):xymonnet.c  (xymon-4.3.30)
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Xymon monitor network test tool. */ /* Xymon monitor network test tool. */
/* */ /* */
/* Copyright (C) 2003-2011 Henrik Storner <henrik@hswn.dk> */ /* Copyright (C) 2003-2011 Henrik Storner <henrik@hswn.dk> */
/* */ /* */
/* This program is released under the GNU General Public License (GPL), */ /* This program is released under the GNU General Public License (GPL), */
/* version 2. See the file "COPYING" for details. */ /* version 2. See the file "COPYING" for details. */
/* */ /* */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static char rcsid[] = "$Id: xymonnet.c 8060M 2019-07-23 14:46:51Z (local) $"; static char rcsid[] = "$Id: xymonnet.c 8084 2019-08-30 23:01:18Z jccleaver $";
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include <netdb.h> #include <netdb.h>
skipping to change at line 59 skipping to change at line 59
#include "xymonnet.h" #include "xymonnet.h"
#include "dns.h" #include "dns.h"
#include "contest.h" #include "contest.h"
#include "httptest.h" #include "httptest.h"
#include "httpresult.h" #include "httpresult.h"
#include "httpcookies.h" #include "httpcookies.h"
#include "ldaptest.h" #include "ldaptest.h"
#define DEFAULT_PING_CHILD_COUNT 1 #define DEFAULT_PING_CHILD_COUNT 1
#define MSGBUFSIZE 4096
char *reqenv[] = { char *reqenv[] = {
"NONETPAGE", "NONETPAGE",
"HOSTSCFG", "HOSTSCFG",
"XYMONTMP", "XYMONTMP",
"XYMONHOME", "XYMONHOME",
NULL NULL
}; };
void * svctree; /* All known services, has service_t reco rds */ void * svctree; /* All known services, has service_t reco rds */
skipping to change at line 1298 skipping to change at line 1299
failed = 1; failed = 1;
errprintf("Could not run the command '%s' (exec f ailed)\n", pingcmd); errprintf("Could not run the command '%s' (exec f ailed)\n", pingcmd);
break; break;
default: default:
failed = 1; failed = 1;
errprintf("Execution of '%s' failed with error-co de %d\n", errprintf("Execution of '%s' failed with error-co de %d\n",
pingcmd, WEXITSTATUS(pingstatus)) ; pingcmd, WEXITSTATUS(pingstatus)) ;
} }
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
/* Ignore gcc warnings about truncating filenames when adding a n umber */ /* Ignore gcc warnings about truncating filenames when adding a n umber */
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation" #pragma GCC diagnostic ignored "-Wformat-truncation"
#endif // __GNUC__
/* Open the new ping result file */ /* Open the new ping result file */
snprintf(fn, sizeof(fn), "%s.%02d", pinglog, i); snprintf(fn, sizeof(fn), "%s.%02d", pinglog, i);
logfd = fopen(fn, "r"); logfd = fopen(fn, "r");
if (logfd == NULL) { if (logfd == NULL) {
failed = 1; failed = 1;
errprintf("Cannot open ping output file %s\n", fn); errprintf("Cannot open ping output file %s\n", fn);
} }
if (!debug) unlink(fn); /* We have an open filehandle, so it's ok to delete the file now */ if (!debug) unlink(fn); /* We have an open filehandle, so it's ok to delete the file now */
skipping to change at line 1324 skipping to change at line 1327
FILE *errfd; FILE *errfd;
char buf[1024]; char buf[1024];
errfd = fopen(fn, "r"); errfd = fopen(fn, "r");
if (errfd && fgets(buf, sizeof(buf), errfd)) { if (errfd && fgets(buf, sizeof(buf), errfd)) {
errprintf("%s", buf); errprintf("%s", buf);
} }
if (errfd) fclose(errfd); if (errfd) fclose(errfd);
} }
if (!debug) unlink(fn); if (!debug) unlink(fn);
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif // __GNUC__
if (failed) { if (failed) {
/* Flag all ping tests as "undecided" */ /* Flag all ping tests as "undecided" */
bigfailure = 1; bigfailure = 1;
for (t=service->items; (t); t = t->next) t->open = -1; for (t=service->items; (t); t = t->next) t->open = -1;
} }
else { else {
/* The test did run, and we have a result-file. Look at i t. */ /* The test did run, and we have a result-file. Look at i t. */
while (fgets(l, sizeof(l), logfd)) { while (fgets(l, sizeof(l), logfd)) {
p = strchr(l, '\n'); if (p) *p = '\0'; p = strchr(l, '\n'); if (p) *p = '\0';
skipping to change at line 1833 skipping to change at line 1838
} }
void send_rpcinfo_results(service_t *service, int failgoesclear) void send_rpcinfo_results(service_t *service, int failgoesclear)
{ {
testitem_t *t; testitem_t *t;
int color; int color;
char msgline[2048]; char msgline[2048];
char *msgbuf; char *msgbuf;
char causetext[1024]; char causetext[1024];
msgbuf = (char *)malloc(4096); msgbuf = (char *)malloc(MSGBUFSIZE);
for (t=service->items; (t); t = t->next) { for (t=service->items; (t); t = t->next) {
char *wantedrpcsvcs = NULL; char *wantedrpcsvcs = NULL;
char *p; char *p;
/* First see if the rpcinfo command succeeded */ /* First see if the rpcinfo command succeeded */
*msgbuf = '\0'; *msgbuf = '\0';
color = decide_color(service, service->testname, t, failgoesclear , causetext); color = decide_color(service, service->testname, t, failgoesclear , causetext);
p = strchr(t->testspec, '='); p = strchr(t->testspec, '=');
skipping to change at line 1889 skipping to change at line 1894
else if (rpcinfo) { else if (rpcinfo) {
color = COL_RED; color = COL_RED;
snprintf(msgline, sizeof(msgline), "&%s S ervice %s (ID: %d) NOT found\n", snprintf(msgline, sizeof(msgline), "&%s S ervice %s (ID: %d) NOT found\n",
colorname(COL_RED), rpcsvc, rpcin fo->r_number); colorname(COL_RED), rpcsvc, rpcin fo->r_number);
} }
else { else {
color = COL_RED; color = COL_RED;
snprintf(msgline, sizeof(msgline), "&%s U nknown RPC service %s\n", snprintf(msgline, sizeof(msgline), "&%s U nknown RPC service %s\n",
colorname(COL_RED), rpcsvc); colorname(COL_RED), rpcsvc);
} }
strncat(msgbuf, msgline, (sizeof(msgbuf) - strlen (msgbuf))); strncat(msgbuf, msgline, (MSGBUFSIZE - strlen(msg buf)));
rpcsvc = strtok(NULL, ","); rpcsvc = strtok(NULL, ",");
} }
} }
if (wantedrpcsvcs) xfree(wantedrpcsvcs); if (wantedrpcsvcs) xfree(wantedrpcsvcs);
init_status(color); init_status(color);
snprintf(msgline, sizeof(msgline), "status+%d %s.%s %s %s %s %s, %s\n\n", snprintf(msgline, sizeof(msgline), "status+%d %s.%s %s %s %s %s, %s\n\n",
validity, commafy(t->host->hostname), service->testname, colorname(color), timestamp, validity, commafy(t->host->hostname), service->testname, colorname(color), timestamp,
 End of changes. 8 change blocks. 
3 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)