Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. java API: create threshold for DCI

java API: create threshold for DCI

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 13.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    H
    hoeth
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • H
      H
      hoeth
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • T
        T
        tolimanjo
        wrote on last edited by
        #3

        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);
        
        1 Reply Last reply
        0
        • H
          H
          hoeth
          wrote on last edited by
          #4

          Great, that works! Thanks!

          I still think a "setThresholds()" method would be nice, but I'm glad I can go on now.    🙂

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups