Search in sources :

Example 51 with NXCPMessage

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

the class NXCSession method getObjectTools.

/**
 * Get list of configured object tools
 *
 * @return List of object tools
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<ObjectTool> getObjectTools() throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_OBJECT_TOOLS);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_TOOLS);
    final List<ObjectTool> list = new ArrayList<ObjectTool>(count);
    long varId = NXCPCodes.VID_OBJECT_TOOLS_BASE;
    for (int i = 0; i < count; i++) {
        list.add(new ObjectTool(response, varId));
        varId += 10000;
    }
    return list;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint) ObjectTool(org.netxms.client.objecttools.ObjectTool)

Example 52 with NXCPMessage

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

the class NXCSession method removeSchedule.

public void removeSchedule(long scheduleId) throws NXCException, IOException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_REMOVE_SCHEDULE);
    msg.setFieldInt32(NXCPCodes.VID_SCHEDULED_TASK_ID, (int) scheduleId);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 53 with NXCPMessage

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

the class NXCSession method terminateAlarm.

/**
 * Terminate alarm.
 *
 * @param alarmId Identifier of alarm to be terminated.
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void terminateAlarm(final long alarmId) throws IOException, NXCException {
    NXCPMessage msg = newMessage(NXCPCodes.CMD_TERMINATE_ALARM);
    msg.setFieldInt32(NXCPCodes.VID_ALARM_ID, (int) alarmId);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 54 with NXCPMessage

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

the class NXCSession method getServerStats.

/**
 * Get server stats. Returns set of named properties. The following
 * properties could be found in result set: String: VERSION Integer: UPTIME,
 * SESSION_COUNT, DCI_COUNT, OBJECT_COUNT, NODE_COUNT, PHYSICAL_MEMORY_USED,
 * VIRTUAL_MEMORY_USED, QSIZE_CONDITION_POLLER, QSIZE_CONF_POLLER,
 * QSIZE_DCI_POLLER, QSIZE_DBWRITER, QSIZE_EVENT, QSIZE_DISCOVERY,
 * QSIZE_NODE_POLLER, QSIZE_ROUTE_POLLER, QSIZE_STATUS_POLLER,
 * QSIZE_DCI_CACHE_LOADER, ALARM_COUNT
 * long[]: ALARMS_BY_SEVERITY
 *
 * @return Server stats as set of named properties.
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public Map<String, Object> getServerStats() throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_SERVER_STATS);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    Map<String, Object> stats = new HashMap<String, Object>();
    stats.put("VERSION", response.getFieldAsString(NXCPCodes.VID_SERVER_VERSION));
    stats.put("UPTIME", response.getFieldAsInt32(NXCPCodes.VID_SERVER_UPTIME));
    stats.put("SESSION_COUNT", response.getFieldAsInt32(NXCPCodes.VID_NUM_SESSIONS));
    stats.put("DCI_COUNT", response.getFieldAsInt32(NXCPCodes.VID_NUM_ITEMS));
    stats.put("OBJECT_COUNT", response.getFieldAsInt32(NXCPCodes.VID_NUM_OBJECTS));
    stats.put("NODE_COUNT", response.getFieldAsInt32(NXCPCodes.VID_NUM_NODES));
    stats.put("PHYSICAL_MEMORY_USED", response.getFieldAsInt32(NXCPCodes.VID_NETXMSD_PROCESS_WKSET));
    stats.put("VIRTUAL_MEMORY_USED", response.getFieldAsInt32(NXCPCodes.VID_NETXMSD_PROCESS_VMSIZE));
    stats.put("QSIZE_CONDITION_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_CONDITION_POLLER));
    stats.put("QSIZE_CONF_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_CONF_POLLER));
    stats.put("QSIZE_DCI_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_DCI_POLLER));
    stats.put("QSIZE_DCI_CACHE_LOADER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_DCI_CACHE_LOADER));
    stats.put("QSIZE_DBWRITER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_DBWRITER));
    stats.put("QSIZE_EVENT", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_EVENT));
    stats.put("QSIZE_DISCOVERY", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_DISCOVERY));
    stats.put("QSIZE_NODE_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_NODE_POLLER));
    stats.put("QSIZE_ROUTE_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_ROUTE_POLLER));
    stats.put("QSIZE_STATUS_POLLER", response.getFieldAsInt32(NXCPCodes.VID_QSIZE_STATUS_POLLER));
    stats.put("ALARM_COUNT", response.getFieldAsInt32(NXCPCodes.VID_NUM_ALARMS));
    stats.put("ALARMS_BY_SEVERITY", response.getFieldAsUInt32Array(NXCPCodes.VID_ALARMS_BY_SEVERITY));
    return stats;
}
Also used : HashMap(java.util.HashMap) NXCPMessage(org.netxms.base.NXCPMessage) DataCollectionObject(org.netxms.client.datacollection.DataCollectionObject) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) WinPerfObject(org.netxms.client.datacollection.WinPerfObject) AbstractUserObject(org.netxms.client.users.AbstractUserObject) AbstractObject(org.netxms.client.objects.AbstractObject) EventObject(org.netxms.client.events.EventObject) UnknownObject(org.netxms.client.objects.UnknownObject) GenericObject(org.netxms.client.objects.GenericObject)

Example 55 with NXCPMessage

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

the class NXCSession method recalculateDCIValues.

/**
 * Start recalculation of DCI values using preserver raw values.
 *
 * @param objectId object ID
 * @param dciId DCI ID
 * @return assigned job ID
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public long recalculateDCIValues(long objectId, long dciId) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_RECALCULATE_DCI_VALUES);
    msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) objectId);
    msg.setFieldInt32(NXCPCodes.VID_DCI_ID, (int) dciId);
    sendMessage(msg);
    NXCPMessage response = waitForRCC(msg.getMessageId());
    return response.getFieldAsInt64(NXCPCodes.VID_JOB_ID);
}
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