void zvse_nparts_report(char *hostname, char *clientclass, enum ostype_t os, void *hinfo, char *fromline, char *timestr, char *npartstr) { char npdispstr[256]; long nparts, runparts, partsavail; int npartsyellow, npartsred; float partutil; int npartcolor = COL_GREEN; char msgline[4096]; strbuffer_t *upmsg; if (!npartstr) return; sscanf(npartstr, "%ld %ld", &nparts, &runparts); /* * The nparts message is two values that indicate the maximum number of partitions * configured in the system (based on the NPARTS value in the IPL proc) and * the number of partitions currently running jobs: * The format of the data is: * * nnnnnnn mmmmmmm * */ partsavail = nparts - runparts; partutil = ((float)runparts / (float)nparts) * 100; get_asid_thresholds(hinfo, clientclass, &npartsyellow, &npartsred); upmsg = newstrbuffer(0); if ((int)partutil > npartsred) { if (npartcolor < COL_RED) npartcolor = COL_RED; addtobuffer(upmsg, "&red NPARTS Utilization is CRITICAL\n"); } else if ((int)partutil > npartsyellow) { if (npartcolor < COL_YELLOW) npartcolor = COL_YELLOW; addtobuffer(upmsg, "&yellow NPARTS Utilization is HIGH\n"); } *npdispstr = '\0'; sprintf(npdispstr, "Nparts: %8ld Free: %8ld Used: %8ld %3.1f\n",nparts,partsavail,runparts,partutil); init_status(npartcolor); sprintf(msgline, "status %s.nparts %s %s\n%s", commafy(hostname), colorname(npartcolor), (timestr ? timestr : "<no timestamp data>"), npdispstr); addtostatus(msgline); if (STRBUFLEN(upmsg)) { addtostrstatus(upmsg); addtostatus("\n"); } if (fromline && !localmode) addtostatus(fromline); finish_status(); freestrbuffer(upmsg); }
void zos_maxuser_report(char *hostname, char *clientclass, enum ostype_t os, void *hinfo, char *fromline, char *timestr, char *maxuserstr) { char *p; char maxustr[256]; long maxusers, maxufree, maxuused, rsvtstrt, rsvtfree, rsvtused, rsvnonr, rsvnfree, rsvnused; int maxyellow, maxred; float maxutil, rsvtutil, rsvnutil; int maxcolor = COL_GREEN; char msgline[4096]; strbuffer_t *upmsg; if (!maxuserstr) return; /* * Looking for eyecatchers in message */ p = strstr(maxuserstr, "Maxusers: ") + 9; if (p) { sscanf(p, "%ld Free: %ld", &maxusers, &maxufree); } p = strstr(maxuserstr, "RSVTSTRT: ") + 9; if (p) { sscanf(p, "%ld Free: %ld", &rsvtstrt, &rsvtfree); } p = strstr(maxuserstr, "RSVNONR: ") + 8; if (p) { sscanf(p, "%ld Free: %ld", &rsvnonr, &rsvnfree); } maxuused = maxusers - maxufree; rsvtused = rsvtstrt - rsvtfree; rsvnused = rsvnonr - rsvnfree; if ( maxuused == 0.0 ) maxutil = 0; else maxutil = ((float)maxuused / (float)maxusers) * 100; if ( rsvtused == 0.0 ) rsvtutil = 0; else rsvtutil = ((float)rsvtused / (float)rsvtstrt) * 100; if ( rsvnused == 0.0 ) rsvnutil = 0; else rsvnutil = ((float)rsvnused / (float)rsvnonr) * 100; get_asid_thresholds(hinfo, clientclass, &maxyellow, &maxred); upmsg = newstrbuffer(0); if ((int)maxutil > maxred) { if (maxcolor < COL_RED) maxcolor = COL_RED; addtobuffer(upmsg, "&red ASID (Maxuser) Utilization is CRITICAL\n"); } else if ((int)maxutil > maxyellow) { if (maxcolor < COL_YELLOW) maxcolor = COL_YELLOW; addtobuffer(upmsg, "&yellow ASID (Maxuser) Utilization is HIGH\n"); } *maxustr = '\0'; sprintf(maxustr, " Maxuser: %8ld Free: %8ld Used: %8ld %3.1f\nRSVTSTRT: %8ld Free: %8ld Used: %8ld %3.1f\n RSVNONR: %8ld Free: %8ld Used: %8ld %3.1f\n",maxusers,maxufree,maxuused,maxutil,rsvtstrt,rsvtfree,rsvtused,rsvtutil,rsvnonr,rsvnfree,rsvnused,rsvnutil); init_status(maxcolor); sprintf(msgline, "status %s.maxuser %s %s\n%s", commafy(hostname), colorname(maxcolor), (timestr ? timestr : "<no timestamp data>"), maxustr); addtostatus(msgline); if (STRBUFLEN(upmsg)) { addtostrstatus(upmsg); addtostatus("\n"); } if (fromline && !localmode) addtostatus(fromline); finish_status(); freestrbuffer(upmsg); }