Search in sources :

Example 26 with DciValue

use of org.netxms.client.datacollection.DciValue in project netxms by netxms.

the class DataCollectionTest method testGetThresholdSummary.

public void testGetThresholdSummary() throws Exception {
    final NXCSession session = connect();
    session.syncObjects();
    final List<ThresholdViolationSummary> list = session.getThresholdSummary(1);
    for (ThresholdViolationSummary s : list) {
        DataCollectionTarget target = (DataCollectionTarget) session.findObjectById(s.getNodeId(), DataCollectionTarget.class);
        System.out.println("* " + target.getObjectName());
        if (s.getDciList().size() > 0) {
            for (DciValue v : s.getDciList()) {
                System.out.println("   + " + v.getDescription());
            }
        } else {
            System.out.println("   --- no threshold violations");
        }
    }
    session.disconnect();
}
Also used : ThresholdViolationSummary(org.netxms.client.datacollection.ThresholdViolationSummary) DataCollectionTarget(org.netxms.client.objects.DataCollectionTarget) DciValue(org.netxms.client.datacollection.DciValue)

Example 27 with DciValue

use of org.netxms.client.datacollection.DciValue in project netxms by netxms.

the class NXCSession method sendLastValuesMsg.

/**
 * Send msg containing list of dci configurations
 *
 * @param msg The NXCPMessage to send
 * @return The DCI values
 * @throws IOException if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public DciValue[] sendLastValuesMsg(NXCPMessage msg) throws IOException, NXCException {
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_ITEMS);
    DciValue[] list = new DciValue[count];
    long base = NXCPCodes.VID_DCI_VALUES_BASE;
    for (int i = 0; i < count; i++, base += 10) {
        list[i] = (DciValue) new SimpleDciValue(response, base);
    }
    return list;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) DciValue(org.netxms.client.datacollection.DciValue) SimpleDciValue(org.netxms.client.datacollection.SimpleDciValue) SimpleDciValue(org.netxms.client.datacollection.SimpleDciValue) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 28 with DciValue

use of org.netxms.client.datacollection.DciValue in project netxms by netxms.

the class LastValuesFragment method showTableLastValue.

/**
 * Show last value for table DCI
 *
 * @param idList	list of DCI to graph
 * @return
 */
private boolean showTableLastValue(ArrayList<Long> idList) {
    if (idList.size() > 0) {
        DciValue value = (DciValue) adapter.getItem(idList.get(0).intValue());
        Intent newIntent = new Intent(getActivity(), TableLastValues.class);
        newIntent.putExtra("nodeId", (int) nodeId);
        newIntent.putExtra("dciId", (int) value.getId());
        newIntent.putExtra("description", value.getDescription());
        startActivity(newIntent);
    }
    return true;
}
Also used : DciValue(org.netxms.client.datacollection.DciValue) Intent(android.content.Intent)

Example 29 with DciValue

use of org.netxms.client.datacollection.DciValue in project netxms by netxms.

the class LastValuesFragment method drawGraph.

/**
 * Draw graph for the specified time slot
 *
 * @param secsBack	seconds back since current time
 * @param idList	list of DCI to graph
 * @return	Always true
 */
private boolean drawGraph(long secsBack, ArrayList<Long> idList) {
    if (idList.size() > 0) {
        ArrayList<Integer> nodeIdList = new ArrayList<Integer>();
        ArrayList<Integer> dciIdList = new ArrayList<Integer>();
        ArrayList<Integer> colorList = new ArrayList<Integer>();
        ArrayList<Integer> lineWidthList = new ArrayList<Integer>();
        ArrayList<String> nameList = new ArrayList<String>();
        // Set values
        int count = 0;
        for (int i = 0; i < idList.size() && count < MAX_COLORS; i++) {
            DciValue value = (DciValue) adapter.getItem(idList.get(i).intValue());
            if (value != null && value.getDcObjectType() == DataCollectionObject.DCO_TYPE_ITEM) {
                nodeIdList.add((int) nodeId);
                dciIdList.add((int) value.getId());
                colorList.add(DEFAULT_COLORS[count]);
                lineWidthList.add(3);
                nameList.add(value.getDescription());
                count++;
            }
        }
        // Pass them to activity
        if (count > 0) {
            Intent newIntent = new Intent(getActivity(), DrawGraph.class);
            if (count == 1)
                newIntent.putExtra("graphTitle", nameList.get(0));
            newIntent.putExtra("numGraphs", count);
            newIntent.putIntegerArrayListExtra("nodeIdList", nodeIdList);
            newIntent.putIntegerArrayListExtra("dciIdList", dciIdList);
            newIntent.putIntegerArrayListExtra("colorList", colorList);
            newIntent.putIntegerArrayListExtra("lineWidthList", lineWidthList);
            newIntent.putStringArrayListExtra("nameList", nameList);
            newIntent.putExtra("timeFrom", System.currentTimeMillis() - secsBack * 1000);
            newIntent.putExtra("timeTo", System.currentTimeMillis());
            startActivity(newIntent);
        }
    }
    return true;
}
Also used : ArrayList(java.util.ArrayList) DciValue(org.netxms.client.datacollection.DciValue) Intent(android.content.Intent)

Example 30 with DciValue

use of org.netxms.client.datacollection.DciValue in project netxms by netxms.

the class LastValuesFragment method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    android.view.MenuInflater inflater = getActivity().getMenuInflater();
    DciValue value = (DciValue) adapter.getItem(((AdapterView.AdapterContextMenuInfo) menuInfo).position);
    if (value != null) {
        switch(value.getDcObjectType()) {
            case DataCollectionObject.DCO_TYPE_ITEM:
                inflater.inflate(R.menu.last_values_actions, menu);
                break;
            case DataCollectionObject.DCO_TYPE_TABLE:
                inflater.inflate(R.menu.last_values_table_actions, menu);
                break;
        }
    }
}
Also used : MenuInflater(android.view.MenuInflater) AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) DciValue(org.netxms.client.datacollection.DciValue)

Aggregations

DciValue (org.netxms.client.datacollection.DciValue)37 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 ArrayList (java.util.ArrayList)9 SelectDciDialog (org.netxms.ui.eclipse.datacollection.dialogs.SelectDciDialog)8 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)7 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)5 AbstractObject (org.netxms.client.objects.AbstractObject)4 Intent (android.content.Intent)3 NXCSession (org.netxms.client.NXCSession)3 ChartDciConfig (org.netxms.client.datacollection.ChartDciConfig)3 DataCollectionObject (org.netxms.client.datacollection.DataCollectionObject)3 SimpleDciValue (org.netxms.client.datacollection.SimpleDciValue)3 SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)3 CoreException (org.eclipse.core.runtime.CoreException)2 PartInitException (org.eclipse.ui.PartInitException)2 NXCPMessage (org.netxms.base.NXCPMessage)2 DataCollectionTarget (org.netxms.client.objects.DataCollectionTarget)2 DciIdMatchingData (org.netxms.ui.eclipse.dashboard.dialogs.helpers.DciIdMatchingData)2 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)2