Search in sources :

Example 91 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method modifyAction.

/**
 * Modify server action
 *
 * @param action Action object
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void modifyAction(ServerAction action) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_MODIFY_ACTION);
    action.fillMessage(msg);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 92 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getThresholdSummary.

/**
 * Get threshold violation summary for all nodes under given parent object. Parent object could
 * be container, subnet, zone, entire network, or infrastructure service root.
 *
 * @param objectId parent object ID
 * @return list of threshold violation summary objects for all nodes below given root
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<ThresholdViolationSummary> getThresholdSummary(final long objectId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_THRESHOLD_SUMMARY);
    msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) objectId);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    List<ThresholdViolationSummary> list = new ArrayList<ThresholdViolationSummary>();
    long varId = NXCPCodes.VID_THRESHOLD_BASE;
    while (response.getFieldAsInt64(varId) != 0) {
        final ThresholdViolationSummary t = new ThresholdViolationSummary(response, varId);
        list.add(t);
        varId += 50 * t.getDciList().size() + 2;
    }
    return list;
}
Also used : ThresholdViolationSummary(org.netxms.client.datacollection.ThresholdViolationSummary) NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList)

Example 93 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getSnmpTrapsConfigurationSummary.

/**
 * Get summary of SNMP trap mapping. Trap configurations returned without parameter mapping.
 *
 * @return List of SnmpTrap objects
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<SnmpTrap> getSnmpTrapsConfigurationSummary() throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_TRAP_CFG_RO);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_TRAPS);
    List<SnmpTrap> list = new ArrayList<SnmpTrap>(count);
    long varId = NXCPCodes.VID_TRAP_INFO_BASE;
    for (int i = 0; i < count; i++) {
        list.add(new SnmpTrap(response, varId));
        varId += 10;
    }
    return list;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) SnmpTrap(org.netxms.client.snmp.SnmpTrap) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 94 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method updateSchedule.

public void updateSchedule(ScheduledTask task) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_UPDATE_SCHEDULE);
    task.fillMessage(msg);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 95 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getNodeWinPerfObjects.

/**
 * Get list of available Windows performance objects. Returns empty list if node
 * does is not a Windows node or does not have WinPerf subagent installed.
 *
 * @param nodeId node object ID
 * @return list of available Windows performance objects
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<WinPerfObject> getNodeWinPerfObjects(long nodeId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_WINPERF_OBJECTS);
    msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    return WinPerfObject.createListFromMessage(response);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Aggregations

NXCPMessage (org.netxms.base.NXCPMessage)274 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)69 AccessPoint (org.netxms.client.objects.AccessPoint)66 ArrayList (java.util.ArrayList)44 IOException (java.io.IOException)8 HashMap (java.util.HashMap)7 DciSummaryTable (org.netxms.client.datacollection.DciSummaryTable)7 MappingTable (org.netxms.client.mt.MappingTable)7 NXCPException (org.netxms.base.NXCPException)5 UnknownHostException (java.net.UnknownHostException)3 GeneralSecurityException (java.security.GeneralSecurityException)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)3 UUID (java.util.UUID)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)3 MessageProcessingResult (com.radensolutions.reporting.service.MessageProcessingResult)2 FileInputStream (java.io.FileInputStream)2 Socket (java.net.Socket)2 SignatureException (java.security.SignatureException)2 Date (java.util.Date)2 List (java.util.List)2