use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getSupportedTables.
/**
* Get list of tables supported by agent running on given node.
*
* @param nodeId Node ID
* @return List of tables supported by agent
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public List<AgentTable> getSupportedTables(long nodeId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_PARAMETER_LIST);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
// Indicates request for table list
msg.setFieldInt16(NXCPCodes.VID_FLAGS, 0x02);
msg.setFieldInt16(NXCPCodes.VID_DCI_SOURCE_TYPE, DataCollectionObject.AGENT);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_TABLES);
List<AgentTable> list = new ArrayList<AgentTable>(count);
long baseId = NXCPCodes.VID_TABLE_LIST_BASE;
for (int i = 0; i < count; i++) {
list.add(new AgentTable(response, baseId));
baseId += response.getFieldAsInt64(baseId);
}
return list;
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method deleteImage.
/**
* Delete an image
*
* @param image The image to delete
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public void deleteImage(LibraryImage image) throws IOException, NXCException {
if (image.isProtected()) {
throw new NXCException(RCC.INVALID_REQUEST);
}
final NXCPMessage msg = newMessage(NXCPCodes.CMD_DELETE_IMAGE);
image.fillMessage(msg);
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method findConnectionPoint.
/**
* Find connection point (either directly connected or most close known
* interface on a switch) for given MAC address. Will return null if
* connection point information cannot be found.
*
* @param macAddr MAC address
* @return connection point information or null
* @throws IOException if socket or file I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public ConnectionPoint findConnectionPoint(MacAddress macAddr) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_FIND_MAC_LOCATION);
msg.setField(NXCPCodes.VID_MAC_ADDR, macAddr.getValue());
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return response.isFieldPresent(NXCPCodes.VID_CONNECTION_TYPE) ? new ConnectionPoint(response) : null;
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method createSnmpTrapConfiguration.
/**
* Create new trap configuration record.
*
* @return ID of new record
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public long createSnmpTrapConfiguration() throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_CREATE_TRAP);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return response.getFieldAsInt64(NXCPCodes.VID_TRAP_ID);
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method findConnectionPoint.
/**
* Find connection point (either directly connected or most close known
* interface on a switch) for given node or interface object. Will return
* null if connection point information cannot be found.
*
* @param objectId Node or interface object ID
* @return connection point information or null
* @throws IOException if socket or file I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public ConnectionPoint findConnectionPoint(long objectId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_FIND_NODE_CONNECTION);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) objectId);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return response.isFieldPresent(NXCPCodes.VID_CONNECTION_TYPE) ? new ConnectionPoint(response) : null;
}
Aggregations