Search in sources :

Example 6 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class SelectInternalParamDlg method fillParameterList.

/**
 * Fill parameter list
 */
protected void fillParameterList() {
    ArrayList<AgentParameter> list = new ArrayList<AgentParameter>(10);
    // Internal parameters common for all nodes
    // $NON-NLS-1$
    list.add(new AgentParameter("ChildStatus(*)", Messages.get().SelectInternalParamDlg_DCI_ChildObjectStatus, DataType.INT32));
    // $NON-NLS-1$
    list.add(new AgentParameter("ConditionStatus(*)", Messages.get().SelectInternalParamDlg_DCI_ConditionStatus, DataType.INT32));
    // $NON-NLS-1$
    list.add(new AgentParameter("Dummy", Messages.get().SelectInternalParamDlg_DCI_Dummy, DataType.INT32));
    // $NON-NLS-1$
    list.add(new AgentParameter("Status", Messages.get().SelectInternalParamDlg_DCI_Status, DataType.INT32));
    // $NON-NLS-1$
    list.add(new AgentParameter("PingTime", Messages.get().SelectInternalParamDlg_PingTime_PrimaryIP, DataType.UINT32));
    // $NON-NLS-1$
    list.add(new AgentParameter("PingTime(*)", Messages.get().SelectInternalParamDlg_PingTime_Instance, DataType.UINT32));
    if ((object instanceof Template) || (object instanceof AbstractNode)) {
        // $NON-NLS-1$
        list.add(new AgentParameter("Net.IP.NextHop(*)", Messages.get().SelectInternalParamDlg_DCI_NextHop, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("NetSvc.ResponseTime(*)", "Network service {instance} response time", DataType.UINT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("ReceivedSNMPTraps", "Total SNMP traps received", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("ReceivedSyslogMessages", "Total syslog messages received", DataType.UINT64));
    }
    if ((object instanceof Template) || ((object instanceof AbstractNode) && ((AbstractNode) object).hasAgent())) {
        // $NON-NLS-1$
        list.add(new AgentParameter("AgentStatus", Messages.get().SelectInternalParamDlg_DCI_AgentStatus, DataType.INT32));
    }
    if ((object instanceof Template) || ((object instanceof AbstractNode) && ((AbstractNode) object).isManagementServer())) {
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDBWriterQueueSize", Messages.get().SelectInternalParamDlg_DCI_AvgDBWriterQueue, DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDBWriterQueueSize.IData", "Database writer's request queue (DCI data) for last minute", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDBWriterQueueSize.Other", "Database writer's request queue (other queries) for last minute", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDBWriterQueueSize.RawData", "Database writer's request queue (raw DCI data) for last minute", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDCIQueuingTime", Messages.get().SelectInternalParamDlg_DCI_AvgDCIQueueTime, DataType.UINT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageDCPollerQueueSize", Messages.get().SelectInternalParamDlg_DCI_AvgDCQueue, DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageSyslogProcessingQueueSize", Messages.get().SelectInternalParamDlg_SyslogProcessingQueue, DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.AverageSyslogWriterQueueSize", Messages.get().SelectInternalParamDlg_SyslogWriterQueue, DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DB.Queries.Failed", "Failed DB queries", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DB.Queries.LongRunning", "Long running DB queries", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DB.Queries.NonSelect", "Non-SELECT DB queries", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DB.Queries.Select", "SELECT DB queries", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DB.Queries.Total", "Total DB queries", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DBWriter.Requests.IData", "DB writer requests (DCI data)", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DBWriter.Requests.Other", "DB writer requests (other queries)", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.DBWriter.Requests.RawData", "DB writer requests (raw DCI data)", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ReceivedSNMPTraps", "SNMP traps received since server start", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ReceivedSyslogMessages", "Syslog messages received since server start", DataType.UINT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.ActiveRequests(*)", "Thread pool {instance}: active requests", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.CurrSize(*)", "Thread pool {instance}: current size", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.Load(*)", "Thread pool {instance}: current load", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.LoadAverage(*)", "Thread pool {instance}: load average (1 minute)", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.LoadAverage5(*)", "Thread pool {instance}: load average (5 minutes)", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.LoadAverage15(*)", "Thread pool {instance}: load average (15 minutes)", DataType.FLOAT));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.MaxSize(*)", "Thread pool {instance}: maximum size", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.MinSize(*)", "Thread pool {instance}: minimum size", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.ScheduledRequests(*)", "Thread pool {instance}: scheduled requests", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.ThreadPool.Usage(*)", "Thread pool {instance}: usage", DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("Server.TotalEventsProcessed", Messages.get().SelectInternalParamDlg_DCI_TotalEventsProcessed, DataType.UINT32));
    }
    if ((object instanceof Template) || (object instanceof MobileDevice)) {
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.BatteryLevel", Messages.get().SelectInternalParamDlg_DCI_BatteryLevel, DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.DeviceId", Messages.get().SelectInternalParamDlg_DCI_DeviceID, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.LastReportTime", Messages.get().SelectInternalParamDlg_DCI_LastReportTime, DataType.INT64));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.Model", Messages.get().SelectInternalParamDlg_DCI_Model, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.OS.Name", Messages.get().SelectInternalParamDlg_DCI_OSName, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.OS.Version", Messages.get().SelectInternalParamDlg_DCI_OSVersion, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.SerialNumber", Messages.get().SelectInternalParamDlg_DCI_SerialNumber, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.Vendor", Messages.get().SelectInternalParamDlg_DCI_Vendor, DataType.STRING));
        // $NON-NLS-1$
        list.add(new AgentParameter("MobileDevice.UserId", Messages.get().SelectInternalParamDlg_DCI_UserID, DataType.STRING));
    }
    if ((object instanceof Template) || ((object instanceof AbstractNode) && ((AbstractNode) object).isWirelessController())) {
        // $NON-NLS-1$
        list.add(new AgentParameter("WirelessController.AdoptedAPCount", Messages.get().SelectInternalParamDlg_AdoptedAPs, DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("WirelessController.TotalAPCount", Messages.get().SelectInternalParamDlg_TotalAPs, DataType.INT32));
        // $NON-NLS-1$
        list.add(new AgentParameter("WirelessController.UnadoptedAPCount", Messages.get().SelectInternalParamDlg_UnadoptedAPs, DataType.INT32));
    }
    viewer.setInput(list.toArray());
}
Also used : MobileDevice(org.netxms.client.objects.MobileDevice) AbstractNode(org.netxms.client.objects.AbstractNode) ArrayList(java.util.ArrayList) AgentParameter(org.netxms.client.AgentParameter) Template(org.netxms.client.objects.Template)

Example 7 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class SelectDciDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    dialogArea.setLayout(new FillLayout());
    if (fixedNode == 0) {
        splitter = new SashForm(dialogArea, SWT.HORIZONTAL);
        objectTree = new ObjectTree(splitter, SWT.BORDER, ObjectTree.NONE, null, ObjectSelectionDialog.createNodeSelectionFilter(true), true, false);
        // $NON-NLS-1$
        String text = settings.get("SelectDciDialog.Filter");
        if (text != null)
            objectTree.setFilter(text);
    }
    dciList = new DciList(null, (fixedNode == 0) ? splitter : dialogArea, SWT.BORDER, null, "SelectDciDialog.dciList", dcObjectType, allowSingleSelection ? SWT.NONE : SWT.MULTI, // $NON-NLS-1$
    allowNoValueObjects);
    dciList.setDcObjectType(dcObjectType);
    dciList.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    if (fixedNode == 0) {
        try {
            int[] weights = new int[2];
            // $NON-NLS-1$
            weights[0] = settings.getInt("SelectDciDialog.weight1");
            // $NON-NLS-1$
            weights[1] = settings.getInt("SelectDciDialog.weight2");
            splitter.setWeights(weights);
        } catch (NumberFormatException e) {
            splitter.setWeights(new int[] { 30, 70 });
        }
        objectTree.getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                AbstractObject object = objectTree.getFirstSelectedObject2();
                if ((object != null) && ((object instanceof AbstractNode) || (object instanceof MobileDevice) || (object instanceof Cluster) || (allowTemplateItems && (object instanceof Template) || (object instanceof Sensor)))) {
                    dciList.setNode(object);
                } else {
                    dciList.setNode(null);
                }
            }
        });
        objectTree.setFocus();
    } else {
        dciList.setNode(((NXCSession) ConsoleSharedData.getSession()).findObjectById(fixedNode));
    }
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) AbstractNode(org.netxms.client.objects.AbstractNode) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Cluster(org.netxms.client.objects.Cluster) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) FillLayout(org.eclipse.swt.layout.FillLayout) DciList(org.netxms.ui.eclipse.datacollection.widgets.DciList) Template(org.netxms.client.objects.Template) SashForm(org.eclipse.swt.custom.SashForm) MobileDevice(org.netxms.client.objects.MobileDevice) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) ObjectTree(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectTree) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) AbstractObject(org.netxms.client.objects.AbstractObject) Sensor(org.netxms.client.objects.Sensor)

Example 8 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class DataCollectionObjectPropertyTester method test.

/* (non-Javadoc)
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
	 */
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (!(receiver instanceof DataCollectionObject))
        return false;
    if (// $NON-NLS-1$
    property.equals("isClusterObject")) {
        NXCSession session = (NXCSession) ConsoleSharedData.getSession();
        AbstractObject owner = session.findObjectById(((DataCollectionObject) receiver).getNodeId());
        if (owner instanceof Cluster)
            return true;
        if (owner instanceof AbstractNode) {
            for (AbstractObject o : owner.getParentsAsArray()) {
                if (o instanceof Cluster)
                    return true;
            }
        }
        return false;
    }
    if (// $NON-NLS-1$
    property.equals("isTemplateObject")) {
        NXCSession session = (NXCSession) ConsoleSharedData.getSession();
        AbstractObject owner = session.findObjectById(((DataCollectionObject) receiver).getNodeId());
        return (owner instanceof Template);
    }
    return false;
}
Also used : NXCSession(org.netxms.client.NXCSession) AbstractNode(org.netxms.client.objects.AbstractNode) DataCollectionObject(org.netxms.client.datacollection.DataCollectionObject) AbstractObject(org.netxms.client.objects.AbstractObject) Cluster(org.netxms.client.objects.Cluster) Template(org.netxms.client.objects.Template)

Example 9 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class CreateSnmpDci method run.

/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {
    if (objects.size() == 0)
        return;
    MibObject mibObject = MibCache.findObject(objects.get(0).getName(), false);
    String description = (mibObject != null) ? mibObject.getName() : objects.get(0).getName();
    if (objects.size() > 1)
        // $NON-NLS-1$
        description += " @@instance@@";
    final CreateSnmpDciDialog dlg = new CreateSnmpDciDialog(shell, description);
    if (dlg.open() != Window.OK)
        return;
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    final List<SnmpValue> values = new ArrayList<SnmpValue>(objects);
    // Get set of nodes
    final Set<AbstractNode> nodes = new HashSet<AbstractNode>();
    for (SnmpValue v : values) {
        AbstractNode node = (AbstractNode) session.findObjectById(v.getNodeId(), AbstractNode.class);
        if (node != null) {
            nodes.add(node);
        }
    }
    // Check what nodes requires DCI list lock
    final Map<Long, Boolean> lockRequired = new HashMap<Long, Boolean>(nodes.size());
    final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    for (AbstractNode n : nodes) {
        IViewReference ref = page.findViewReference(DataCollectionEditor.ID, Long.toString(n.getObjectId()));
        lockRequired.put(n.getObjectId(), !((ref != null) && (ref.getView(false) != null)));
    }
    new ConsoleJob(Messages.get().CreateSnmpDci_JobTitle, viewPart, Activator.PLUGIN_ID, null) {

        @Override
        protected String getErrorMessage() {
            return Messages.get().CreateSnmpDci_ErrorMessage;
        }

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            monitor.beginTask(Messages.get(getDisplay()).CreateSnmpDci_TaskTitle, values.size());
            for (SnmpValue v : values) {
                // $NON-NLS-1$
                final String description = dlg.getDescription().replaceAll("@@instance@@", Long.toString(v.getObjectId().getIdFromPos(v.getObjectId().getLength() - 1)));
                createDci(session, v, description, dlg.getPollingInterval(), dlg.getRetentionTime(), dlg.getDeltaCalculation(), lockRequired);
                monitor.worked(1);
            }
            monitor.done();
        }
    }.start();
}
Also used : NXCSession(org.netxms.client.NXCSession) AbstractNode(org.netxms.client.objects.AbstractNode) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) NXCException(org.netxms.client.NXCException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SnmpValue(org.netxms.client.snmp.SnmpValue) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) MibObject(org.netxms.client.snmp.MibObject) CreateSnmpDciDialog(org.netxms.ui.eclipse.datacollection.dialogs.CreateSnmpDciDialog) HashSet(java.util.HashSet)

Example 10 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class DataCollectionEditor method createItem.

/**
 * Create new data collection item
 */
private void createItem() {
    DataCollectionItem dci = new DataCollectionItem(dciConfig, 0);
    if ((object instanceof AbstractNode) && !((AbstractNode) object).hasAgent()) {
        if (((AbstractNode) object).hasSnmpAgent()) {
            dci.setOrigin(DataCollectionObject.SNMP);
        } else {
            dci.setOrigin(DataCollectionObject.INTERNAL);
        }
    }
    viewer.add(dci);
    viewer.setSelection(new StructuredSelection(dci), true);
    actionEdit.run();
}
Also used : AbstractNode(org.netxms.client.objects.AbstractNode) DataCollectionItem(org.netxms.client.datacollection.DataCollectionItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Aggregations

AbstractNode (org.netxms.client.objects.AbstractNode)47 AbstractObject (org.netxms.client.objects.AbstractObject)27 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 NXCSession (org.netxms.client.NXCSession)13 ArrayList (java.util.ArrayList)12 Cluster (org.netxms.client.objects.Cluster)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 Composite (org.eclipse.swt.widgets.Composite)6 PartInitException (org.eclipse.ui.PartInitException)6 MobileDevice (org.netxms.client.objects.MobileDevice)6 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)6 NXCException (org.netxms.client.NXCException)5 Interface (org.netxms.client.objects.Interface)5 Sensor (org.netxms.client.objects.Sensor)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 DataCollectionItem (org.netxms.client.datacollection.DataCollectionItem)4 Subnet (org.netxms.client.objects.Subnet)4 ISelection (org.eclipse.jface.viewers.ISelection)3