Esempio n. 1
0
 public void init() {
   m_processors = m_systemInfo.getHardware().getProcessors();
   m_cpuTicks = new long[m_processors.length][4];
   for (int i = 0; i < m_processors.length; i++) {
     long[] cpuTicks = m_processors[i].getProcessorCpuLoadTicks();
     m_cpuTicks[i][0] = cpuTicks[0];
     m_cpuTicks[i][1] = cpuTicks[1];
     m_cpuTicks[i][2] = cpuTicks[2];
     m_cpuTicks[i][3] = cpuTicks[3];
   }
 }
Esempio n. 2
0
  private void publishFilesystem(final Map<String, Object> sharedData) {
    HardwareAbstractionLayer hal = m_systemInfo.getHardware();
    for (OSFileStore fs : hal.getFileStores()) {

      long free = fs.getUsableSpace();
      long total = fs.getTotalSpace();
      long used = total - free;

      String instance = fs.getName() + " (" + fs.getDescription() + ")";
      publishMetric(sharedData, FILESYSTEM_USED, used, instance);
      publishMetric(sharedData, FILESYSTEM_FREE, free, instance);
      publishMetric(sharedData, FILESYSTEM_TOTAL, total, instance);
    }
  }
Esempio n. 3
0
  private void publishMem(final Map<String, Object> sharedData) {

    Memory mem = m_systemInfo.getHardware().getMemory();

    long free = mem.getAvailable();
    long total = mem.getTotal();
    long used = total - free;

    // Used, free, total
    publishMetric(sharedData, MEM_USED, used);
    publishMetric(sharedData, MEM_FREE, free);
    publishMetric(sharedData, MEM_TOTAL, total);

    // Used and free perc
    publishMetric(sharedData, MEM_USED_PERC, 100.0d * used / total);
    publishMetric(sharedData, MEM_FREE_PERC, 100.0d * free / total);
  }