Search in sources :

Example 86 with NXCPMessage

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

the class NXCSession method createAlarmComment.

/**
 * Create alarm comment by helpdesk reference.
 *
 * @param helpdeskReference The helpdesk reference
 * @param text The reference text
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void createAlarmComment(final String helpdeskReference, String text) throws IOException, NXCException {
    NXCPMessage msg = newMessage(NXCPCodes.CMD_UPDATE_ALARM_COMMENT);
    msg.setFieldInt32(NXCPCodes.VID_ALARM_ID, 0);
    msg.setField(NXCPCodes.VID_HELPDESK_REF, helpdeskReference);
    msg.setField(NXCPCodes.VID_COMMENTS, text);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 87 with NXCPMessage

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

the class NXCSession method deleteServerVariable.

/**
 * Delete server configuration variable
 *
 * @param name The name of the variable
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void deleteServerVariable(final String name) throws IOException, NXCException {
    NXCPMessage msg = newMessage(NXCPCodes.CMD_DELETE_CONFIG_VARIABLE);
    msg.setField(NXCPCodes.VID_NAME, name);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 88 with NXCPMessage

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

the class NXCSession method getEventProcessingPolicyInternal.

/**
 * Internal implementation for open/get event processing policy.
 *
 * @param readOnly true to get read-only copy of the policy
 * @return Event processing policy
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
private EventProcessingPolicy getEventProcessingPolicyInternal(boolean readOnly) throws IOException, NXCException {
    NXCPMessage msg = newMessage(NXCPCodes.CMD_OPEN_EPP);
    msg.setFieldInt16(NXCPCodes.VID_READ_ONLY, readOnly ? 1 : 0);
    sendMessage(msg);
    NXCPMessage response = waitForRCC(msg.getMessageId());
    int numRules = response.getFieldAsInt32(NXCPCodes.VID_NUM_RULES);
    final EventProcessingPolicy policy = new EventProcessingPolicy(numRules);
    for (int i = 0; i < numRules; i++) {
        response = waitForMessage(NXCPCodes.CMD_EPP_RECORD, msg.getMessageId());
        policy.addRule(new EventProcessingPolicyRule(response, i + 1));
    }
    return policy;
}
Also used : EventProcessingPolicyRule(org.netxms.client.events.EventProcessingPolicyRule) EventProcessingPolicy(org.netxms.client.events.EventProcessingPolicy) NXCPMessage(org.netxms.base.NXCPMessage) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 89 with NXCPMessage

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

the class NXCSession method updateSnmpUsmCredentials.

/**
 * Update list of well-known SNMP USM credentials on server. Existing list
 * will be replaced by given one.
 *
 * @param map New map of SNMP USM credentials
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void updateSnmpUsmCredentials(final Map<Integer, List<SnmpUsmCredential>> map) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_UPDATE_USM_CREDENTIALS);
    long varId = NXCPCodes.VID_USM_CRED_LIST_BASE;
    int count = 0, i;
    for (List<SnmpUsmCredential> l : map.values()) {
        if (l.isEmpty())
            continue;
        for (i = 0; i < l.size(); i++, varId += 10) {
            l.get(i).fillMessage(msg, varId);
        }
        count += i;
    }
    msg.setFieldInt32(NXCPCodes.VID_NUM_RECORDS, count);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : SnmpUsmCredential(org.netxms.client.snmp.SnmpUsmCredential) NXCPMessage(org.netxms.base.NXCPMessage) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 90 with NXCPMessage

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

the class NXCSession method addSchedule.

public void addSchedule(ScheduledTask task) throws NXCException, IOException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_ADD_SCHEDULE);
    task.fillMessage(msg);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
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