Ignore:
Timestamp:
07/30/10 11:33:43 (14 years ago)
Author:
ogrimm
Message:
Expanded eLogStatus
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/eLogStatus/eLogStatus.cc

    r270 r272  
    11//
    22// Generate status.xml for elogbook status display
     3//
     4// Copy executable to /srv/www/htdocs/FACTelog/bin/ and
     5// change owner to 'tomcat'.
    36//
    47// Oliver Grimm, 29/7/2010
     
    1417int main() {
    1518
     19  string Status1, Status2, Status3, Status4, Status5;
     20
    1621  // Open file
    17   ofstream File("status.xml");
     22  ofstream File("/srv/www/htdocs/FACTelog/jsp/status.xml");
    1823  if (!File.is_open()) {
    1924    cerr << "Could not open file for writing" << endl;
     
    2227 
    2328  // Request data from DIM
    24   string Status1, Status2;
    2529  DimCurrentInfo Alarm("Alarm/MasterAlarm", NO_LINK);
    2630  DimCurrentInfo FBState("Feedback/State", NO_LINK);
     31  DimCurrentInfo RunNumber("drsdaq/RunNumber", NO_LINK);
     32  DimCurrentInfo RunSize("drsdaq/RunSizeMB", NO_LINK);
     33  DimCurrentInfo EventNo("drsdaq/EventNumber", NO_LINK);
    2734
    28   if (!EvidenceServer::ServiceOK(&FBState)) {
    29     Status1 = "Feedback state n/a";
     35  // Feedback state
     36  if (!EvidenceServer::ServiceOK(&FBState)) Status1 = "Feedback state n/a";
     37  else Status1 = EvidenceServer::ToString((char *) "I:1;C", FBState.getData(), FBState.getSize()).substr(2);
     38
     39  // MasterAlarm level
     40  if (!EvidenceServer::ServiceOK(&Alarm)) Status2 = "MasterAlarm n/a";
     41  else {
     42    switch (Alarm.getInt()) {
     43      case 0: Status2 = "OK"; break;
     44      case 1: Status2 = "Server WARN"; break;
     45      case 2: Status2 = "Server ERROR"; break;
     46      case 3: Status2 = "Server FATAL"; break;
     47      case 4: Status2 = "Server UNAVAILABLE"; break;
     48      default: Status2 = "MasterAlarm ???";
     49    }
    3050  }
    31   else Status1 = EvidenceServer::ToString((char *) "I:1;C", FBState.getData(), FBState.getSize());
    3251
    33   if (!EvidenceServer::ServiceOK(&Alarm)) {
    34     Status2 = "MasterAlarm n/a";
    35   }
    36   else Status2 = "MasterAlarm is " + EvidenceServer::ToString((char *) "I", Alarm.getData(), Alarm.getSize());
     52  // Run-related information
     53  if (!EvidenceServer::ServiceOK(&RunNumber)) Status3 = "Run #n/a";
     54  else Status3 = "Run #" + EvidenceServer::ToString((char *) "I", RunNumber.getData(), RunNumber.getSize());
     55 
     56  if (!EvidenceServer::ServiceOK(&RunSize)) Status4 = "Size n/a";
     57  else Status4 = "Size " + EvidenceServer::ToString((char *) "F", RunSize.getData(), RunSize.getSize()) + " MB";
     58
     59  if (!EvidenceServer::ServiceOK(&RunSize)) Status5 = "Event #n/a";
     60  else Status5 = "Event #" + EvidenceServer::ToString((char *) "I", EventNo.getData(), EventNo.getSize());
    3761 
    3862  // Write file
     
    4064  File << "<status_val1>" << Status1 << "</status_val1>" << endl;
    4165  File << "<status_val2>" << Status2 << "</status_val2>" << endl;
    42   File << "<status_val3>" << "n/a" << "</status_val3>" << endl;
    43   File << "<status_val4>" << "n/a" << "</status_val4>" << endl;
    44   File << "<status_val5>" << "n/a" << "</status_val5>" << endl;
    45   File << "<status_val6>" << "n/a" << "</status_val6>" << endl;
     66  File << "<status_val3>" << Status3 << "</status_val3>" << endl;
     67  File << "<status_val4>" << Status4 << "</status_val4>" << endl;
     68  File << "<status_val5>" << Status5 << "</status_val5>" << endl;
     69  File << "<status_val6>" << " " << "</status_val6>" << endl;
    4670  File << "</status_info>" << endl;
    4771 
Note: See TracChangeset for help on using the changeset viewer.