/////////////////////////////////////////////////////////////////////////////// // Andrea Castro January 12, 2006 // stores plots and HTML files into $OFFLINE_MON_DIR /////////////////////////////////////////////////////////////////////////////// #include "TSystem.h" #include "TStyle.h" #include "TFile.h" #include "TTree.h" #include "TH1.h" #include "TProfile.h" #include "TLine.h" #include "TCanvas.h" #include "TPaveText.h" #include /* Directory information. */ #include #include #include #include using namespace std; #include "OfflineMon/TProdFarmMonitor.hh" ClassImp(TProdFarmMonitor) ClassImp(TProdFarmMonitor::Data_t) //_____________________________________________________________________________ TProdFarmMonitor::TProdFarmMonitor(const char* Name): TOfflineMonitor(Name) { fData = new TProdFarmMonitor::Data_t(); } //_____________________________________________________________________________ TProdFarmMonitor::~TProdFarmMonitor() { delete fData; } //_____________________________________________________________________________ int TProdFarmMonitor::Init() { #include using std::string; printf(" inside TProdFarmMonitor::Init()\n"); TDatime lastAccess = TDatime(2000,1,1,0,0,0); // initialize in case the ntuple does not exist; char name[100], label[30]; char * dash; int dashPosition1, dashPosition2; string str1, str2, str3, str4; int flag1, flag2, flag3, isRunning; // initialize Config structure TString confFile; fProj.fNumProjects=0; confFile = fHtmlDirectory + "/Projects.dat"; FILE* fInC = fopen(confFile,"r"); while(fscanf(fInC,"%s %d %d %d ",name, &flag1, &flag2, &flag3)!=EOF) { isRunning = flag1 + flag2 + flag3; str1 = name; if(!str1.empty()) { dashPosition1 = str1.find("_",0); dashPosition2 = str1.find("_",dashPosition1+1); str2 = str1.substr(0, dashPosition1+1); str3 = str1.substr(dashPosition2+1, strlen(name)-dashPosition2); str4 = str2 + str3; strcpy(label, str4.data()); fProj.fIsRunning[fProj.fNumProjects] = isRunning; fProj.fProjectName[fProj.fNumProjects] = TString(name); fProj.fProjectLabel[fProj.fNumProjects] = TString(label); fProj.fNumProjects++; } // skip empty lines } // end while fclose(fInC); // initialize Params structure char dummy[100]; TString parsFile; parsFile = fHtmlDirectory + "/Params.dat"; FILE* fInP = fopen(parsFile,"r"); fscanf(fInP,"%s %f", dummy, &fPars.lowFreePct); fscanf(fInP,"%s %f", dummy, &fPars.xLowFreePct); fscanf(fInP,"%s %f", dummy, &fPars.minConc); fscanf(fInP,"%s %d", dummy, &fPars.numHoursAbnConc); fscanf(fInP,"%s %d", dummy, &fPars.numHoursBadConc); fscanf(fInP,"%s %d", dummy, &fPars.numHours0AbnConc); fscanf(fInP,"%s %d", dummy, &fPars.numHours0BadConc); fscanf(fInP,"%s %d", dummy, &fPars.numHours0AbnEncp); fscanf(fInP,"%s %d", dummy, &fPars.numHours0BadEncp); fscanf(fInP,"%s %d", dummy, &fPars.numHours100AbnEncp); fscanf(fInP,"%s %d", dummy, &fPars.numHours100BadEncp); fclose(fInP); fPars.lowFreePct/=100.; fPars.xLowFreePct/=100.; // initialize Status structure fStatus.freeSpace=fStatus.conc=fStatus.encp=fStatus.global=0; for(int ip=0; ip0) { // is running sprintf(projDir,"%sprojects/%s",fInputDirName.Data(), (fProj.fProjectName[ip]).Data()); TString inDir; DIR *dir_p; struct dirent *dir_entry_p; // inDir = fInputDirName + "pools"; inDir = projDir; dir_p = opendir(inDir); // open the directory if (!dir_p){ printf ("opendir() failure; terminating"); return(1); } nFiles=0; while( NULL != (dir_entry_p = readdir(dir_p))) { // loop over all files in the directory sprintf(dummy,"%s/%s", inDir.Data(), dir_entry_p->d_name); len = strlen(dummy) + 1; char* newSpace = new char[len]; // allocate with new strcpy(newSpace, dummy); // copy to new space dot=strchr(dir_entry_p->d_name,':'); if(dot!=NULL) { // only monitoring files dotPosition=dot-dir_entry_p->d_name+1; cyear[0] = dir_entry_p->d_name[dotPosition]; cyear[1] = dir_entry_p->d_name[dotPosition+1]; cyear[2] = dir_entry_p->d_name[dotPosition+2]; cyear[3] = dir_entry_p->d_name[dotPosition+3]; cmonth[0] = dir_entry_p->d_name[dotPosition+5]; cmonth[1] = dir_entry_p->d_name[dotPosition+6]; cday[0] = dir_entry_p->d_name[dotPosition+8]; cday[1] = dir_entry_p->d_name[dotPosition+9]; thisTime = TDatime(atoi(cyear), atoi(cmonth), atoi(cday), 0, 0, 0); if(atoi(cyear)<1995) printf(" WARNING 1 year %d <1995\n", atoi(cyear)); timeDiff = now.Convert() - thisTime.Convert(); timeDiff/=60.; if(timeDiff < (TMAX_WEEK+TMAX_DAY)) { // then include as new files inFile[ip][nFiles] = newSpace; // save pointer nFiles++; nTotFiles ++; } } // end if files fProj.fNfiles[ip] = nFiles; } closedir(dir_p); // close the directory fProj.fLastFileTime[ip] = thisTime; } // if still running } // end of loop over projects TFile* ntupleOut; TTree * tree; TBranch* br; FILE* f; char ntuName[200]; int numConc, numEncp; // projects ntuple if(nTotFiles>0) { // then we update the ntuple sprintf(ntuName,"%s.root",fNtupleFileName.Data()); ntupleOut = new TFile(ntuName,"recreate"); tree = new TTree("prodfarm_monitor","ProdFarm Monitor"); br = tree->Branch("ProdFarmMonitor","TProdFarmMonitor::Data_t", &fData); // loop over all files of all projects for(int ip=0; ip0) { // is running for(int i=0; ifIfile = i; fData->fIproj = ip; index=0; while(fscanf(f,"%d-%d-%d", &year, &month, &day)!=EOF){ fscanf(f,"%d-%d-%d %d %d %f %f %f %f", &hour, &min, &sec, &numConc, &numEncp, &fData->fBytesConcat, &fData->fKBytesMerged, &fData->fKBytesUsed, &fData->fKBytesFree); // fBytesConcat are in bytes, while the others are in Kbytes thisTime = TDatime(year, month, day, hour, min, sec); if(year<1995) printf(" WARNING 2 year %d <1995\n", year); fData->fTime = thisTime; fData->fAbsTime = thisTime.Convert(); fData->fIndex = index; fData->fNev = nev; if(numConc<0) { fData->fNumConcat=0; // sometimes it is -1, but it stands for 0 } else { fData->fNumConcat = numConc; } if(numEncp<0) { fData->fNumEncp=0; // sometimes it is -1, but it stands for 0 } else { fData->fNumEncp = numEncp; } index++; // index for each file of each project nev++; // index for each project tree->Fill(); } // EOF fclose(f); } // end of loop over files fProj.fLastEntry[ip] = thisTime; // just save the last entry for each project } // if still running } // loop over projects ntupleOut->Write(); delete ntupleOut; } // endif nTotFiles>0 return 0; } //_____________________________________________________________________________ int TProdFarmMonitor::MakePlots(const char* HtmlFile) { #define min(A,B) ((A)<(B)?(A):(B)) #define max(A,B) ((A)>(B)?(A):(B)) printf(" inside TProdFarmMonitor::MakePlots()\n"); gStyle->SetOptDate(1); // to add the date in the bottom-left corner gStyle->SetTitleX(0.2); // to shift the title a bit to the right // histos TH1F *hNumConcDay[MAX_PROJ]; TH1F *hNumConcWeek[MAX_PROJ]; TH1F *hNumEncpDay[MAX_PROJ]; TH1F *hNumEncpWeek[MAX_PROJ]; TH1F *hBytesConcDay[MAX_PROJ]; TH1F *hBytesConcWeek[MAX_PROJ]; TH1F *hKBytesMrgdDay[MAX_PROJ]; TH1F *hKBytesMrgdWeek[MAX_PROJ]; TH1F *hKBytesUsedDay[MAX_PROJ]; TH1F *hKBytesUsedWeek[MAX_PROJ]; TH1F *hKBytesFreeDay[MAX_PROJ]; TH1F *hKBytesFreeWeek[MAX_PROJ]; TH1F *hKBytesFreeUsedDay[MAX_PROJ]; TH1F *hKBytesFreeUsedWeek[MAX_PROJ]; char hName[100], hTitle[100]; for(int i=0; i0) { // is running sprintf(hName,"hNumConcDay#%d",i); sprintf(hTitle,"Num concatenations for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hNumConcDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hNumConcWeek#%d",i); sprintf(hTitle,"Num concatenations for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hNumConcWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hNumEncpDay#%d",i); sprintf(hTitle,"Num encp transfers for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hNumEncpDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hNumEncpWeek#%d",i); sprintf(hTitle,"Num encp transfersfor %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hNumEncpWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hBytesConcDay#%d",i); sprintf(hTitle,"Bytes concatenated for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hBytesConcDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hBytesConcWeek#%d",i); sprintf(hTitle,"Bytes concatenated for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hBytesConcWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hKBytesMrgdDay#%d",i); sprintf(hTitle,"Bytes merged for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hKBytesMrgdDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hKBytesMrgdWeek#%d",i); sprintf(hTitle,"Bytes merged for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hKBytesMrgdWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hKBytesUsedDay#%d",i); sprintf(hTitle,"Bytes used for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hKBytesUsedDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hKBytesUsedWeek#%d",i); sprintf(hTitle,"Bytes used for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hKBytesUsedWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hKBytesFreeDay#%d",i); sprintf(hTitle,"Bytes free for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hKBytesFreeDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hKBytesFreeWeek#%d",i); sprintf(hTitle,"Bytes free for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hKBytesFreeWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); sprintf(hName,"hKBytesFreeUsedDay#%d",i); sprintf(hTitle,"Bytes free+used for %s vs time (TODAY)", (fProj.fProjectName[i]).Data()); hKBytesFreeUsedDay[i] = new TH1F(hName, hTitle, NBINS_TIME_DAY, -24, 0); sprintf(hName,"hKBytesFreeUsedWeek#%d",i); sprintf(hTitle,"Bytes free+used for %s vs time (LAST 7 DAYS)", (fProj.fProjectName[i]).Data()); hKBytesFreeUsedWeek[i] = new TH1F(hName, hTitle, NBINS_TIME_WEEK, -7, 0); } // if still running } int timeDiff; float diffHours; float timeHour, timeDay, timeWeek; // absolute time for today/this week TDatime now; UInt_t absNow; UInt_t absTime; int nentries; int hour, min, day, dayPrevM; int hourNow, minNow, dayNow, monthNow, yearNow; char hourMinC[6], dayC[4]; monthNow = now.GetMonth(); dayNow = now.GetDay(); hourNow = now.GetHour(); minNow = now.GetMinute(); dayPrevM=31; if(monthNow==12 || monthNow==10 || monthNow==7 || monthNow==4) dayPrevM=30; if(monthNow==3 && (yearNow%4)!=0) dayPrevM=28; if(monthNow==3 && (yearNow%4)==0) dayPrevM=29; TTree *tree; // input file is always a raw data file... char ntuName[200]; absNow = now.Convert(); // then read the regular dCache ntuple sprintf(ntuName,"%s.root",fNtupleFileName.Data()); TFile ntuple_file(ntuName,"read"); tree = (TTree*) ntuple_file.Get("prodfarm_monitor"); char command[500]; UInt_t fNumConcat, fNumEncp, fIproj; float fBytesConcat, fKBytesMerged, fKBytesUsed, fKBytesFree; float numDay[NBINS_TIME_DAY][MAX_PROJ], numConcDay[NBINS_TIME_DAY][MAX_PROJ], numEncpDay[NBINS_TIME_DAY][MAX_PROJ], bytesConcDay[NBINS_TIME_DAY][MAX_PROJ], bytesMrgdDay[NBINS_TIME_DAY][MAX_PROJ], bytesUsedDay[NBINS_TIME_DAY][MAX_PROJ], bytesFreeDay[NBINS_TIME_DAY][MAX_PROJ]; float numWeek[NBINS_TIME_WEEK][MAX_PROJ], numConcWeek[NBINS_TIME_WEEK][MAX_PROJ], numEncpWeek[NBINS_TIME_WEEK][MAX_PROJ], bytesConcWeek[NBINS_TIME_WEEK][MAX_PROJ], bytesMrgdWeek[NBINS_TIME_WEEK][MAX_PROJ], bytesUsedWeek[NBINS_TIME_WEEK][MAX_PROJ], bytesFreeWeek[NBINS_TIME_WEEK][MAX_PROJ]; int numConcMoreAbn[MAX_PROJ],numConcMoreBad[MAX_PROJ]; int numEntEncp100Abn[MAX_PROJ], numEntEncp100Bad[MAX_PROJ]; float aveEncp100Abn[MAX_PROJ], aveEncp100Bad[MAX_PROJ]; int nConc0Abn[MAX_PROJ], nConc0Bad[MAX_PROJ], nEncp0Abn[MAX_PROJ], nEncp0Bad[MAX_PROJ]; int tBin; float fKBytesFreeLast[MAX_PROJ], fKBytesUsedLast[MAX_PROJ]; UInt_t absTimeLast[MAX_PROJ]; for(int ip=0; ip (tree->GetEntries()); tree->SetBranchAddress("ProdFarmMonitor", &fData); for(int nev=0; nevGetEvent(nev); fNumConcat=fData->fNumConcat; fNumEncp=fData->fNumEncp; fBytesConcat=fData->fBytesConcat; fKBytesMerged=fData->fKBytesMerged; fKBytesUsed=fData->fKBytesUsed; fKBytesFree=fData->fKBytesFree; fIproj=fData->fIproj; absTime = fData->fAbsTime; timeDiff = absTime; timeDiff -= absNow; diffHours = - ((float) timeDiff)/60./60.; timeHour = (float ) timeDiff/60. + TMAX_HOUR; // (min) because TDatime.Convert() gives the time in seconds timeDay = (float ) timeDiff/60. + TMAX_DAY; // (min) because TDatime.Convert() gives the time in seconds timeWeek = (float) timeDiff/60. + TMAX_WEEK; // (min) // first fill histos // quantities vs time if(diffHours < fPars.numHoursAbnConc) { if(fNumConcat >= fPars.minConc) numConcMoreAbn[fIproj]++; } if(diffHours < fPars.numHoursBadConc) { if(fNumConcat >= fPars.minConc) numConcMoreBad[fIproj]++; } if(diffHours < fPars.numHours0AbnConc) { nConc0Abn[fIproj] += fNumConcat; } if(diffHours < fPars.numHours0BadConc) { nConc0Bad[fIproj] += fNumConcat; } if(diffHours < fPars.numHours0AbnEncp) { nEncp0Abn[fIproj] += fNumEncp; } if(diffHours < fPars.numHours0BadEncp) { nEncp0Bad[fIproj] += fNumEncp; } if(diffHours < fPars.numHours100AbnEncp) { numEntEncp100Abn[fIproj]++; aveEncp100Abn[fIproj] += fNumEncp; } if(diffHours < fPars.numHours100BadEncp) { numEntEncp100Bad[fIproj]++; aveEncp100Bad[fIproj] += fNumEncp; } if(timeDay>0 && timeDay < TMAX_DAY) { if(absTime >= absTimeLast[fIproj]) { fKBytesFreeLast[fIproj] = fKBytesFree; fKBytesUsedLast[fIproj] = fKBytesUsed; absTimeLast[fIproj] = absTime; } tBin = static_cast ( (timeDay/TMAX_DAY)*NBINS_TIME_DAY ); numDay[tBin][fIproj]++; numConcDay[tBin][fIproj] += fNumConcat; numEncpDay[tBin][fIproj] += fNumEncp; bytesUsedDay[tBin][fIproj] += fKBytesUsed; bytesFreeDay[tBin][fIproj] += fKBytesFree; bytesConcDay[tBin][fIproj] += fBytesConcat; bytesMrgdDay[tBin][fIproj] += fKBytesMerged; } if(timeWeek>0 && timeWeek < TMAX_WEEK) { tBin = static_cast ( (timeWeek/TMAX_WEEK)*NBINS_TIME_WEEK ); numWeek[tBin][fIproj]++; numConcWeek[tBin][fIproj] += fNumConcat; numEncpWeek[tBin][fIproj] += fNumEncp; bytesUsedWeek[tBin][fIproj] += fKBytesUsed; bytesFreeWeek[tBin][fIproj] += fKBytesFree; bytesConcWeek[tBin][fIproj] += fBytesConcat; bytesMrgdWeek[tBin][fIproj] += fKBytesMerged; } } // loop over entries ntuple_file.Close(); // loop over all projects for(int ip=0; ip0) { // is running if(fKBytesFreeLast[ip] < fPars.lowFreePct*(fKBytesUsedLast[ip]+fKBytesFreeLast[ip]) && fKBytesFreeLast[ip]>0) fStatus.free[ip]=1; if(fKBytesFreeLast[ip] < fPars.xLowFreePct*(fKBytesUsedLast[ip]+fKBytesFreeLast[ip]) && fKBytesFreeLast[ip]>0) fStatus.free[ip]=2; if(numEntEncp100Abn[ip]>0) aveEncp100Abn[ip] /= numEntEncp100Abn[ip]; if(numEntEncp100Bad[ip]>0) aveEncp100Bad[ip] /= numEntEncp100Bad[ip]; // is average number of concatenations below threshold for too long a time? fStatus.concLow[ip]=2; if(numConcMoreBad[ip]>0) fStatus.concLow[ip]=1; if(numConcMoreAbn[ip]>0) fStatus.concLow[ip]=0; // are there 0 concatenations for too long a time? if(nConc0Abn[ip] == 0) { fStatus.conc0[ip]=1; } if(nConc0Bad[ip] == 0) { fStatus.conc0[ip]=2; } // are there 0 encps for too long a time? if(nEncp0Abn[ip] == 0) { fStatus.encp0[ip]=1; } if(nEncp0Bad[ip] == 0) { fStatus.encp0[ip]=2; } // are there >=100 encps for too long a time? if(aveEncp100Abn[ip] >= 100) { fStatus.encp100[ip]=1; } if(aveEncp100Bad[ip] >= 100) { fStatus.encp100[ip]=2; } for (int i=0; i0) { numConcDay[i][ip]/= numDay[i][ip]; numEncpDay[i][ip]/= numDay[i][ip]; bytesUsedDay[i][ip]/= numDay[i][ip]; bytesFreeDay[i][ip]/= numDay[i][ip]; bytesConcDay[i][ip]/= numDay[i][ip]; bytesMrgdDay[i][ip]/= numDay[i][ip]; } hNumConcDay[ip]->SetBinContent(i+1, numConcDay[i][ip]); hNumEncpDay[ip]->SetBinContent(i+1, numEncpDay[i][ip]); hBytesConcDay[ip]->SetBinContent(i+1, ((float)bytesConcDay[i][ip])/1.e9); // in GB hKBytesUsedDay[ip]->SetBinContent(i+1, ((float)bytesUsedDay[i][ip])/1.e9); // in TB hKBytesFreeDay[ip]->SetBinContent(i+1, ((float)bytesFreeDay[i][ip])/1.e9); // in TB hKBytesFreeUsedDay[ip]->SetBinContent(i+1, ((float)bytesFreeDay[i][ip])/1.e9 + ((float)bytesUsedDay[i][ip])/1.e9); // in TB hKBytesMrgdDay[ip]->SetBinContent(i+1, ((float)bytesMrgdDay[i][ip])/1.e6); // in GB if((i%120)==0) { hour = (i*24)/NBINS_TIME_DAY -24; hour += hourNow; if(hour <0) hour += 24; if(hour<10 && minNow <10) sprintf(hourMinC,"0%d:0%d\n", hour, minNow); if(hour>=10 && minNow<10) sprintf(hourMinC,"%d:0%d\n", hour, minNow); if(hour<10 && minNow>=10) sprintf(hourMinC,"0%d:%d\n", hour, minNow); if(hour>=10 && minNow>=10) sprintf(hourMinC,"%d:%d\n", hour, minNow); hNumConcDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hNumEncpDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hBytesConcDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hKBytesUsedDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hKBytesFreeDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hKBytesFreeUsedDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); hKBytesMrgdDay[ip]->GetXaxis()->SetBinLabel(i+1,hourMinC); } if(i==(NBINS_TIME_DAY-1)) { hNumConcDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hNumConcDay[ip]->GetXaxis()->LabelsOption("h"); hNumEncpDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hNumEncpDay[ip]->GetXaxis()->LabelsOption("h"); hBytesConcDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hBytesConcDay[ip]->GetXaxis()->LabelsOption("h"); hKBytesUsedDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesUsedDay[ip]->GetXaxis()->LabelsOption("h"); hKBytesFreeDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesFreeDay[ip]->GetXaxis()->LabelsOption("h"); hKBytesFreeUsedDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesFreeUsedDay[ip]->GetXaxis()->LabelsOption("h"); hKBytesMrgdDay[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesMrgdDay[ip]->GetXaxis()->LabelsOption("h"); } } for (int i=0; i0) { numConcWeek[i][ip]/= numWeek[i][ip]; numEncpWeek[i][ip]/= numWeek[i][ip]; bytesUsedWeek[i][ip]/= numWeek[i][ip]; bytesFreeWeek[i][ip]/= numWeek[i][ip]; bytesConcWeek[i][ip]/= numWeek[i][ip]; bytesMrgdWeek[i][ip]/= numWeek[i][ip]; } hNumConcWeek[ip]->SetBinContent(i+1, numConcWeek[i][ip]); hNumEncpWeek[ip]->SetBinContent(i+1, numEncpWeek[i][ip]); hBytesConcWeek[ip]->SetBinContent(i+1, ((float)bytesConcWeek[i][ip])/1.e9); // in GB hKBytesUsedWeek[ip]->SetBinContent(i+1, ((float)bytesUsedWeek[i][ip])/1.e9); // in TB hKBytesFreeWeek[ip]->SetBinContent(i+1, ((float)bytesFreeWeek[i][ip])/1.e9); // in TB hKBytesFreeUsedWeek[ip]->SetBinContent(i+1, ((float)bytesFreeWeek[i][ip])/1.e9 + ((float)bytesUsedWeek[i][ip])/1.e9); // in TB hKBytesMrgdWeek[ip]->SetBinContent(i+1, ((float)bytesMrgdWeek[i][ip])/1.e6); // in GB if((i%20)==0) { day = (i*7)/NBINS_TIME_WEEK -7; day += dayNow; if(day<=0) day += dayPrevM; sprintf(dayC,"%d", day); hNumConcWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hNumEncpWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hBytesConcWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hKBytesUsedWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hKBytesFreeWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hKBytesFreeUsedWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); hKBytesMrgdWeek[ip]->GetXaxis()->SetBinLabel(i+1,dayC); } if(i==(NBINS_TIME_WEEK-1)) { hNumConcWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hNumConcWeek[ip]->GetXaxis()->LabelsOption("h"); hNumEncpWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hNumEncpWeek[ip]->GetXaxis()->LabelsOption("h"); hBytesConcWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hBytesConcWeek[ip]->GetXaxis()->LabelsOption("h"); hKBytesUsedWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesUsedWeek[ip]->GetXaxis()->LabelsOption("h"); hKBytesFreeWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesFreeWeek[ip]->GetXaxis()->LabelsOption("h"); hKBytesFreeUsedWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesFreeUsedWeek[ip]->GetXaxis()->LabelsOption("h"); hKBytesMrgdWeek[ip]->GetXaxis()->SetBinLabel(i+1,"now"); hKBytesMrgdWeek[ip]->GetXaxis()->LabelsOption("h"); } } } // if still running } // end loop over projects // now check the status for(int ip=0; ip0) { // is running fStatus.freeSpace = max(fStatus.freeSpace, fStatus.free[ip]); fStatus.conc = max(fStatus.conc, fStatus.concLow[ip]); fStatus.conc = max(fStatus.conc, fStatus.conc0[ip]); fStatus.encp = max(fStatus.encp, fStatus.encp0[ip]); fStatus.encp = max(fStatus.encp, fStatus.encp100[ip]); if(fStatus.free[ip]==1 || fStatus.concLow[ip]==1 || fStatus.conc0[ip]==1 || fStatus.encp0[ip]==1 || fStatus.encp100[ip]==1) fStatus.proj[ip]=1; if(fStatus.free[ip]==2 || fStatus.concLow[ip]==2 || fStatus.conc0[ip]==2 || fStatus.encp0[ip]==2 || fStatus.encp100[ip]==2) fStatus.proj[ip]=2; } if(fProj.fIsRunning[ip] == 0) fStatus.proj[ip]=3; } if(fStatus.freeSpace==1 || fStatus.conc==1 || fStatus.encp==1) fStatus.global=1; if(fStatus.freeSpace==2 || fStatus.conc==2 || fStatus.encp==2) fStatus.global=2; fStatus.fNumProjects = fProj.fNumProjects; // just a copy // // write the status file // TString statusFile; statusFile = fHtmlDirectory + "/Status.dat"; FILE* fOut = fopen(statusFile,"w"); TDatime time; time = TDatime(); fprintf(fOut,"%d %d %d %d %d\n", fStatus.freeSpace, fStatus.conc, fStatus.encp, fStatus.global, fStatus.fNumProjects); for(int i=0; i0) { // is running hNumConcDay[ip]->SetStats(false); hNumConcDay[ip]->GetXaxis()->SetLabelSize(0.04); hNumEncpDay[ip]->SetStats(false); hNumEncpDay[ip]->GetXaxis()->SetLabelSize(0.04); hBytesConcDay[ip]->SetStats(false); hBytesConcDay[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesMrgdDay[ip]->SetStats(false); hKBytesMrgdDay[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesUsedDay[ip]->SetStats(false); hKBytesUsedDay[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesFreeDay[ip]->SetStats(false); hKBytesFreeDay[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesFreeUsedDay[ip]->SetStats(false); hKBytesFreeUsedDay[ip]->GetXaxis()->SetLabelSize(0.04); hNumConcWeek[ip]->SetStats(false); hNumConcWeek[ip]->GetXaxis()->SetLabelSize(0.04); hNumEncpWeek[ip]->SetStats(false); hNumEncpWeek[ip]->GetXaxis()->SetLabelSize(0.04); hBytesConcWeek[ip]->SetStats(false); hBytesConcWeek[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesMrgdWeek[ip]->SetStats(false); hKBytesMrgdWeek[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesUsedWeek[ip]->SetStats(false); hKBytesUsedWeek[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesFreeWeek[ip]->SetStats(false); hKBytesFreeWeek[ip]->GetXaxis()->SetLabelSize(0.04); hKBytesFreeUsedWeek[ip]->SetStats(false); hKBytesFreeUsedWeek[ip]->GetXaxis()->SetLabelSize(0.04); hBytesConcDay[ip]->GetYaxis()->SetTitle("(GB)"); hKBytesMrgdDay[ip]->GetYaxis()->SetTitle("(GB)"); hKBytesUsedDay[ip]->GetYaxis()->SetTitle("(TB)"); hKBytesFreeDay[ip]->GetYaxis()->SetTitle("(TB)"); hKBytesFreeUsedDay[ip]->GetYaxis()->SetTitle("(TB)"); hBytesConcWeek[ip]->GetYaxis()->SetTitle("(GB)"); hKBytesMrgdWeek[ip]->GetYaxis()->SetTitle("(GB)"); hKBytesUsedWeek[ip]->GetYaxis()->SetTitle("(TB)"); hKBytesFreeWeek[ip]->GetYaxis()->SetTitle("(TB)"); hKBytesFreeUsedWeek[ip]->GetYaxis()->SetTitle("(TB)"); // add the date hNumConcDay[ip]->GetXaxis()->SetTitle(time.AsString()); hNumEncpDay[ip]->GetXaxis()->SetTitle(time.AsString()); hBytesConcDay[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesMrgdDay[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesUsedDay[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesFreeDay[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesFreeUsedDay[ip]->GetXaxis()->SetTitle(time.AsString()); hNumConcWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hNumEncpWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hBytesConcWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesMrgdWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesUsedWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesFreeWeek[ip]->GetXaxis()->SetTitle(time.AsString()); hKBytesFreeUsedWeek[ip]->GetXaxis()->SetTitle(time.AsString()); // set green by default // if(fStatus.proj[ip]==0) { hNumConcDay[ip]->SetFillColor(kGreen); hNumEncpDay[ip]->SetFillColor(kGreen); hBytesConcDay[ip]->SetFillColor(kGreen); hKBytesMrgdDay[ip]->SetFillColor(kGreen); hKBytesUsedDay[ip]->SetFillColor(kGreen); hKBytesFreeDay[ip]->SetFillColor(kGreen); hKBytesFreeUsedDay[ip]->SetFillColor(kGreen); hKBytesFreeUsedDay[ip]->SetFillStyle(3003); hNumConcWeek[ip]->SetFillColor(kGreen); hNumEncpWeek[ip]->SetFillColor(kGreen); hBytesConcWeek[ip]->SetFillColor(kGreen); hKBytesMrgdWeek[ip]->SetFillColor(kGreen); hKBytesUsedWeek[ip]->SetFillColor(kGreen); hKBytesFreeWeek[ip]->SetFillColor(kGreen); hKBytesFreeUsedWeek[ip]->SetFillColor(kGreen); hKBytesFreeUsedWeek[ip]->SetFillStyle(3003); // } if(fStatus.proj[ip]==1) { if(fStatus.concLow[ip]==1 || fStatus.conc0[ip]==1) hNumConcDay[ip]->SetFillColor(kYellow); if(fStatus.encp0[ip]==1 || fStatus.encp100[ip]==1) hNumEncpDay[ip]->SetFillColor(kYellow); // hBytesConcDay[ip]->SetFillColor(kYellow); // hKBytesMrgdDay[ip]->SetFillColor(kYellow); // hKBytesUsedDay[ip]->SetFillColor(kYellow); if(fStatus.free[ip]==1) hKBytesFreeDay[ip]->SetFillColor(kYellow); if(fStatus.free[ip]==1) hKBytesFreeUsedDay[ip]->SetFillColor(kYellow); if(fStatus.concLow[ip]==1 || fStatus.conc0[ip]==1) hNumConcWeek[ip]->SetFillColor(kYellow); if(fStatus.encp0[ip]==1 || fStatus.encp100[ip]==1) hNumEncpWeek[ip]->SetFillColor(kYellow); // hBytesConcWeek[ip]->SetFillColor(kYellow); // hKBytesMrgdWeek[ip]->SetFillColor(kYellow); // hKBytesUsedWeek[ip]->SetFillColor(kYellow); if(fStatus.free[ip]==1) hKBytesFreeWeek[ip]->SetFillColor(kYellow); if(fStatus.free[ip]==1) hKBytesFreeUsedWeek[ip]->SetFillColor(kYellow); } if(fStatus.proj[ip]==2) { if(fStatus.concLow[ip]==2 || fStatus.conc0[ip]==2) hNumConcDay[ip]->SetFillColor(kRed); if(fStatus.encp0[ip]==2 || fStatus.encp100[ip]==2) hNumEncpDay[ip]->SetFillColor(kRed); // hBytesConcDay[ip]->SetFillColor(kRed); // hKBytesMrgdDay[ip]->SetFillColor(kRed); // hKBytesUsedDay[ip]->SetFillColor(kRed); if(fStatus.free[ip]==2) hKBytesFreeDay[ip]->SetFillColor(kRed); if(fStatus.free[ip]==2) hKBytesFreeUsedDay[ip]->SetFillColor(kRed); if(fStatus.concLow[ip]==2 || fStatus.conc0[ip]==2) hNumConcWeek[ip]->SetFillColor(kRed); if(fStatus.encp0[ip]==2 || fStatus.encp100[ip]==2) hNumEncpWeek[ip]->SetFillColor(kRed); // hBytesConcWeek[ip]->SetFillColor(kRed); // hKBytesMrgdWeek[ip]->SetFillColor(kRed); // hKBytesUsedWeek[ip]->SetFillColor(kRed); if(fStatus.free[ip]==2) hKBytesFreeWeek[ip]->SetFillColor(kRed); if(fStatus.free[ip]==2) hKBytesFreeUsedWeek[ip]->SetFillColor(kRed); } } // if still running } TLine *ldLowBytes,*ldXLowBytes; TLine *lwLowBytes,*lwXLowBytes; // Bytes ldLowBytes = new TLine(0, fPars.lowFreePct*100, -24, fPars.lowFreePct*100); ldLowBytes->SetLineColor(kYellow); ldXLowBytes = new TLine(0, fPars.xLowFreePct*100, -24, fPars.xLowFreePct*100); ldXLowBytes->SetLineColor(kRed); lwLowBytes = new TLine(0, fPars.lowFreePct*100, -7, fPars.lowFreePct*100); lwLowBytes->SetLineColor(kYellow); lwXLowBytes = new TLine(0, fPars.xLowFreePct*100, -7, fPars.xLowFreePct*100); lwXLowBytes->SetLineColor(kRed); // loop over all projects char cName[200], cFileName[200]; // we need a duplicate with a shorter name or else we exceed "pstopnm" limits sprintf(cFileName,"/temp.eps"); psTmp = fHtmlDirectory + cFileName; TCanvas *cConcD, *cEncpD, *cConcBytesD, *cMrgdBytesD, *cUsedBytesD, *cFreeBytesD; TCanvas *cConcW, *cEncpW, *cConcBytesW, *cMrgdBytesW, *cUsedBytesW, *cFreeBytesW; for(int ip=0; ip0) { // is running // number of concatenations // day sprintf(cName,"cConc_D"); cConcD = new TCanvas(cName); cConcD->SetGridy(); hNumConcDay[ip]->Draw(); sprintf(cFileName,"/%s/Conc_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cConcD->Print(psFile); cConcD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/Conc_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cConcD->Print(gifFile); } // week sprintf(cName,"cConc_W"); cConcW = new TCanvas(cName); cConcW->SetGridy(); hNumConcWeek[ip]->Draw(); sprintf(cFileName,"/%s/Conc_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cConcW->Print(psFile); cConcW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/Conc_W.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cConcW->Print(gifFile); } // number of encp transfers // day sprintf(cName,"cEncp_D"); cEncpD = new TCanvas(cName); cEncpD->SetGridy(); hNumEncpDay[ip]->Draw(); sprintf(cFileName,"/%s/Encp_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cEncpD->Print(psFile); cEncpD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/Encp_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cEncpD->Print(gifFile); } // week sprintf(cName,"cEncp_W"); cEncpW = new TCanvas(cName); cEncpW->SetGridy(); hNumEncpWeek[ip]->Draw(); sprintf(cFileName,"/%s/Encp_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cEncpW->Print(psFile); cEncpW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/Encp_W.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cEncpW->Print(gifFile); } // number of concatenated bytes // day sprintf(cName,"cConcBytes_D"); cConcBytesD = new TCanvas(cName); cConcBytesD->SetGridy(); hBytesConcDay[ip]->Draw(); sprintf(cFileName,"/%s/ConcBytes_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cConcBytesD->Print(psFile); cConcBytesD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/ConcBytes_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cConcBytesD->Print(gifFile); } // week sprintf(cName,"cConcBytes_W"); cConcBytesW = new TCanvas(cName); cConcBytesW->SetGridy(); hBytesConcWeek[ip]->Draw(); sprintf(cFileName,"/%s/ConcBytes_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cConcBytesW->Print(psFile); cConcBytesW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/ConcBytes_W.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cConcBytesW->Print(gifFile); } // number of merged bytes // day sprintf(cName,"cMrgdBytes_D"); cMrgdBytesD = new TCanvas(cName); cMrgdBytesD->SetGridy(); hKBytesMrgdDay[ip]->Draw(); sprintf(cFileName,"/%s/MrgdBytes_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cMrgdBytesD->Print(psFile); cMrgdBytesD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/MrgdBytes_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cMrgdBytesD->Print(gifFile); } // day sprintf(cName,"cMrgdBytes_W"); cMrgdBytesW = new TCanvas(cName); cMrgdBytesW->SetGridy(); hKBytesMrgdWeek[ip]->Draw(); sprintf(cFileName,"/%s/MrgdBytes_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cMrgdBytesW->Print(psFile); cMrgdBytesW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/MrgdBytes_W.gif",(fProj.fProjectLabel[ip]).Data() ); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cMrgdBytesW->Print(gifFile); } // number of used bytes // day sprintf(cName,"cUsedBytes_D"); cUsedBytesD = new TCanvas(cName); cUsedBytesD->SetGridy(); hKBytesUsedDay[ip]->Draw(); sprintf(cFileName,"/%s/UsedBytes_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cUsedBytesD->Print(psFile); cUsedBytesD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/UsedBytes_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cUsedBytesD->Print(gifFile); } // week sprintf(cName,"cUsedBytes_W"); cUsedBytesW = new TCanvas(cName); cUsedBytesW->SetGridy(); hKBytesUsedWeek[ip]->Draw(); sprintf(cFileName,"/%s/UsedBytes_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cUsedBytesW->Print(psFile); cUsedBytesW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/UsedBytes_W.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cUsedBytesW->Print(gifFile); } // number of free bytes //day sprintf(cName,"cFreeBytes_D"); cFreeBytesD = new TCanvas(cName); cFreeBytesD->SetGridy(); hKBytesFreeUsedDay[ip]->SetMinimum(0); hKBytesFreeUsedDay[ip]->Draw(); hKBytesFreeDay[ip]->Draw("SAME"); sprintf(cFileName,"/%s/FreeBytes_D.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cFreeBytesD->Print(psFile); cFreeBytesD->Print(psTmp); // duplicate sprintf(cFileName,"/%s/FreeBytes_D.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cFreeBytesD->Print(gifFile); } // week sprintf(cName,"cFreeBytes_W"); cFreeBytesW = new TCanvas(cName); cFreeBytesW->SetGridy(); hKBytesFreeUsedWeek[ip]->SetMinimum(0); hKBytesFreeUsedWeek[ip]->Draw(); hKBytesFreeWeek[ip]->Draw("SAME"); sprintf(cFileName,"/%s/FreeBytes_W.eps", (fProj.fProjectLabel[ip]).Data()); psFile = fHtmlDirectory + cFileName; cFreeBytesW->Print(psFile); cFreeBytesW->Print(psTmp); // duplicate sprintf(cFileName,"/%s/FreeBytes_W.gif", (fProj.fProjectLabel[ip]).Data()); gifFile = fHtmlDirectory + cFileName; if (gROOT->IsBatch()) { sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psTmp.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psTmp.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psTmp.Data()); gSystem->Exec(command); } else { cFreeBytesW->Print(gifFile); } } // if still running } // end loop over projects return 0; } //_____________________________________________________________________________ int TProdFarmMonitor::MakeHtml(const char* HtmlFile) { // input file is always a raw data file... printf(" inside TProdFarmMonitor::MakeHtml()\n"); char * wwwBase={"http://www-cdf.fnal.gov/offline/monitoring/"}; TDatime time; time = fStatus.time; FILE* page; const char* mon_dir = gSystem->Getenv("OFFLINE_MON_DIR"); TString inFile, outFile; // first the time-stamp file TString psFile, gifFile; char command[400]; char cFileName[200]; TCanvas * ctime = new TCanvas("ctime","ctime",250,80); TPaveText * ptime = new TPaveText(0.,0.,1.,1.); char timeLabel[100]; sprintf(timeLabel, "%s", time.AsString()); TText *txt = ptime->AddText(timeLabel); if(fStatus.global==0) txt->SetTextColor(kGreen); if(fStatus.global==1) txt->SetTextColor(kYellow); if(fStatus.global==2) txt->SetTextColor(kRed); ptime->Draw(); psFile = fHtmlDirectory + "/Time.eps"; gifFile = fHtmlDirectory + "/Time.gif"; ctime->Print(psFile); sprintf(command,"pstopnm -ppm -xborder 0 -yborder 0 -portrait %s", psFile.Data()); gSystem->Exec(command); sprintf(command,"ppmtogif %s001.ppm > %s", psFile.Data(), gifFile.Data()); gSystem->Exec(command); sprintf(command,"rm -f %s001.ppm", psFile.Data()); gSystem->Exec(command); // loop over all projects for(int ip=0; ipCopyFile(inFile.Data(), outFile.Data(), kTRUE); } // now global if(fStatus.global==0) inFile = TString(mon_dir) + "/greenball.gif"; if(fStatus.global==1) inFile = TString(mon_dir) + "/yelball.gif"; if(fStatus.global==2) inFile = TString(mon_dir) + "/redball.gif"; if(fStatus.global==3) inFile = TString(mon_dir) + "/done.gif"; outFile = fHtmlDirectory + "/AllProjects.gif"; gSystem->CopyFile(inFile.Data(), outFile.Data(), kTRUE); // this is to prepare we pages TString htmlFile; // first we fill a single page per project int ifig; // loop over all projects for(int ip=0; ip\n"); fprintf(page,"\n", wwwBase); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
Production Farm monitorProject status Help
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); if(fStatus.proj[ip]==0) fprintf(page,"\n", (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==1) fprintf(page,"\n", (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==2) fprintf(page,"\n", (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==3) fprintf(page,"\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
 
greenball.gif %s Statusyelball.gif %s Statusredball.gif %s Statusdone.gif %s Status
 
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig=1; fprintf(page," Fig. %d: Number of concatenations vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Number\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here Number of concatenations vs time last 7 days ((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig++; fprintf(page," Fig. %d: Number of encp transfers vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Number\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here Number of encp transfers vs time last 7 days ((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig++; fprintf(page," Fig. %d: Bytes concatenated vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Bytes\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here for Bytes concatenated vs time last 7 days ((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig++; fprintf(page," Fig. %d: Bytes merged vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Bytes\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here for Bytes merged vs time last 7 days ((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig++; fprintf(page," Fig. %d: Bytes used vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Bytes\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here for Bytes used vs time last 7 days((gif),(eps) ) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
\n"); ifig++; fprintf(page," Fig. %d: Bytes free vs time (TODAY)((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"Bytes\n", (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

 
\n"); ifig++; fprintf(page," Fig. %d: Click here for Bytes free vs time last 7 days ((gif), (eps)) \n", ifig, (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"
 

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
redball.gif Bad statusyelball.gif Abnormal statusgreenball.gif Normal status
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n", time.AsSQLString()); fprintf(page,"
Legal Notices
Brought To You By: ProdFarm Monitoring
Last updated: %s
\n"); fprintf(page,"\n"); fclose(page); } // end loop over projects // now ProdFarm Status page htmlFile = fHtmlDirectory + "/Status.html"; page = fopen(htmlFile,"w"); fprintf(page,"\n"); fprintf(page,"\n", wwwBase); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); // 1 fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
Global monitorProductionFarm Help
\n"); fprintf(page,"
\n"); // 2 fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
 
Production Farm Monitor
 
\n"); fprintf(page,"
\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

\n"); fprintf(page,"
\n"); // 3 if(fStatus.global==0) fprintf(page,"\n"); if(fStatus.global==1) fprintf(page,"
greenball.gif Production Farm Projects
\n"); if(fStatus.global==2) fprintf(page,"
yelball.gif Production Farm projects
\n"); if(fStatus.global==3) fprintf(page,"
redball.gif Production Farm Projects
\n"); fprintf(page,"\n"); fprintf(page,"
done.gif Production Farm Projects
 
\n"); fprintf(page,"
\n"); // now projects // loop over all projects for(int ip=0; ip\n"); if(fStatus.proj[ip]==0) fprintf(page," greenball.gif %s\n", (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==1) fprintf(page," yelball.gif %s\n", (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==2) fprintf(page," redball.gif %s\n", (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); if(fStatus.proj[ip]==3) fprintf(page," done.gif %s\n", (fProj.fProjectLabel[ip]).Data(), (fProj.fProjectLabel[ip]).Data()); fprintf(page,"\n"); fprintf(page,"
\n"); } // end loop over projects fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"

\n"); fprintf(page,"
\n"); // 5 fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
redball.gif Major Problemyelball.gif Minor problem
greenball.gif OKdone.gif Done
\n"); fprintf(page,"
\n"); // 6 fprintf(page,"\n"); // fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"
 

\n"); fprintf(page,"
\n"); // 7 fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"\n", time.AsSQLString()); fprintf(page,"
Legal Notices
Brought To You By: Production Farm Monitoring
Last updated: %s
\n"); fprintf(page,"\n"); fclose(page); // Projects popup htmlFile = fHtmlDirectory + "/ProjPop.html"; page = fopen(htmlFile,"w"); fprintf(page,"\n"); fprintf(page,"\n"); fprintf(page,"Groups status\n"); fprintf(page,"

\n"); fprintf(page,"The status of Production Farm depends on the 'OR' of the status of the various groups: if any of them is 'bad', the situation is is flagged as 'bad' (red ball); if any one is 'abnormal', the situation is flagged 'abnormal' (yellow ball). Otherwise the situation is flagged as 'normal' (green ball)\n"); fprintf(page,"

\n"); fclose(page); return 0; } int TProdFarmMonitor::MakeXml() { static const char STRLETTER[] = {'A', 'B', 'C', 'E', 'G', 'H', 'J', 'Z', 'Z', 'Z', 'Z'}; monInfo.name = "Production Farm"; monInfo.filename = "prodfarm.xml"; monInfo.status = static_cast(fStatus.global) == DISABLED ? OK : static_cast(fStatus.global); monInfo.contacturl = "mailto:vataga@fnal.gov"; monInfo.timestamp = fStatus.time.Convert(); monSubInfo.reserve(fProj.fNumProjects); monSubInfo.resize(fProj.fNumProjects); MonitorSubInfos::iterator it = monSubInfo.begin(); for(int ip = 0; ip < fProj.fNumProjects; ip++, it++) { ostringstream sname; sname << "Stream" << static_cast(STRLETTER[ip]); // cerr << sname.str() << endl; it->name = sname.str(); ostringstream surl; surl << "http://www-cdf.fnal.gov/tiki/tiki-index.php?page=farm.ProductionExe_" << static_cast(tolower(STRLETTER[ip])) << "physr.Monitoring"; it->url = surl.str(); // cerr << surl.str() << endl; if(fStatus.proj[ip] == DISABLED) { it->status = OK; it->masked = true; } else it->status = static_cast(fStatus.proj[ip]); it->values.reserve(4); it->values.resize(4); it->values[0].group = "Free space"; it->values[1].group = "Concatenated volume"; it->values[2].group = "Running concatenating jobs"; it->values[3].group = "Active transfers to tape"; } TOfflineMonitor::MakeXml(); return 0; }