void generate_critpage(FILE *output, char *hfprefix) { RbtIterator hhandle; int color = COL_GREEN; int maxprio = 0; /* Determine background color and max. priority */ for (hhandle = rbtBegin(rbstate); (hhandle != rbtEnd(rbstate)); hhandle = rbtNext(rbstate, hhandle)) { void *k1, *k2; hstatus_t *itm; rbtKeyValue(rbstate, hhandle, &k1, &k2); itm = (hstatus_t *)k2; if (itm->color > color) color = itm->color; if (itm->config->priority > maxprio) maxprio = itm->config->priority; } headfoot(output, hfprefix, "", "header", color); fprintf(output, "<center>\n"); if (color != COL_GREEN) { RbtHandle rbcolumns; int prio; rbcolumns = columnlist(rbstate); fprintf(output, "<TABLE BORDER=0 CELLPADDING=4 SUMMARY=\"Critical status display\">\n"); print_colheaders(output, rbcolumns); for (prio = 1; (prio <= maxprio); prio++) { print_oneprio(output, rbstate, rbcolumns, prio); } fprintf(output, "</TABLE>\n"); rbtDelete(rbcolumns); } else { /* "All Monitored Systems OK */ fprintf(output, "%s", xgetenv("XYMONALLOKTEXT")); } fprintf(output, "</center>\n"); headfoot(output, hfprefix, "", "footer", color); }
void generate_critpage(void * statetree, void * hoptree, FILE *output, char *header, char *footer, int color, int maxprio) { xtreePos_t hhandle; headfoot(output, header, "", "header", pagecolor); /* Use PAGE color here, not the part color */ fprintf(output, "<center>\n"); if (color != COL_GREEN) { void * rbcolumns; int prio; rbcolumns = columnlist(statetree); fprintf(output, "<TABLE BORDER=0 CELLPADDING=4 SUMMARY=\"Critical status display\">\n"); print_colheaders(output, rbcolumns); for (prio = 1; (prio <= maxprio); prio++) { print_oneprio(output, statetree, hoptree, rbcolumns, prio); } fprintf(output, "</TABLE>\n"); xtreeDestroy(rbcolumns); } else { /* "All Monitored Systems OK */ fprintf(output, "%s", xgetenv("XYMONALLOKTEXT")); } if (evcount > 0) { /* Include the eventlog */ evhopfilter = hoptree; do_eventlog(output, evcount, maxage/60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, ev_included, NULL, NULL, NULL, XYMON_COUNT_NONE, XYMON_S_NONE, NULL); fprintf(output, "<br><br><br>\n"); } fprintf(output, "</center>\n"); headfoot(output, footer, "", "footer", color); }