Search in sources :

Example 31 with NXCPMessage

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

the class NXCSession method removePackage.

/**
 * Remove agent package from server
 *
 * @param packageId The package ID
 * @throws IOException  if socket or file I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void removePackage(long packageId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_REMOVE_PACKAGE);
    msg.setFieldInt32(NXCPCodes.VID_PACKAGE_ID, (int) packageId);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 32 with NXCPMessage

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

the class NXCSession method unbindAgentTunnel.

/**
 * Unbind agent tunnel to node
 *
 * @param nodeId node ID
 * @throws IOException if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void unbindAgentTunnel(long nodeId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_UNBIND_AGENT_TUNNEL);
    msg.setFieldInt32(NXCPCodes.VID_NODE_ID, (int) nodeId);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 33 with NXCPMessage

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

the class NXCSession method processConsoleCommand.

/**
 * Process console command on server. Output of the command delivered via
 * console listener.
 *
 * @param command command to process
 * @return true if console should be closed (usually after "exit" command)
 * @throws IOException  if socket or file I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public boolean processConsoleCommand(String command) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_ADM_REQUEST);
    msg.setField(NXCPCodes.VID_COMMAND, command);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId(), 3600000);
    return response.isEndOfSequence();
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 34 with NXCPMessage

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

the class NXCSession method getNodePhysicalComponents.

/**
 * Get node's physical components (obtained from ENTITY-MIB).
 *
 * @param nodeId node object identifier
 * @return root component
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public PhysicalComponent getNodePhysicalComponents(long nodeId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_NODE_COMPONENTS);
    msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    return new PhysicalComponent(response, NXCPCodes.VID_COMPONENT_LIST_BASE, null);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 35 with NXCPMessage

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

the class NXCSession method syncUserDatabase.

/**
 * Synchronize user database and subscribe to user change notifications
 *
 * @throws IOException
 *            if socket I/O error occurs
 * @throws NXCException
 *            if NetXMS server returns an error or operation was timed out
 */
public void syncUserDatabase() throws IOException, NXCException {
    syncUserDB.acquireUninterruptibly();
    NXCPMessage msg = newMessage(NXCPCodes.CMD_LOAD_USER_DB);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
    waitForSync(syncUserDB, commandTimeout * 10);
    subscribe(CHANNEL_USERDB);
}
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