Search in sources :

Example 1 with DataDiskStats

use of com.emc.vipr.model.sys.healthmonitor.DataDiskStats in project coprhd-controller by CoprHD.

the class HealthMonitorService method getNodeDiskAmount.

private long getNodeDiskAmount() {
    DataDiskStats dataDiskStats = ProcStats.getDataDiskStats();
    long rootDiskAmount = dataDiskStats.getRootAvailKB() + dataDiskStats.getRootUsedKB();
    long dataDiskAmount = dataDiskStats.getDataAvailKB() + dataDiskStats.getDataUsedKB();
    return (rootDiskAmount + dataDiskAmount);
}
Also used : DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats)

Example 2 with DataDiskStats

use of com.emc.vipr.model.sys.healthmonitor.DataDiskStats in project coprhd-controller by CoprHD.

the class BackupManager method validateDiskUsedStatus.

private void validateDiskUsedStatus() {
    DataDiskStats dataDiskStatus = getDataDiskStats();
    if (dataDiskStatus == null) {
        log.info("Can't find disk size of /data");
        return;
    }
    long dataTotalKB = dataDiskStatus.getDataUsedKB() + dataDiskStatus.getDataAvailKB();
    int diskUsedPercentage = (int) (dataDiskStatus.getDataUsedKB() * 100 / dataTotalKB);
    log.info("Disk used percentage limit: {}\tCurrent Disk used percentage: {}", getBackupDisabledDiskPercentage(), diskUsedPercentage);
    if (diskUsedPercentage > getBackupDisabledDiskPercentage()) {
        throw BackupException.fatals.backupDisabledAsDiskFull(diskUsedPercentage, getBackupDisabledDiskPercentage());
    }
}
Also used : DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats)

Example 3 with DataDiskStats

use of com.emc.vipr.model.sys.healthmonitor.DataDiskStats in project coprhd-controller by CoprHD.

the class BackupManager method getDataDiskStats.

private DataDiskStats getDataDiskStats() {
    final String[] cmd = { DF_COMMAND };
    Exec.Result result = Exec.sudo(DF_COMMAND_TIMEOUT, cmd);
    if (!result.exitedNormally() || result.getExitValue() != 0) {
        log.error("getDataDiskStats() is unsuccessful. Command exit value is: {}", result.getExitValue());
        return null;
    }
    log.info("df result: {}", result.getStdOutput());
    String[] lines = result.getStdOutput().split("\n");
    DataDiskStats dataDiskStats = new DataDiskStats();
    for (String line : lines) {
        String[] v = line.split(SPACE_VALUE);
        if (v != null && v.length > 5) {
            if ("/data".equals(v[5].trim())) {
                dataDiskStats.setDataUsedKB(Long.parseLong(v[2]));
                dataDiskStats.setDataAvailKB(Long.parseLong(v[3]));
                return dataDiskStats;
            }
        }
    }
    return null;
}
Also used : Exec(com.emc.storageos.services.util.Exec) DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats)

Example 4 with DataDiskStats

use of com.emc.vipr.model.sys.healthmonitor.DataDiskStats in project coprhd-controller by CoprHD.

the class ProcStats method parseDFResults.

/**
 * Parses the input string and returns data disk stats object.
 */
private static DataDiskStats parseDFResults(String dfResult) {
    String[] lines = dfResult.split("\n");
    DataDiskStats dataDiskStats = new DataDiskStats();
    for (String line : lines) {
        String[] v = line.split(SPACE_VALUE);
        if (v != null && v.length > 5) {
            if ("/".equals(v[5].trim())) {
                dataDiskStats.setRootUsedKB(Long.parseLong(v[2]));
                dataDiskStats.setRootAvailKB(Long.parseLong(v[3]));
            } else if ("/data".equals(v[5].trim())) {
                dataDiskStats.setDataUsedKB(Long.parseLong(v[2]));
                dataDiskStats.setDataAvailKB(Long.parseLong(v[3]));
            }
        }
    }
    return dataDiskStats;
}
Also used : DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats)

Example 5 with DataDiskStats

use of com.emc.vipr.model.sys.healthmonitor.DataDiskStats in project coprhd-controller by CoprHD.

the class BackupManager method getQuotaGb.

public int getQuotaGb() {
    DataDiskStats dataDiskStats = getDataDiskStats();
    if (dataDiskStats == null) {
        return DEFAULT_DISK_QUOTA_GB;
    }
    long diskTotalKB = dataDiskStats.getDataUsedKB() + dataDiskStats.getDataAvailKB();
    int quotaGB = (int) ((diskTotalKB * getBackupMaxUsedDiskPercentage()) / (100 * 1024 * 1024));
    log.info("Quota is {} GB", quotaGB);
    return quotaGB;
}
Also used : DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats)

Aggregations

DataDiskStats (com.emc.vipr.model.sys.healthmonitor.DataDiskStats)6 Exec (com.emc.storageos.services.util.Exec)1 MemoryStats (com.emc.vipr.model.sys.healthmonitor.ProcModels.MemoryStats)1 ServiceHealth (com.emc.vipr.model.sys.healthmonitor.ServiceHealth)1 JsonObject (com.google.gson.JsonObject)1