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());
}
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());
}
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;
}
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());
}
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());
}
Aggregations