Hi,
I'm using the java API to create DCIs. This works fine for the basic stuff like name, description, polling interval, etc. But how can I attach a Threshold object to the DataCollectionItem?
Thanks a lot,
Hendrik
Brief update: Looking at the netxms-client sources it seems that there is no setThreshods() method for DataCollectionItem. I think something like this needs to be added to org/netxms/client/datacollection/DataCollectionItem.java:
/**
* @param thresholds the thresholds to set
*/
public void setThresholds(ArrayList<Threshold> thresholds)
{
this.thresholds = thresholds;
}
Is that correct?
Was stuck on this as well. The use of '.getThresholds().add()' solved it for me:
DataCollectionConfiguration objDcc = objNxcSession.openDataCollectionConfiguration(intTemplateId);
DataCollectionItem objDci = new DataCollectionItem(objDcc, 0);
Threshold objThreshold = new Threshold();
objThreshold.setFunction(Threshold.F_DIFF); // "Diff with previous value", for example
// define additional threshold parameters...
objDci.getThresholds().add(objThreshold);
objDcc.modifyObject(objDci);
Great, that works! Thanks!
I still think a "setThresholds()" method would be nice, but I'm glad I can go on now. :)