/* check for timestamp structure */ void test_init_dispose(void){ struct timestamp *ts, *ts2; /* check initialize */ ts = init_timestamp(); ts2 = init_timestamp(); assert(ts != NULL); assert(ts2 != NULL); /* check assignment */ ts->start.tv_sec = 1234; ts->start.tv_nsec = 4321; ts->end.tv_sec = 1234; ts->end.tv_nsec = 4321; assert(ts->start.tv_sec == 1234); assert(ts->start.tv_nsec == 4321); assert(ts->end.tv_sec == 1234); assert(ts->end.tv_nsec == 4321); /*check linking structures*/ ts->next = ts2; ts2->next = ts; assert(ts->next == ts2); assert(ts2->next == ts); /* dispose */ dispose_timestamp(ts); dispose_timestamp(ts2); return; }
void test_tick_tack(void){ struct timestamp *ts; time_t diff; ts = init_timestamp(); assert(ts != NULL); tick(ts); usleep(1000000 + 500000); tack(ts); diff = ts->end.tv_sec - ts->start.tv_sec; printf("start=%d:%ld end=%d:%ld\n", (int)(ts->start.tv_sec), ts->start.tv_nsec, (int)(ts->end.tv_sec), ts->end.tv_nsec); dispose_timestamp(ts); }
void test_get_diff(){ struct timestamp *ts; time_t diff_sec; long diff_nsec; ts = init_timestamp(); /*test < 1sec*/ printf("Test in 500msec\n"); tick(ts); usleep(500000); /*500000usec = 500msec*/ tack(ts); diff_sec = get_diff_sec(ts); diff_nsec = get_diff_nanosec(ts); printf("start=%d:%ld end=%d:%ld\n", (int)(ts->start.tv_sec), ts->start.tv_nsec, (int)(ts->end.tv_sec), ts->end.tv_nsec); printf("diff: %dsec + %ld nanosec\n", (int)diff_sec, diff_nsec); /*test 1-2sec*/ printf("Test in 1500msec\n"); tick(ts); usleep(1000000 + 500000); /*1500000usec = 1500msec*/ tack(ts); diff_sec = get_diff_sec(ts); diff_nsec = get_diff_nanosec(ts); printf("start=%d:%ld end=%d:%ld\n", (int)(ts->start.tv_sec), ts->start.tv_nsec, (int)(ts->end.tv_sec), ts->end.tv_nsec); printf("diff: %dsec + %ld nanosec\n", (int)diff_sec, diff_nsec); /*test > 2sec*/ printf("Test in 3800msec\n"); tick(ts); usleep(3000000 + 800000); /*3800000usec = 3800msec*/ tack(ts); diff_sec = get_diff_sec(ts); diff_nsec = get_diff_nanosec(ts); printf("start=%d:%ld end=%d:%ld\n", (int)(ts->start.tv_sec), ts->start.tv_nsec, (int)(ts->end.tv_sec), ts->end.tv_nsec); printf("diff: %dsec + %ld nanosec\n", (int)diff_sec, diff_nsec); dispose_timestamp(ts); }
void egoresult(int color, char *egocolumn) { char msgline[1024]; char *timestamps = NULL; init_timestamp(); combo_start(); init_status(color); sprintf(msgline, "status %s.%s %s snmpcollect %s\n\n", xgetenv("MACHINE"), egocolumn, colorname(color), timestamp); addtostatus(msgline); sprintf(msgline, "Variables : %d\n", varcount); addtostatus(msgline); sprintf(msgline, "PDUs : %d\n", pducount); addtostatus(msgline); sprintf(msgline, "Responses : %d\n", okcount); addtostatus(msgline); sprintf(msgline, "Timeouts : %d\n", timeoutcount); addtostatus(msgline); sprintf(msgline, "Too big : %d\n", toobigcount); addtostatus(msgline); sprintf(msgline, "Errors : %d\n", errorcount); addtostatus(msgline); show_timestamps(×tamps); if (timestamps) { addtostatus(timestamps); xfree(timestamps); } finish_status(); combo_end(); }
int main(int argc, char *argv[]) { char *pagedir; bbgen_page_t *p; dispsummary_t *s; int i; char *pageset = NULL; char *nssidebarfilename = NULL; char *egocolumn = NULL; char *csvfile = NULL; char csvdelim = ','; int embedded = 0; int hobbitddump = 0; char *envarea = NULL; int do_normal_pages = 1; /* Setup standard header+footer (might be modified by option pageset) */ select_headers_and_footers("bb"); bb_color = bb2_color = bbnk_color = -1; pagedir = NULL; init_timestamp(); fqdn = get_fqdn(); /* Setup values from env. vars that may be overridden via commandline options */ if (xgetenv("MKBB2COLREPEAT")) { int i = atoi(xgetenv("MKBB2COLREPEAT")); if (i > 0) maxrowsbeforeheading = i; } for (i = 1; (i < argc); i++) { if ( (strcmp(argv[i], "--hobbitd") == 0) || (argnmatch(argv[i], "--purplelifetime=")) || (strcmp(argv[i], "--nopurple") == 0) ) { /* Deprecated */ } else if (argnmatch(argv[i], "--env=")) { char *lp = strchr(argv[i], '='); loadenv(lp+1, envarea); } else if (argnmatch(argv[i], "--area=")) { char *lp = strchr(argv[i], '='); envarea = strdup(lp+1); } else if (argnmatch(argv[i], "--hobbitddump")) { hobbitddump = 1; } else if (argnmatch(argv[i], "--ignorecolumns=")) { char *lp = strchr(argv[i], '='); ignorecolumns = (char *) malloc(strlen(lp)+2); sprintf(ignorecolumns, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--nk-reds-only")) { nkonlyreds = 1; } else if (argnmatch(argv[i], "--bb2-ignorecolumns=")) { char *lp = strchr(argv[i], '='); bb2ignorecolumns = (char *) malloc(strlen(lp)+2); sprintf(bb2ignorecolumns, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--bb2-colors=")) { char *lp = strchr(argv[i], '=') + 1; bb2colors = colorset(lp, (1 << COL_GREEN)); } else if (argnmatch(argv[i], "--bb2-ignorepurples")) { bb2colors = (bb2colors & ~(1 << COL_PURPLE)); } else if (argnmatch(argv[i], "--bb2-ignoredialups")) { bb2nodialups = 1; } else if (argnmatch(argv[i], "--includecolumns=")) { char *lp = strchr(argv[i], '='); includecolumns = (char *) malloc(strlen(lp)+2); sprintf(includecolumns, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--eventignore=")) { char *lp = strchr(argv[i], '='); eventignorecolumns = (char *) malloc(strlen(lp)+2); sprintf(eventignorecolumns, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--doccgi=")) { char *lp = strchr(argv[i], '='); char *url = (char *)malloc(strlen(xgetenv("CGIBINURL"))+strlen(lp+1)+2); sprintf(url, "%s/%s", xgetenv("CGIBINURL"), lp+1); setdocurl(url); xfree(url); } else if (argnmatch(argv[i], "--docurl=")) { char *lp = strchr(argv[i], '='); setdocurl(lp+1); } else if (argnmatch(argv[i], "--no-doc-window")) { /* This is a no-op now */ } else if (argnmatch(argv[i], "--doc-window")) { setdocurl("TARGET=\"_blank\""); } else if (argnmatch(argv[i], "--htmlextension=")) { char *lp = strchr(argv[i], '='); htmlextension = strdup(lp+1); } else if (argnmatch(argv[i], "--htaccess")) { char *lp = strchr(argv[i], '='); if (lp) htaccess = strdup(lp+1); else htaccess = ".htaccess"; } else if ((strcmp(argv[i], "--wml") == 0) || argnmatch(argv[i], "--wml=")) { char *lp = strchr(argv[i], '='); if (lp) { wapcolumns = (char *) malloc(strlen(lp)+2); sprintf(wapcolumns, ",%s,", (lp+1)); } enable_wmlgen = 1; } else if (argnmatch(argv[i], "--nstab=")) { char *lp = strchr(argv[i], '='); if (strlen(lp+1) > 0) { nssidebarfilename = strdup(lp+1); } else errprintf("--nstab requires a filename\n"); } else if (argnmatch(argv[i], "--nslimit=")) { char *lp = strchr(argv[i], '='); nssidebarcolorlimit = parse_color(lp+1); } else if (argnmatch(argv[i], "--rssversion=")) { char *lp = strchr(argv[i], '='); rssversion = strdup(lp+1); } else if (argnmatch(argv[i], "--rsslimit=")) { char *lp = strchr(argv[i], '='); rsscolorlimit = parse_color(lp+1); } else if (argnmatch(argv[i], "--rss")) { wantrss = 1; } else if (argnmatch(argv[i], "--rssextension=")) { char *lp = strchr(argv[i], '='); rssextension = strdup(lp+1); } else if (argnmatch(argv[i], "--reportopts=")) { char style[MAX_LINE_LEN]; unsigned int rstart, rend; int count = sscanf(argv[i], "--reportopts=%u:%u:%d:%s", &rstart, &rend, &dynamicreport, style); reportstart = rstart; reportend = rend; if (count < 2) { errprintf("Invalid --reportopts option: Must have start- and end-times\n"); return 1; } if (count < 3) dynamicreport = 1; if (count == 4) { if (strcmp(style, stylenames[STYLE_CRIT]) == 0) reportstyle = STYLE_CRIT; else if (strcmp(style, stylenames[STYLE_NONGR]) == 0) reportstyle = STYLE_NONGR; else reportstyle = STYLE_OTHER; } if (reportstart < 788918400) reportstart = 788918400; if (reportend > time(NULL)) reportend = time(NULL); if (xgetenv("BBREPWARN")) reportwarnlevel = atof(xgetenv("BBREPWARN")); if (xgetenv("BBREPGREEN")) reportgreenlevel = atof(xgetenv("BBREPGREEN")); if ((reportwarnlevel < 0.0) || (reportwarnlevel > 100.0)) reportwarnlevel = 97.0; if ((reportgreenlevel < 0.0) || (reportgreenlevel > 100.0)) reportgreenlevel = 99.995; select_headers_and_footers("bbrep"); sethostenv_report(reportstart, reportend, reportwarnlevel, reportgreenlevel); } else if (argnmatch(argv[i], "--csv=")) { char *lp = strchr(argv[i], '='); csvfile = strdup(lp+1); } else if (argnmatch(argv[i], "--csvdelim=")) { char *lp = strchr(argv[i], '='); csvdelim = *(lp+1); } else if (argnmatch(argv[i], "--snapshot=")) { char *lp = strchr(argv[i], '='); snapshot = atol(lp+1); select_headers_and_footers("bbsnap"); sethostenv_snapshot(snapshot); } else if (strcmp(argv[i], "--pages-first") == 0) { hostsbeforepages = 0; } else if (strcmp(argv[i], "--pages-last") == 0) { hostsbeforepages = 1; } else if (argnmatch(argv[i], "--subpagecolumns=")) { char *lp = strchr(argv[i], '='); subpagecolumns = atoi(lp+1); if (subpagecolumns < 1) subpagecolumns=1; } else if (argnmatch(argv[i], "--maxrows=")) { char *lp = strchr(argv[i], '='); maxrowsbeforeheading = atoi(lp+1); if (maxrowsbeforeheading < 0) maxrowsbeforeheading=0; } else if (strcmp(argv[i], "--recentgifs") == 0) { use_recentgifs = 1; } else if (argnmatch(argv[i], "--recentgifs=")) { char *lp = strchr(argv[i], '='); use_recentgifs = 1; recentgif_limit = 60*durationvalue(lp+1); } else if (strcmp(argv[i], "--sort-group-only-items") == 0) { sort_grouponly_items = 1; } else if (argnmatch(argv[i], "--page-title=")) { char *lp = strchr(argv[i], '='); defaultpagetitle = strdup(lp+1); } else if (argnmatch(argv[i], "--dialupskin=")) { char *lp = strchr(argv[i], '='); dialupskin = strdup(lp+1); } else if (argnmatch(argv[i], "--reverseskin=")) { char *lp = strchr(argv[i], '='); reverseskin = strdup(lp+1); } else if (strcmp(argv[i], "--pagetitle-links") == 0) { pagetitlelinks = 1; } else if (strcmp(argv[i], "--pagetext-headings") == 0) { pagetextheadings = 1; } else if (strcmp(argv[i], "--underline-headings") == 0) { underlineheadings = 1; } else if (strcmp(argv[i], "--no-underline-headings") == 0) { underlineheadings = 0; } else if (strcmp(argv[i], "--no-eventlog") == 0) { bb2eventlog = 0; } else if (argnmatch(argv[i], "--max-eventcount=")) { char *lp = strchr(argv[i], '='); bb2eventlogmaxcount = atoi(lp+1); } else if (argnmatch(argv[i], "--max-eventtime=")) { char *lp = strchr(argv[i], '='); bb2eventlogmaxtime = atoi(lp+1); } else if (argnmatch(argv[i], "--max-ackcount=")) { char *lp = strchr(argv[i], '='); bb2acklogmaxcount = atoi(lp+1); } else if (argnmatch(argv[i], "--max-acktime=")) { char *lp = strchr(argv[i], '='); bb2acklogmaxtime = atoi(lp+1); } else if (strcmp(argv[i], "--no-acklog") == 0) { bb2acklog = 0; } else if (strcmp(argv[i], "--no-pages") == 0) { do_normal_pages = 0; } else if (argnmatch(argv[i], "--noprop=")) { char *lp = strchr(argv[i], '='); nopropyellowdefault = (char *) malloc(strlen(lp)+2); sprintf(nopropyellowdefault, ",%s,", (lp+1)); errprintf("--noprop is deprecated - use --nopropyellow instead\n"); } else if (argnmatch(argv[i], "--nopropyellow=")) { char *lp = strchr(argv[i], '='); nopropyellowdefault = (char *) malloc(strlen(lp)+2); sprintf(nopropyellowdefault, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--nopropred=")) { char *lp = strchr(argv[i], '='); nopropreddefault = (char *) malloc(strlen(lp)+2); sprintf(nopropreddefault, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--noproppurple=")) { char *lp = strchr(argv[i], '='); noproppurpledefault = (char *) malloc(strlen(lp)+2); sprintf(noproppurpledefault, ",%s,", (lp+1)); } else if (argnmatch(argv[i], "--nopropack=")) { char *lp = strchr(argv[i], '='); nopropackdefault = (char *) malloc(strlen(lp)+2); sprintf(nopropackdefault, ",%s,", (lp+1)); } else if (strcmp(argv[i], "--bbpageONLY") == 0) { /* Deprecated */ errprintf("--bbpageONLY is deprecated - use --pageset=NAME to generate pagesets\n"); } else if (strcmp(argv[i], "--embedded") == 0) { embedded = 1; } else if (argnmatch(argv[i], "--pageset=")) { char *lp = strchr(argv[i], '='); pageset = strdup(lp+1); } else if (argnmatch(argv[i], "--template=")) { char *lp = strchr(argv[i], '='); lp++; select_headers_and_footers(lp); } else if (argnmatch(argv[i], "--purplelog=")) { char *lp = strchr(argv[i], '='); if (*(lp+1) == '/') purplelogfn = strdup(lp+1); else { purplelogfn = (char *) malloc(strlen(xgetenv("BBHOME"))+1+strlen(lp+1)+1); sprintf(purplelogfn, "%s/%s", xgetenv("BBHOME"), (lp+1)); } } else if (argnmatch(argv[i], "--report=") || (strcmp(argv[i], "--report") == 0)) { char *lp = strchr(argv[i], '='); if (lp) { egocolumn = strdup(lp+1); } else egocolumn = "bbgen"; timing = 1; } else if (argnmatch(argv[i], "--nklog=") || (strcmp(argv[i], "--nklog") == 0)) { char *lp = strchr(argv[i], '='); if (lp) { lognkstatus = strdup(lp+1); } else lognkstatus = "nk"; } else if (strcmp(argv[i], "--timing") == 0) { timing = 1; } else if (strcmp(argv[i], "--debug") == 0) { debug = 1; } else if (strcmp(argv[i], "--no-update") == 0) { dontsendmessages = 1; } else if (strcmp(argv[i], "--version") == 0) { printf("bbgen version %s\n", VERSION); printf("\n"); exit(0); } else if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-?") == 0)) { printf("bbgen for Hobbit version %s\n\n", VERSION); printf("Usage: %s [options] [WebpageDirectory]\n", argv[0]); printf("Options:\n"); printf(" --ignorecolumns=test[,test] : Completely ignore these columns\n"); printf(" --nk-reds-only : Only show red statuses on the NK page\n"); printf(" --bb2-ignorecolumns=test[,test]: Ignore these columns for the BB2 page\n"); printf(" --bb2-ignorepurples : Ignore all-purple hosts on BB2 page\n"); printf(" --includecolumns=test[,test]: Always include these columns on BB2 page\n"); printf(" --max-eventcount=N : Max number of events to include in eventlog\n"); printf(" --max-eventtime=N : Show events that occurred within the last N minutes\n"); printf(" --eventignore=test[,test] : Columns to ignore in bb2 event-log display\n"); printf(" --no-eventlog : Do not generate the bb2 eventlog display\n"); printf(" --no-acklog : Do not generate the bb2 ack-log display\n"); printf(" --no-pages : Generate only the bb2 and bbnk pages\n"); printf(" --docurl=documentation-URL : Hostnames link to a general (dynamic) web page for docs\n"); printf(" --no-doc-window : Open doc-links in same window\n"); printf(" --htmlextension=.EXT : Sets filename extension for generated file (default: .html\n"); printf(" --report[=COLUMNNAME] : Send a status report about the running of bbgen\n"); printf(" --reportopts=ST:END:DYN:STL : Run in Hobbit Reporting mode\n"); printf(" --csv=FILENAME : For Hobbit Reporting, output CSV file\n"); printf(" --csvdelim=CHARACTER : Delimiter in CSV file output (default: comma)\n"); printf(" --snapshot=TIME : Snapshot mode\n"); printf("\nPage layout options:\n"); printf(" --pages-first : Put page- and subpage-links before hosts (default)\n"); printf(" --pages-last : Put page- and subpage-links after hosts\n"); printf(" --subpagecolumns=N : Number of columns for links to pages and subpages\n"); printf(" --maxrows=N : Repeat column headings for every N hosts shown\n"); printf(" --recentgifs : Use xxx-recent.gif icons for newly changed tests\n"); printf(" --sort-group-only-items : Display group-only items in alphabetical order\n"); printf(" --page-title=TITLE : Set a default page title for all pages\n"); printf(" --dialupskin=URL : Use a different icon skin for dialup tests\n"); printf(" --reverseskin=URL : Use a different icon skin for reverse tests\n"); printf(" --pagetitle-links : Make page- and subpage-titles act as links\n"); printf(" --pagetext-headings : Use page texts as headings\n"); printf(" --no-underline-headings : Do not underline the page headings\n"); printf("\nStatus propagation control options:\n"); printf(" --noprop=test[,test] : Disable upwards status propagation when YELLOW\n"); printf(" --nopropred=test[,test] : Disable upwards status propagation when RED or YELLOW\n"); printf(" --noproppurple=test[,test] : Disable upwards status propagation when PURPLE\n"); printf("\nAlternate pageset generation support:\n"); printf(" --pageset=SETNAME : Generate non-standard pageset with tag SETNAME\n"); printf(" --template=TEMPLATE : template for header and footer files\n"); printf("\nAlternate output formats:\n"); printf(" --wml[=test1,test2,...] : Generate a small (bb2-style) WML page\n"); printf(" --nstab=FILENAME : Generate a Netscape Sidebar feed\n"); printf(" --nslimit=COLOR : Minimum color to include on Netscape sidebar\n"); printf(" --rss : Generate a RSS/RDF feed of alerts\n"); printf(" --rssextension=.EXT : Sets filename extension for RSS files (default: .rss\n"); printf(" --rssversion={0.91|0.92|1.0|2.0} : Specify RSS/RDF version (default: 0.91)\n"); printf(" --rsslimit=COLOR : Minimum color to include on RSS feed\n"); printf("\nDebugging/troubleshooting options:\n"); printf(" --timing : Collect timing information\n"); printf(" --debug : Debugging information\n"); printf(" --version : Show version information\n"); printf(" --purplelog=FILENAME : Create a log of purple hosts and tests\n"); exit(0); } else if (argnmatch(argv[i], "-")) { errprintf("Unknown option : %s\n", argv[i]); } else { /* Last argument is pagedir */ pagedir = strdup(argv[i]); } } /* In case they changed the name of our column ... */ if (egocolumn) setup_signalhandler(egocolumn); if (debug) { int i; printf("Command: bbgen"); for (i=1; (i<argc); i++) printf(" '%s'", argv[i]); printf("\n"); printf("Environment BBHOSTS='%s'\n", textornull(xgetenv("BBHOSTS"))); printf("\n"); } add_timestamp("Startup"); /* Check that all needed environment vars are defined */ envcheck(reqenv); /* Catch a SEGV fault */ setup_signalhandler("bbgen"); /* Set umask to 0022 so that the generated HTML pages have world-read access */ umask(0022); if (pagedir == NULL) { if (xgetenv("BBWWW")) { pagedir = strdup(xgetenv("BBWWW")); } else { pagedir = (char *) malloc(strlen(xgetenv("BBHOME"))+5); sprintf(pagedir, "%s/www", xgetenv("BBHOME")); } } if (xgetenv("BBHTACCESS")) bbhtaccess = strdup(xgetenv("BBHTACCESS")); if (xgetenv("BBPAGEHTACCESS")) bbpagehtaccess = strdup(xgetenv("BBPAGEHTACCESS")); if (xgetenv("BBSUBPAGEHTACCESS")) bbsubpagehtaccess = strdup(xgetenv("BBSUBPAGEHTACCESS")); /* * When doing alternate pagesets, disable some stuff: * No WML or RSS pages. */ if (pageset || embedded || snapshot) enable_wmlgen = wantrss = 0; if (embedded) { egocolumn = htaccess = NULL; /* * Need to have default SIGPIPE handling when doing embedded stuff. * We are probably run from a CGI script or something similar. */ signal(SIGPIPE, SIG_DFL); } /* Load all data from the various files */ load_all_links(); add_timestamp("Load links done"); pagehead = load_bbhosts(pageset); add_timestamp("Load bbhosts done"); if (!embedded) { /* Remove old acknowledgements */ delete_old_acks(); add_timestamp("ACK removal done"); } statehead = load_state(&dispsums); if (embedded || snapshot) dispsums = NULL; add_timestamp("Load STATE done"); if (hobbitddump) { dump_hobbitdchk(); return 0; } /* Calculate colors of hosts and pages */ calc_hostcolors(bb2ignorecolumns); calc_pagecolors(pagehead); /* Topmost page (background color for bb.html) */ for (p=pagehead; (p); p = p->next) { if (p->color > pagehead->color) pagehead->color = p->color; } bb_color = pagehead->color; if (xgetenv("SUMMARY_SET_BKG") && (strcmp(xgetenv("SUMMARY_SET_BKG"), "TRUE") == 0)) { /* * Displayed summaries affect the BB page only, * but should not go into the color we report to * others. */ for (s=dispsums; (s); s = s->next) { if (s->color > pagehead->color) pagehead->color = s->color; } } add_timestamp("Color calculation done"); if (debug) dumpall(pagehead); /* Generate pages */ if (chdir(pagedir) != 0) { errprintf("Cannot change to webpage directory %s\n", pagedir); exit(1); } if (embedded) { /* Just generate that one page */ do_one_page(pagehead, NULL, 1); return 0; } /* The main page - bb.html and pages/subpages thereunder */ add_timestamp("Hobbit pagegen start"); if (reportstart && csvfile) { csv_availability(csvfile, csvdelim); } else if (do_normal_pages) { do_page_with_subs(pagehead, dispsums); } add_timestamp("Hobbit pagegen done"); if (reportstart) { /* Reports end here */ return 0; } /* The full summary page - bb2.html */ bb2_color = do_bb2_page(nssidebarfilename, PAGE_BB2); add_timestamp("BB2 generation done"); /* Reduced summary (alerts) page - bbnk.html */ bbnk_color = do_bb2_page(NULL, PAGE_NK); add_timestamp("BBNK generation done"); if (snapshot) { /* Snapshots end here */ return 0; } /* Send summary notices - only once, so not on pagesets */ if (pageset == NULL) { send_summaries(sumhead); add_timestamp("Summary transmission done"); } /* Generate WML cards */ if (enable_wmlgen) { do_wml_cards(pagedir); add_timestamp("WML generation done"); } /* Need to do this before sending in our report */ add_timestamp("Run completed"); /* Tell about us */ if (egocolumn) { char msgline[4096]; char *timestamps; long bbsleep = (xgetenv("BBSLEEP") ? atol(xgetenv("BBSLEEP")) : 300); int color; /* Go yellow if it runs for too long */ if (total_runtime() > bbsleep) { errprintf("WARNING: Runtime %ld longer than BBSLEEP (%ld)\n", total_runtime(), bbsleep); } color = (errbuf ? COL_YELLOW : COL_GREEN); combo_start(); init_status(color); sprintf(msgline, "status %s.%s %s %s\n\n", xgetenv("MACHINE"), egocolumn, colorname(color), timestamp); addtostatus(msgline); sprintf(msgline, "bbgen for Hobbit version %s\n", VERSION); addtostatus(msgline); sprintf(msgline, "\nStatistics:\n Hosts : %5d\n Status messages : %5d\n Purple messages : %5d\n Pages : %5d\n", hostcount, statuscount, purplecount, pagecount); addtostatus(msgline); if (errbuf) { addtostatus("\n\nError output:\n"); addtostatus(errbuf); } show_timestamps(×tamps); addtostatus(timestamps); finish_status(); combo_end(); } else show_timestamps(NULL); return 0; }
int main(int argc, char *argv[]) { void *hwalk; int argi; strbuffer_t *statusmsg, *jrockout, *qout; for (argi = 1; (argi < argc); argi++) { if ((strcmp(argv[argi], "--help") == 0)) { printf("beastat version %s\n\n", VERSION); printf("Usage:\n%s [--debug] [--no-update] [--port=SNMPPORT] [--community=SNMPCOMMUNITY]\n", argv[0]); exit(0); } else if ((strcmp(argv[argi], "--version") == 0)) { printf("beastat version %s\n", VERSION); exit(0); } else if ((strcmp(argv[argi], "--debug") == 0)) { debug = 1; } else if ((strcmp(argv[argi], "--no-update") == 0)) { dontsendmessages = 1; } else if (argnmatch(argv[argi], "--timeout=")) { char *p = strchr(argv[argi], '='); extcmdtimeout = atoi(p+1); } else if (argnmatch(argv[argi], "--port=")) { char *p = strchr(argv[argi], '='); default_port = atoi(p+1); } else if (argnmatch(argv[argi], "--community=")) { char *p = strchr(argv[argi], '='); default_community = strdup(p+1); } } load_hostnames(xgetenv("BBHOSTS"), "netinclude", get_fqdn()); if (first_host() == NULL) { errprintf("Cannot load bb-hosts\n"); return 1; } if (xgetenv("BBLOCATION")) location = strdup(xgetenv("BBLOCATION")); init_timestamp(); combo_start(); statusmsg = newstrbuffer(0); jrockout = newstrbuffer(0); qout = newstrbuffer(0); for (hwalk = first_host(); (hwalk); hwalk = next_host(hwalk, 0)) { char *tspec = bbh_custom_item(hwalk, "bea="); char *snmpcommunity = default_community; char *beadomain = ""; int snmpport = default_port; char *p; char pipecmd[4096]; int jrockres, qres; clearstrbuffer(statusmsg); clearstrbuffer(jrockout); clearstrbuffer(qout); /* Check if we have a "bea" test for this host, and it is a host we want to test */ if (!tspec || !wanted_host(hwalk, location)) continue; /* Parse the testspec: bea=[SNMPCOMMUNITY@]BEADOMAIN[:SNMPPORT] */ tspec = strdup(tspec+strlen("bea=")); p = strchr(tspec, ':'); if (p) { *p = '\0'; snmpport = atoi(p+1); } p = strchr(tspec, '@'); if (p) { *p = '\0'; snmpcommunity = strdup(tspec); beadomain = strdup(p+1); } else { beadomain = strdup(tspec); } /* Prepare for the host status */ statuscolor = COL_GREEN; /* Setup the snmpwalk pipe-command for jrockit stats */ sprintf(pipecmd, "snmpwalk -m BEA-WEBLOGIC-MIB -c %s@%s -v 1 %s:%d enterprises.140.625.302.1", snmpcommunity, beadomain, bbh_item(hwalk, BBH_IP), snmpport); jrockres = run_command(pipecmd, NULL, jrockout, 0, extcmdtimeout); if (jrockres == 0) { find_idxes(STRBUF(jrockout), "BEA-WEBLOGIC-MIB::jrockitRuntimeIndex."); send_data(hwalk, beadomain, STRBUF(jrockout), jrockitems); } else { if (statuscolor < COL_YELLOW) statuscolor = COL_YELLOW; sprintf(msgline, "Could not retrieve BEA jRockit statistics from %s:%d domain %s (code %d)\n", bbh_item(hwalk, BBH_IP), snmpport, beadomain, jrockres); addtobuffer(statusmsg, msgline); } /* Setup the snmpwalk pipe-command for executeQueur stats */ sprintf(pipecmd, "snmpwalk -m BEA-WEBLOGIC-MIB -c %s@%s -v 1 %s:%d enterprises.140.625.180.1", snmpcommunity, beadomain, bbh_item(hwalk, BBH_IP), snmpport); qres = run_command(pipecmd, NULL, qout, 0, extcmdtimeout); if (qres == 0) { find_idxes(STRBUF(qout), "BEA-WEBLOGIC-MIB::executeQueueRuntimeIndex."); send_data(hwalk, beadomain, STRBUF(qout), qitems); } else { if (statuscolor < COL_YELLOW) statuscolor = COL_YELLOW; sprintf(msgline, "Could not retrieve BEA executeQueue statistics from %s:%d domain %s (code %d)\n", bbh_item(hwalk, BBH_IP), snmpport, beadomain, qres); addtobuffer(statusmsg, msgline); } /* FUTURE: Have the statuscolor/statusmsg be updated to check against thresholds */ /* Right now, the "bea" status is always green */ init_status(statuscolor); sprintf(msgline, "status %s.%s %s %s\n\n", commafy(bbh_item(hwalk, BBH_HOSTNAME)), "bea", colorname(statuscolor), timestamp); addtostatus(msgline); if (STRBUFLEN(statusmsg) == 0) addtobuffer(statusmsg, "All BEA monitors OK\n"); addtostrstatus(statusmsg); finish_status(); } combo_end(); freestrbuffer(statusmsg); freestrbuffer(jrockout); freestrbuffer(qout); return 0; }
int main(int argc, char *argv[]) { char *envarea = NULL; char *server = NULL; char *cookie, *pagefilter = ""; char *filter = NULL; char *heading = NULL; int showcolors = 1; int showcolumn = 0; int addlink = 0; int allhosts = 0; int summary = 0; int embedded = 0; char *req, *board, *l; int argi, res; sendreturn_t *sres; init_timestamp(); for (argi=1; (argi < argc); argi++) { if (argnmatch(argv[argi], "--env=")) { char *p = strchr(argv[argi], '='); loadenv(p+1, envarea); } else if (argnmatch(argv[argi], "--area=")) { char *p = strchr(argv[argi], '='); envarea = strdup(p+1); } else if (strcmp(argv[argi], "--debug") == 0) { debug = 1; } else if ( argnmatch(argv[argi], "--column=") || argnmatch(argv[argi], "--test=")) { char *p = strchr(argv[argi], '='); int needed; needed = 10 + strlen(p); if (filter) needed += strlen(filter); filter = (char *)(filter ? realloc(filter, needed) : calloc(1, needed)); sprintf(filter + strlen(filter), " test=%s", p+1); if (!heading) { heading = (char *)malloc(1024 + strlen(p) + strlen(timestamp)); sprintf(heading, "%s report on %s", p+1, timestamp); } } else if (argnmatch(argv[argi], "--filter=")) { char *p = strchr(argv[argi], '='); int needed; needed = 10 + strlen(p); if (filter) needed += strlen(filter); filter = (char *)(filter ? realloc(filter, needed) : calloc(1, needed)); sprintf(filter + strlen(filter), " %s", p+1); } else if (argnmatch(argv[argi], "--heading=")) { char *p = strchr(argv[argi], '='); heading = strdup(p+1); } else if (strcmp(argv[argi], "--show-column") == 0) { showcolumn = 1; } else if (strcmp(argv[argi], "--show-test") == 0) { showcolumn = 1; } else if (strcmp(argv[argi], "--show-colors") == 0) { showcolors = 1; } else if (strcmp(argv[argi], "--show-summary") == 0) { summary = 1; } else if (strcmp(argv[argi], "--show-message") == 0) { summary = 0; } else if (strcmp(argv[argi], "--link") == 0) { addlink = 1; } else if (strcmp(argv[argi], "--no-colors") == 0) { showcolors = 0; } else if (strcmp(argv[argi], "--all") == 0) { allhosts = 1; } else if (strcmp(argv[argi], "--embedded") == 0) { embedded = 1; } } if (!allhosts) { /* Setup the filter we use for the report */ cookie = get_cookie("pagepath"); if (cookie && *cookie) { pcre *dummy; char *re = (char *)malloc(8 + 2*strlen(cookie)); sprintf(re, "^%s$|^%s/.+", cookie, cookie); dummy = compileregex(re); if (dummy) { freeregex(dummy); pagefilter = malloc(10 + strlen(re)); sprintf(pagefilter, "page=%s", re); } } } sres = newsendreturnbuf(1, NULL); req = malloc(1024 + strlen(pagefilter) + strlen(filter)); sprintf(req, "xymondboard fields=hostname,testname,color,msg %s %s", pagefilter, filter); res = sendmessage(req, server, XYMON_TIMEOUT, sres); board = getsendreturnstr(sres, 1); freesendreturnbuf(sres); if (res != XYMONSEND_OK) return 1; if (!embedded) { printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE")); printf("<html><head><title>%s</title></head>\n", htmlquoted(heading)); printf("<body>"); printf("<table border=1 cellpadding=5><tr><th>%s</th><th align=left>Status</th></tr>\n", (showcolumn ? "Host/Column" : "Host")); } l = board; while (l && *l) { char *hostname, *testname = NULL, *colorstr = NULL, *msg = NULL, *p; char *eoln = strchr(l, '\n'); if (eoln) *eoln = '\0'; hostname = l; p = strchr(l, '|'); if (p) { *p = '\0'; l = testname = p+1; } p = strchr(l, '|'); if (p) { *p = '\0'; l = colorstr = p+1; } p = strchr(l, '|'); if (p) { *p = '\0'; l = msg = p+1; } if (hostname && testname && colorstr && msg) { char *msgeol; nldecode(msg); msgeol = strchr(msg, '\n'); if (msgeol) { /* Skip the first status line */ msg = msgeol + 1; } printf("<tr><td align=left valign=top><b>"); if (addlink) printf("<a href=\"%s\">%s</a>", hostsvcurl(hostname, xgetenv("INFOCOLUMN"), 1), htmlquoted(hostname)); else printf("%s", htmlquoted(hostname)); if (showcolumn) { printf("<br>"); if (addlink) printf("<a href=\"%s\">%s</a>", hostsvcurl(hostname, testname, 1), htmlquoted(testname)); else printf("%s", htmlquoted(testname)); } if (showcolors) printf(" - %s", colorstr); printf("</b></td>\n"); printf("<td><pre>\n"); if (summary) { int firstline = 1; char *bol, *eol; bol = msg; while (bol) { eol = strchr(bol, '\n'); if (eol) *eol = '\0'; if (firstline) { if (!isspace((int)*bol)) { printf("%s\n", bol); firstline = 0; } } else if ((*bol == '&') && (strncmp(bol, "&green", 6) != 0)) { printf("%s\n", bol); } bol = (eol ? eol+1 : NULL); } } else { printf("%s", msg); } printf("</pre></td></tr>\n"); } if (eoln) l = eoln+1; else l = NULL; } if (!embedded) printf("</table></body></html>\n"); return 0; }
int update_combotests(int showeval, int cleanexpr) { testspec_t *t; int pending; int remaining = 0; init_timestamp(); loadtests(); /* * Loop over the tests to allow us "forward refs" in expressions. * We continue for as long as progress is being made. */ remaining = testcount; do { pending = remaining; for (t=testhead; (t); t = t->next) { if (t->result == -1) { t->result = evaluate(t->expression, &t->resultexpr, &t->valuelist, &t->errbuf); if (t->result != -1) remaining--; } } } while (pending != remaining); combo_start(); for (t=testhead; (t); t = t->next) { char msgline[MAX_LINE_LEN]; int color; value_t *vwalk; color = (t->result ? COL_GREEN : COL_RED); init_status(color); sprintf(msgline, "status %s.%s %s %s\n\n", commafy(t->reshostname), ( t->restestname ? t->restestname : "combostatuserror" ), colorname(color), timestamp); addtostatus(msgline); if (t->comment) { addtostatus(t->comment); addtostatus("\n\n"); } if (showeval) { addtostatus(printify(t->expression, cleanexpr)); addtostatus(" = "); addtostatus(printify(t->resultexpr, cleanexpr)); addtostatus(" = "); sprintf(msgline, "%ld\n", t->result); addtostatus(msgline); for (vwalk = t->valuelist; (vwalk); vwalk = vwalk->next) { sprintf(msgline, "&%s <a href=\"%s/svcstatus.sh?HOST=%s&SERVICE=%s\">%s</a>\n", colorname(vwalk->color), xgetenv("CGIBINURL"), textornull(gethname(vwalk->symbol)), textornull(gettname(vwalk->symbol)), textornull(vwalk->symbol)); addtostatus(msgline); } if (t->errbuf) { addtostatus("\nErrors occurred during evaluation:\n"); addtostatus(t->errbuf); } } finish_status(); } combo_end(); return 0; }
void send_alert(activealerts_t *alert, FILE *logfd) { recip_t *recip; int first = 1; int alertcount = 0; time_t now = getcurrenttime(NULL); /* A_PAGING, A_NORECIP, A_ACKED, A_RECOVERED, A_DISABLED, A_NOTIFY, A_DEAD */ char *alerttxt[A_DEAD+1] = { "Paging", "Norecip", "Acked", "Recovered", "Disabled", "Notify", "Dead" }; dbgprintf("send_alert %s:%s state %d\n", alert->hostname, alert->testname, (int)alert->state); traceprintf("send_alert %s:%s state %s\n", alert->hostname, alert->testname, alerttxt[alert->state]); stoprulefound = 0; while (!stoprulefound && ((recip = next_recipient(alert, &first, NULL, NULL)) != NULL)) { /* If this is an "UNMATCHED" rule, ignore it if we have already sent out some alert */ if (recip->unmatchedonly && (alertcount != 0)) { traceprintf("Recipient '%s' dropped, not unmatched (count=%d)\n", recip->recipient, alertcount); continue; } if (recip->noalerts && ((alert->state == A_PAGING) || (alert->state == A_RECOVERED) || (alert->state == A_DISABLED))) { traceprintf("Recipient '%s' dropped (NOALERT)\n", recip->recipient); continue; } if (recip->method == M_IGNORE) { traceprintf("IGNORE rule found\n"); continue; } if (alert->state == A_PAGING) { repeat_t *rpt = NULL; /* * This runs in a child-process context, so the record we * might create here is NOT used later on. */ rpt = find_repeatinfo(alert, recip, 1); if (!rpt) continue; /* Happens for e.g. M_IGNORE recipients */ dbgprintf(" repeat %s at %d\n", rpt->recipid, rpt->nextalert); if (rpt->nextalert > now) { traceprintf("Recipient '%s' dropped, next alert due at %ld > %ld\n", rpt->recipid, (long)rpt->nextalert, (long)now); continue; } alertcount++; } else if ((alert->state == A_RECOVERED) || (alert->state == A_DISABLED)) { /* RECOVERED messages require that we've sent out an alert before */ repeat_t *rpt = NULL; rpt = find_repeatinfo(alert, recip, 0); if (!rpt) continue; alertcount++; } dbgprintf(" Alert for %s:%s to %s\n", alert->hostname, alert->testname, recip->recipient); switch (recip->method) { case M_IGNORE: break; case M_MAIL: { char cmd[32768]; char *mailsubj; char *mailrecip; FILE *mailpipe; MEMDEFINE(cmd); mailsubj = message_subject(alert, recip); mailrecip = message_recipient(recip->recipient, alert->hostname, alert->testname, colorname(alert->color)); if (mailsubj) { if (xgetenv("MAIL")) sprintf(cmd, "%s \"%s\" ", xgetenv("MAIL"), mailsubj); else if (xgetenv("MAILC")) sprintf(cmd, "%s -s \"%s\" ", xgetenv("MAILC"), mailsubj); else sprintf(cmd, "mail -s \"%s\" ", mailsubj); } else { if (xgetenv("MAILC")) sprintf(cmd, "%s ", xgetenv("MAILC")); else sprintf(cmd, "mail "); } strcat(cmd, mailrecip); traceprintf("Mail alert with command '%s'\n", cmd); if (testonly) { MEMUNDEFINE(cmd); break; } mailpipe = popen(cmd, "w"); if (mailpipe) { fprintf(mailpipe, "%s", message_text(alert, recip)); pclose(mailpipe); if (logfd) { init_timestamp(); fprintf(logfd, "%s %s.%s (%s) %s[%d] %ld %d", timestamp, alert->hostname, alert->testname, alert->ip, mailrecip, recip->cfid, (long)now, servicecode(alert->testname)); if ((alert->state == A_RECOVERED) || (alert->state == A_DISABLED)) { fprintf(logfd, " %ld\n", (long)(now - alert->eventstart)); } else { fprintf(logfd, "\n"); } fflush(logfd); } } else { errprintf("ERROR: Cannot open command pipe for '%s' - alert lost!\n", cmd); traceprintf("Mail pipe failed - alert lost\n"); } MEMUNDEFINE(cmd); } break; case M_SCRIPT: { pid_t scriptpid; char *scriptrecip; traceprintf("Script alert with command '%s' and recipient %s\n", recip->scriptname, recip->recipient); if (testonly) break; scriptrecip = message_recipient(recip->recipient, alert->hostname, alert->testname, colorname(alert->color)); scriptpid = fork(); if (scriptpid == 0) { /* Setup all of the environment for a paging script */ void *hinfo; char *p; int ip1=0, ip2=0, ip3=0, ip4=0; char *bbalphamsg, *ackcode, *rcpt, *bbhostname, *bbhostsvc, *bbhostsvccommas, *bbnumeric, *machip, *bbsvcname, *bbsvcnum, *bbcolorlevel, *recovered, *downsecs, *eventtstamp, *downsecsmsg, *cfidtxt; char *alertid, *alertidenv; int msglen; cfidtxt = (char *)malloc(strlen("CFID=") + 10); sprintf(cfidtxt, "CFID=%d", recip->cfid); putenv(cfidtxt); p = message_text(alert, recip); msglen = strlen(p); if (msglen > MAX_ALERTMSG_SCRIPTS) { dbgprintf("Cropping large alert message from %d to %d bytes\n", msglen, MAX_ALERTMSG_SCRIPTS); msglen = MAX_ALERTMSG_SCRIPTS; } msglen += strlen("BBALPHAMSG="); bbalphamsg = (char *)malloc(msglen + 1); snprintf(bbalphamsg, msglen+1, "BBALPHAMSG=%s", p); putenv(bbalphamsg); ackcode = (char *)malloc(strlen("ACKCODE=") + 10); sprintf(ackcode, "ACKCODE=%d", alert->cookie); putenv(ackcode); rcpt = (char *)malloc(strlen("RCPT=") + strlen(scriptrecip) + 1); sprintf(rcpt, "RCPT=%s", scriptrecip); putenv(rcpt); bbhostname = (char *)malloc(strlen("BBHOSTNAME=") + strlen(alert->hostname) + 1); sprintf(bbhostname, "BBHOSTNAME=%s", alert->hostname); putenv(bbhostname); bbhostsvc = (char *)malloc(strlen("BBHOSTSVC=") + strlen(alert->hostname) + 1 + strlen(alert->testname) + 1); sprintf(bbhostsvc, "BBHOSTSVC=%s.%s", alert->hostname, alert->testname); putenv(bbhostsvc); bbhostsvccommas = (char *)malloc(strlen("BBHOSTSVCCOMMAS=") + strlen(alert->hostname) + 1 + strlen(alert->testname) + 1); sprintf(bbhostsvccommas, "BBHOSTSVCCOMMAS=%s.%s", commafy(alert->hostname), alert->testname); putenv(bbhostsvccommas); bbnumeric = (char *)malloc(strlen("BBNUMERIC=") + 22 + 1); p = bbnumeric; p += sprintf(p, "BBNUMERIC="); p += sprintf(p, "%03d", servicecode(alert->testname)); sscanf(alert->ip, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4); p += sprintf(p, "%03d%03d%03d%03d", ip1, ip2, ip3, ip4); p += sprintf(p, "%d", alert->cookie); putenv(bbnumeric); machip = (char *)malloc(strlen("MACHIP=") + 13); sprintf(machip, "MACHIP=%03d%03d%03d%03d", ip1, ip2, ip3, ip4); putenv(machip); bbsvcname = (char *)malloc(strlen("BBSVCNAME=") + strlen(alert->testname) + 1); sprintf(bbsvcname, "BBSVCNAME=%s", alert->testname); putenv(bbsvcname); bbsvcnum = (char *)malloc(strlen("BBSVCNUM=") + 10); sprintf(bbsvcnum, "BBSVCNUM=%d", servicecode(alert->testname)); putenv(bbsvcnum); bbcolorlevel = (char *)malloc(strlen("BBCOLORLEVEL=") + strlen(colorname(alert->color)) + 1); sprintf(bbcolorlevel, "BBCOLORLEVEL=%s", colorname(alert->color)); putenv(bbcolorlevel); recovered = (char *)malloc(strlen("RECOVERED=") + 2); switch (alert->state) { case A_RECOVERED: strcpy(recovered, "RECOVERED=1"); break; case A_DISABLED: strcpy(recovered, "RECOVERED=2"); break; default: strcpy(recovered, "RECOVERED=0"); break; } putenv(recovered); downsecs = (char *)malloc(strlen("DOWNSECS=") + 20); sprintf(downsecs, "DOWNSECS=%ld", (long)(getcurrenttime(NULL) - alert->eventstart)); putenv(downsecs); eventtstamp = (char *)malloc(strlen("EVENTSTART=") + 20); sprintf(eventtstamp, "EVENTSTART=%ld", (long)alert->eventstart); putenv(eventtstamp); if ((alert->state == A_RECOVERED) || (alert->state == A_DISABLED)) { downsecsmsg = (char *)malloc(strlen("DOWNSECSMSG=Event duration :") + 20); sprintf(downsecsmsg, "DOWNSECSMSG=Event duration : %ld", (long)(getcurrenttime(NULL) - alert->eventstart)); } else { downsecsmsg = strdup("DOWNSECSMSG="); } putenv(downsecsmsg); alertid = make_alertid(alert->hostname, alert->testname, alert->eventstart); alertidenv = (char *)malloc(strlen("ALERTID=") + strlen(alertid) + 10); sprintf(alertidenv, "ALERTID=%s", alertid); putenv(alertidenv); hinfo = hostinfo(alert->hostname); if (hinfo) { enum xmh_item_t walk; char *itm, *id, *bbhenv; for (walk = 0; (walk < XMH_LAST); walk++) { itm = xmh_item(hinfo, walk); id = xmh_item_id(walk); if (itm && id) { bbhenv = (char *)malloc(strlen(id) + strlen(itm) + 2); sprintf(bbhenv, "%s=%s", id, itm); putenv(bbhenv); } } } /* The child starts the script */ execlp(recip->scriptname, recip->scriptname, NULL); errprintf("Could not launch paging script %s: %s\n", recip->scriptname, strerror(errno)); exit(0); } else if (scriptpid > 0) { /* Parent waits for child to complete */ int childstat; wait(&childstat); if (WIFEXITED(childstat) && (WEXITSTATUS(childstat) != 0)) { errprintf("Paging script %s terminated with status %d\n", recip->scriptname, WEXITSTATUS(childstat)); } else if (WIFSIGNALED(childstat)) { errprintf("Paging script %s terminated by signal %d\n", recip->scriptname, WTERMSIG(childstat)); } if (logfd) { init_timestamp(); fprintf(logfd, "%s %s.%s (%s) %s %ld %d", timestamp, alert->hostname, alert->testname, alert->ip, scriptrecip, (long)now, servicecode(alert->testname)); if ((alert->state == A_RECOVERED) || (alert->state == A_DISABLED)) { fprintf(logfd, " %ld\n", (long)(now - alert->eventstart)); } else { fprintf(logfd, "\n"); } fflush(logfd); } } else { errprintf("ERROR: Fork failed to launch script '%s' - alert lost\n", recip->scriptname); traceprintf("Script fork failed - alert lost\n"); } } break; } } }