Search in sources :

Example 1 with AgentParameter

use of org.netxms.client.AgentParameter 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 2 with AgentParameter

use of org.netxms.client.AgentParameter in project netxms by netxms.

the class AgentParameterComparator method compare.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
	 */
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    int result;
    AgentParameter p1 = (AgentParameter) e1;
    AgentParameter p2 = (AgentParameter) e2;
    switch(// $NON-NLS-1$
    (Integer) ((SortableTableViewer) viewer).getTable().getSortColumn().getData("ID")) {
        case AbstractSelectParamDlg.COLUMN_NAME:
            result = p1.getName().compareToIgnoreCase(p2.getName());
            break;
        case AbstractSelectParamDlg.COLUMN_TYPE:
            result = DataCollectionDisplayInfo.getDataTypeName(p1.getDataType()).compareTo(DataCollectionDisplayInfo.getDataTypeName(p2.getDataType()));
            break;
        case AbstractSelectParamDlg.COLUMN_DESCRIPTION:
            result = p1.getDescription().compareToIgnoreCase(p2.getDescription());
            break;
        default:
            result = 0;
            break;
    }
    return (((SortableTableViewer) viewer).getTable().getSortDirection() == SWT.UP) ? result : -result;
}
Also used : SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) AgentParameter(org.netxms.client.AgentParameter)

Example 3 with AgentParameter

use of org.netxms.client.AgentParameter in project netxms by netxms.

the class SelectAgentParamDlg method querySelectedParameter.

/**
 * Query current value of selected parameter
 */
protected void querySelectedParameter() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.size() != 1)
        return;
    // Opens Object Selection Dialog if object is not chosen
    if (queryObject instanceof Template) {
        final ObjectSelectionDialog sDlg = new ObjectSelectionDialog(getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
        sDlg.enableMultiSelection(false);
        if (sDlg.open() == Window.OK) {
            queryObject = sDlg.getSelectedObjects().get(0);
        }
    }
    AgentParameter p = (AgentParameter) selection.getFirstElement();
    String n;
    if (// $NON-NLS-1$
    p.getName().contains("(*)")) {
        InputDialog dlg = new InputDialog(getShell(), Messages.get().SelectAgentParamDlg_InstanceTitle, Messages.get().SelectAgentParamDlg_InstanceMessage, "", // $NON-NLS-1$
        null);
        if (dlg.open() != Window.OK)
            return;
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        n = p.getName().replace("(*)", "(" + dlg.getValue() + ")");
    } else {
        n = p.getName();
    }
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    final String name = n;
    new ConsoleJob(Messages.get().SelectAgentParamDlg_QueryJobTitle, null, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            final String value = session.queryParameter(queryObject.getObjectId(), origin, name);
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    MessageDialogHelper.openInformation(getShell(), Messages.get().SelectAgentParamDlg_CurrentValueTitle, String.format(Messages.get().SelectAgentParamDlg_CurrentValue, value));
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            return Messages.get().SelectAgentParamDlg_QueryError;
        }
    }.start();
}
Also used : ObjectSelectionDialog(org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) InputDialog(org.eclipse.jface.dialogs.InputDialog) NXCSession(org.netxms.client.NXCSession) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) AgentParameter(org.netxms.client.AgentParameter) Template(org.netxms.client.objects.Template)

Aggregations

AgentParameter (org.netxms.client.AgentParameter)3 Template (org.netxms.client.objects.Template)2 ArrayList (java.util.ArrayList)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 NXCSession (org.netxms.client.NXCSession)1 AbstractNode (org.netxms.client.objects.AbstractNode)1 MobileDevice (org.netxms.client.objects.MobileDevice)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 ObjectSelectionDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1