Search in sources :

Example 1 with Template

use of org.netxms.client.objects.Template 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 Template

use of org.netxms.client.objects.Template 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 3 with Template

use of org.netxms.client.objects.Template 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 4 with Template

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

the class TableColumns method queryColumns.

/**
 * Query columns from agent
 */
private void queryColumns() {
    if (!MessageDialogHelper.openQuestion(getShell(), "Warning", "Current column definition will be replaced by definition provided by agent. Continue?"))
        return;
    AbstractObject object = ConsoleSharedData.getSession().findObjectById(dci.getNodeId());
    if ((editor.getSourceNode() == 0) && ((object instanceof Template) || (object instanceof Cluster))) {
        ObjectSelectionDialog dlg = new ObjectSelectionDialog(getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
        if (dlg.open() != Window.OK)
            return;
        object = dlg.getSelectedObjects().get(0);
    }
    updateColumnsFromAgent(dci.getName(), true, object);
}
Also used : ObjectSelectionDialog(org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog) AbstractObject(org.netxms.client.objects.AbstractObject) Cluster(org.netxms.client.objects.Cluster) Template(org.netxms.client.objects.Template)

Example 5 with Template

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

the class ObjectBrowser method registerActionValidators.

/**
 * Register object action validators
 */
private void registerActionValidators() {
    List<ActionValidatorData> list = new ArrayList<ActionValidatorData>();
    // Read all registered extensions and create validators
    final IExtensionRegistry reg = Platform.getExtensionRegistry();
    // $NON-NLS-1$
    IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.netxms.ui.eclipse.objectbrowser.objectActionValidators");
    for (int i = 0; i < elements.length; i++) {
        try {
            final ActionValidatorData v = new ActionValidatorData();
            // $NON-NLS-1$
            v.validator = (ObjectActionValidator) elements[i].createExecutableExtension("class");
            // $NON-NLS-1$
            v.priority = safeParseInt(elements[i].getAttribute("priority"));
            list.add(v);
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }
    // Sort handlers by priority
    Collections.sort(list, new Comparator<ActionValidatorData>() {

        @Override
        public int compare(ActionValidatorData arg0, ActionValidatorData arg1) {
            return arg0.priority - arg1.priority;
        }
    });
    actionValidators = new ObjectActionValidator[list.size() + 1];
    int i = 0;
    for (ActionValidatorData v : list) actionValidators[i++] = v.validator;
    // Default validator
    actionValidators[i] = new ObjectActionValidator() {

        @Override
        public int isValidSelectionForMove(SubtreeType subtree, AbstractObject currentObject, AbstractObject parentObject) {
            switch(subtree) {
                case INFRASTRUCTURE:
                    return ((currentObject instanceof Node) || (currentObject instanceof Cluster) || (currentObject instanceof Subnet) || (currentObject instanceof Condition) || (currentObject instanceof Rack) || (currentObject instanceof MobileDevice) || (currentObject instanceof Container) || (currentObject instanceof Sensor)) && ((parentObject instanceof Container) || (parentObject instanceof ServiceRoot)) ? APPROVE : REJECT;
                case TEMPLATES:
                    return ((currentObject instanceof Template) || (currentObject instanceof TemplateGroup)) && ((parentObject instanceof TemplateGroup) || (parentObject instanceof TemplateRoot)) ? APPROVE : REJECT;
                case BUSINESS_SERVICES:
                    return (currentObject instanceof BusinessService) && ((parentObject instanceof BusinessService) || (parentObject instanceof BusinessServiceRoot)) ? APPROVE : REJECT;
                case MAPS:
                    return ((currentObject instanceof NetworkMap) || (currentObject instanceof NetworkMapGroup)) && ((parentObject instanceof NetworkMapGroup) || (parentObject instanceof NetworkMapRoot)) ? APPROVE : REJECT;
                case DASHBOARDS:
                    return (((currentObject instanceof Dashboard) || (currentObject instanceof DashboardGroup)) && ((parentObject instanceof DashboardRoot) || (parentObject instanceof DashboardGroup) || (parentObject instanceof Dashboard))) ? APPROVE : REJECT;
                case POLICIES:
                    return ((currentObject instanceof AgentPolicy) || (currentObject instanceof PolicyGroup)) && ((parentObject instanceof PolicyGroup) || (parentObject instanceof PolicyRoot)) ? APPROVE : REJECT;
                default:
                    return REJECT;
            }
        }
    };
}
Also used : TemplateRoot(org.netxms.client.objects.TemplateRoot) DashboardGroup(org.netxms.client.objects.DashboardGroup) Node(org.netxms.client.objects.Node) DashboardRoot(org.netxms.client.objects.DashboardRoot) ArrayList(java.util.ArrayList) NetworkMapGroup(org.netxms.client.objects.NetworkMapGroup) Dashboard(org.netxms.client.objects.Dashboard) Template(org.netxms.client.objects.Template) SubtreeType(org.netxms.ui.eclipse.objectbrowser.api.SubtreeType) Rack(org.netxms.client.objects.Rack) Container(org.netxms.client.objects.Container) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) MobileDevice(org.netxms.client.objects.MobileDevice) TemplateGroup(org.netxms.client.objects.TemplateGroup) PolicyRoot(org.netxms.client.objects.PolicyRoot) ObjectActionValidator(org.netxms.ui.eclipse.objectbrowser.api.ObjectActionValidator) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry) Condition(org.netxms.client.objects.Condition) PolicyGroup(org.netxms.client.objects.PolicyGroup) Cluster(org.netxms.client.objects.Cluster) NetworkMapRoot(org.netxms.client.objects.NetworkMapRoot) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) ServiceRoot(org.netxms.client.objects.ServiceRoot) BusinessServiceRoot(org.netxms.client.objects.BusinessServiceRoot) BusinessService(org.netxms.client.objects.BusinessService) AgentPolicy(org.netxms.client.objects.AgentPolicy) CoreException(org.eclipse.core.runtime.CoreException) AbstractObject(org.netxms.client.objects.AbstractObject) Subnet(org.netxms.client.objects.Subnet) NetworkMap(org.netxms.client.objects.NetworkMap) Sensor(org.netxms.client.objects.Sensor)

Aggregations

Template (org.netxms.client.objects.Template)14 AbstractObject (org.netxms.client.objects.AbstractObject)11 Cluster (org.netxms.client.objects.Cluster)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 AbstractNode (org.netxms.client.objects.AbstractNode)4 MobileDevice (org.netxms.client.objects.MobileDevice)4 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)4 ObjectSelectionDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog)4 DataCollectionObject (org.netxms.client.datacollection.DataCollectionObject)3 ArrayList (java.util.ArrayList)2 AgentParameter (org.netxms.client.AgentParameter)2 NXCSession (org.netxms.client.NXCSession)2 Script (org.netxms.client.Script)2 EventObject (org.netxms.client.events.EventObject)2 EventTemplate (org.netxms.client.events.EventTemplate)2 AgentPolicy (org.netxms.client.objects.AgentPolicy)2 BusinessService (org.netxms.client.objects.BusinessService)2 BusinessServiceRoot (org.netxms.client.objects.BusinessServiceRoot)2 Condition (org.netxms.client.objects.Condition)2