Package nz.co.abrahams.asithappens.storage

Examples of nz.co.abrahams.asithappens.storage.DataPoint


       
        point = new DataPoint[1];
        currentTime = System.currentTimeMillis();
       
        try {
            point[0] = new DataPoint(currentTime, snmp.getProcessorLoad(processor));
        } catch (SNMPException e) {
            //e.printStackTrace();
            point[0] = new DataPoint(currentTime);
            logger.warn("Timeout fetching processor load");
        }
       
        return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
    }
View Full Code Here


       
        point = new DataPoint[1];
        currentTime = System.currentTimeMillis();
       
        try {
            point[0] = new DataPoint(currentTime, snmp.getCiscoMemoryUsed(memoryIndex));
        } catch (SNMPException e) {
            point[0] = new DataPoint(currentTime);
            logger.warn("Timeout fetching storage used");
        }
       
        return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
    }
View Full Code Here

       
        point = new DataPoint[1];
        currentTime = System.currentTimeMillis();
       
        try {
            point[0] = new DataPoint(currentTime, snmp.getCiscoProcessorLoad());
        } catch (SNMPException e) {
            point[0] = new DataPoint(currentTime);
            logger.warn("Timeout fetching processor load");
        }
       
        return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
    }
View Full Code Here

               
                foundMatch = false;
                for (int set = 0; set < data.size(); set++) {
                    if ( flow.matches(flows[set], options) ) {
                        foundMatch = true;
                        data.elementAt(set).add(new DataPoint(flow.timestamp, flow.length * 8));
                        logger.debug("Adding data to flow" + set + ": " + flow.timestamp + " " + flow.length);
                    }
                }
               
                if ( foundMatch == false ) {
                    temporaryFlows = new Flow[data.size() + 1];
                    System.arraycopy(flows, 0, temporaryFlows, 0, data.size());
                    flows = temporaryFlows;
                    flows[data.size()] = flow;
                   
                    logger.debug("Adding new data set " + flow.printable(options));
                    addSet(flow.printable(options));
                    data.elementAt(data.size() - 1).add(new DataPoint(flow.timestamp, flow.length * 8));
                }
            }
            /*
            if ( firstPacket ) {
                startTime = flow.timestamp;
View Full Code Here

     * @return  a text dump of the data
     */
    public String flowDescriptions() {
        StringBuilder returnBuffer;
        Iterator<DataPoint> iterator;
        DataPoint point;
       
        returnBuffer = new StringBuilder();
        returnBuffer.append(options.toString());
        for (int set = 0; set < data.size(); set++ ) {
            returnBuffer.append("\nFlow " + set + ": "
                    + flows[set].toString() + " (size=" + flows[set].length + ")\n");
            iterator = data.elementAt(set).iterator();
            while ( iterator.hasNext() ) {
                point = iterator.next();
                returnBuffer.append("  " + point.getValue() + "\n");
            }
        }
        return returnBuffer.toString();
    }
View Full Code Here

                foundMatch = false;
                for (int set = 0; set < dataSets.getDataSetCount(); set++) {
                    if ( flow.matches(dataSets.flows[set], options) ) {
                        foundMatch = true;
                        dataSets.getDataSet(set).add(new DataPoint(flow.timestamp, flow.length * 8));
                        logger.debug("Adding data to flow" + set + ": " + flow.timestamp + " " + flow.length);
                    }
                }
               
                if ( foundMatch == false ) {
                    temporaryFlows = new Flow[dataSets.getDataSetCount() + 1];
                    System.arraycopy(dataSets.flows, 0, temporaryFlows, 0, dataSets.getDataSetCount());
                    dataSets.flows = temporaryFlows;
                    dataSets.flows[dataSets.getDataSetCount()] = flow;
                   
                    logger.debug("Adding new data set " + flow.printable(options));
                    dataSets.addSet(flow.printable(options));
                    dataSets.getDataSet(dataSets.getDataSetCount() - 1).add(new DataPoint(flow.timestamp, flow.length * 8));
                }
            }
            /*
            if ( firstPacket ) {
                startTime = flow.timestamp;
View Full Code Here

        point = new DataPoint[1];
        currentTime = System.currentTimeMillis();
       
        try {
            if ( memoryType == UCD_MEMORY_REAL )
                point[0] = new DataPoint(currentTime, (totalMemory - snmp.getUCDMemAvailReal() ) * 1000);
            else if ( memoryType == UCD_MEMORY_SWAP )
                point[0] = new DataPoint(currentTime, (totalMemory - snmp.getUCDMemAvailSwap() ) * 1000);
        } catch (SNMPException e) {
            point[0] = new DataPoint(currentTime);
            logger.warn("Timeout fetching processor load");
        }
       
        return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
    }
View Full Code Here

            }
           
        }
        points = new DataPoint[setCount];
        for (int set = 0; set < setCount; set++ ) {
            points[set] = new DataPoint(currentTime, 0);
        }
        for (int index = 0; index < table.length; index++ ) {
            byteDifference = table[index].bytes - flows.elementAt(tableMappings[index]).bytes;
            byteDifference = Math.max(byteDifference, 0);
            headingIndex = setMappings.elementAt(tableMappings[index]);
View Full Code Here

            else {
                responseTime = timeout;
                //responseTime = System.currentTimeMillis() - startTime;
                //System.out.println("Timeout " + responseTime);
            }
            point[0] = new DataPoint(startTime, (double)responseTime);
    
            return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
        }
        catch (IOException e) {
            point[0] = new DataPoint(startTime, timeout);
        }
        return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
    }
View Full Code Here

            Thread.sleep(timeout);
           
            for (int i = 0; i < resultList.size(); i++) {
                responseItem = resultList.elementAt(i);
                if ( id == responseItem.id && sequence == responseItem.sequence ) {
                    point[0] = new DataPoint(currentTime, responseItem.value);
                    resultList.removeElementAt(i);
                    i = resultList.size() + 1;
                }
            }
            if ( point[0] == null )
                point[0] = new DataPoint(currentTime, timeout);
            sequence++;
            return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
        } catch (InterruptedException e) {
            e.printStackTrace();
            point[0] = new DataPoint(currentTime, 0);
            return new DataCollectorResponse(point, new String[0], dataType.initialSetCount());
        }
    }
View Full Code Here

TOP

Related Classes of nz.co.abrahams.asithappens.storage.DataPoint

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.