public void startMonitoring() {
    for (File f : dir.listFiles()) {
      if (!f.delete()) {
        // TODO
      }
    }

    if (!zipFileName.contentEquals("LogFiles.zip")) {
      zipFileName = "LogFiles.zip";
    }
    File oldZipFile = new File(zipFileName);
    if (oldZipFile.exists()) {
      oldZipFile.delete();
    }

    for (int i = 0; i < sharedData.allTransactionData.size();) {
      TransactionData tmp = sharedData.allTransactionData.get(i);
      if (tmp.isAlive) {
        tmp.openFileOutputStream();
        ++i;
      } else {
        sharedData.allTransactionData.remove(i);
      }
    }

    try {
      sharedData.tAllLogFileOutputStream = new BufferedOutputStream(
          new FileOutputStream(new File(sharedData.getFilePathName()
              + "/Transactions/allLogs-t.txt")));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    try {
      sharedData.sAllLogFileOutputStream = new BufferedOutputStream(
          new FileOutputStream(new File(sharedData.getFilePathName()
              + "/Transactions/allLogs-s.txt")));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    try {
      sharedData.qAllLogFileOutputStream = new BufferedOutputStream(
          new FileOutputStream(new File(sharedData.getFilePathName()
              + "/Transactions/allLogs-q.txt")));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    sharedData.txId.set(0);
    sharedData.queryId.set(0);

    monitoring = true;
    selector.wakeup();

    startDstat();
    sharedData.setOutputToFile(true);

    System.out.println("start monitoring");

  }