Package org.rioproject.system.measurable.disk

Examples of org.rioproject.system.measurable.disk.DiskSpaceUtilization


            } else if(cName.equals(Constants.UTIL_USED_MEMORY)) {
                SystemMemoryUtilization mem = cru.getSystemMemoryUtilization();
                value = (mem == null ? "?" : format(mem.getUsed()," MB"));

            } else if(cName.equals(Constants.UTIL_PERCENT_DISK)) {
                DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
                value = (disk==null?"?" : formatPercent(disk.getValue()));

            } else if(cName.equals(Constants.UTIL_AVAIL_DISK)) {
                DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
                value = (disk==null?"?" : format(disk.getAvailable()/MeasuredValueHelper.GB," GB"));

            } else if(cName.equals(Constants.UTIL_TOTAL_DISK)) {
                DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
                value = (disk==null?"?" : format(disk.getCapacity()/MeasuredValueHelper.GB," GB"));
            }
        }

        if(cName.equals(Constants.UTIL_PERCENT_CPU_PROC)) {
            value = formatPercent(MeasuredValueHelper.getMeasuredValue(SystemWatchID.PROC_CPU, cru));
View Full Code Here


        } else if (cName.equals(Constants.UTIL_USED_MEMORY)) {
            SystemMemoryUtilization mem = cru.getSystemMemoryUtilization();
            value = (mem == null ? 0 : mem.getUsed());

        } else if (cName.equals(Constants.UTIL_PERCENT_DISK)) {
            DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
            value = (disk == null ? 0 : disk.getValue());

        } else if (cName.equals(Constants.UTIL_AVAIL_DISK)) {
            DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
            value = (disk == null ? 0 : disk.getAvailable() / GB);

        } else if (cName.equals(Constants.UTIL_TOTAL_DISK)) {
            DiskSpaceUtilization disk = cru.getDiskSpaceUtilization();
            value = (disk == null ? 0 : disk.getCapacity() / GB);

        } else if (cName.equals(Constants.UTIL_PERCENT_CPU_PROC)) {
            value = getMeasuredValue("CPU (JVM)", cru);

        } else if (cName.equals(Constants.UTIL_PERCENT_HEAP_JVM)) {
View Full Code Here

   
    public void checkValue() {
        count++;
        if(monitor==null)
            return;
        DiskSpaceUtilization dsUtilization = (DiskSpaceUtilization)monitor.getMeasuredResource();
        tempUtilization += dsUtilization.getValue();
        if(count==sampleSize) {
            utilization = tempUtilization/sampleSize;
            count = 0;
            tempUtilization = 0;
        }
View Full Code Here

    public void setFileSystemToMonitor(String fileSystem) {
        this.fileSystem = fileSystem;
    }
   
    public DiskSpaceUtilization getMeasuredResource() {
        DiskSpaceUtilization dsu;
        if(sigar==null) {
            dsu = getDiskSpaceUtilization();
        } else {
             dsu = getDiskSpaceUtilizationUsingSigar();
        }
View Full Code Here

    public void terminate() {
        /* implemented for interface compliance */
    }

    private DiskSpaceUtilization getDiskSpaceUtilizationUsingSigar() {
        DiskSpaceUtilization dsu;
        try {
            /*
            FileSystemUsage fUse = sigar.getFileSystemUsage(File.separator);
            double available = fUse.getFree()*1024;
            double used = fUse.getUsed()*1024;
            double total = fUse.getTotal()*1024;
            */
            double available = sigar.getFileSystemFree(fileSystem)*1024;
            double used = sigar.getFileSystemUsed(fileSystem)*1024;
            double total = sigar.getFileSystemTotal(fileSystem)*1024;
            dsu = new DiskSpaceUtilization(id,
                                           used,
                                           available,
                                           total,
                                           sigar.getFileSystemUsedPercent(fileSystem),
                                           tVals);
        } catch (Exception e) {
            logger.warn("SIGAR exception getting FileSystemUsage", e);
            dsu = new DiskSpaceUtilization(id, -1, tVals);
        }
        return dsu;
    }
View Full Code Here

                    process.destroy();
                }
            }
        }
        double capacity = used + available;
        return (new DiskSpaceUtilization(id,
                                         used,
                                         available,
                                         capacity,
                                         used / capacity,
                                         tVals));
View Full Code Here

     * @return The latest
     * {@link org.rioproject.system.measurable.disk.DiskSpaceUtilization} taken
     * from the compute resource. If not available, return null.
     */
    public DiskSpaceUtilization getDiskSpaceUtilization() {
        DiskSpaceUtilization disk = null;
        for (MeasuredResource m : mRes) {
            if(m instanceof DiskSpaceUtilization) {
                disk = (DiskSpaceUtilization)m;
                break;
            }
View Full Code Here

TOP

Related Classes of org.rioproject.system.measurable.disk.DiskSpaceUtilization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.