org.opennms.netmgt.rrd.rrdtool
Class Interface

java.lang.Object
  extended by org.opennms.netmgt.rrd.rrdtool.Interface

public final class Interface
extends java.lang.Object

This is a singleton class which provides an interface through which RRD (Round Robin Database) functions (rrd_create(), rrd_update(), and others) can be accessed from Java code.

 The native method 'launch()' takes a single argument which is a 
  RRD command string of similar format to what RRDtool takes.  Please
  note the following examples:
  
        "create test.rrd --start N DS:ifOctetsIn:COUNTER:600:U:U \
                RRA:AVERAGE:0.5:1:24"
 
        "update test.rrd --template:ifOctetsIn N:123456789"
  
  Refer to www.rrdtool.org for additional examples and information on 
  the format of rrdtool command strings.
  
  Currently only 'create', 'update', and 'fetch' commands are supported.
 

Version:
1.1.1.1
Author:
Mike , OpenNMS

Method Summary
static Interface getInstance()
          Return the singleton instance of this class.
static void init()
          Load the jrrd library and create the singleton instance of the interface.
static java.lang.String[] launch(java.lang.String cmd)
          Native method implemented in C which provides an interface to the lower-level RRD functions WARNING: The RRD C api (rrd_update(), rrd_create(), etc...) relies on getopt() & therefore is not thread safe.
static void main(java.lang.String[] argv)
          Debug purposes only
static void reload()
          Reload the jrrd library and create the singleton instance of the interface.
static void setInstance(Interface instance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

launch

public static java.lang.String[] launch(java.lang.String cmd)
Native method implemented in C which provides an interface to the lower-level RRD functions WARNING: The RRD C api (rrd_update(), rrd_create(), etc...) relies on getopt() & therefore is not thread safe. This method is therefore synchronized in order to prevent more than one thread access at a time.

Parameters:
cmd - RRDtool style command string to be executed. Currently supported RRD commands are: 'create' - calls rrd_create() 'update' - calls rrd_update() 'fetch' - calls rrd_fetch()
Returns:
array of Java String objects In the case of rrd_fetch() the returned String array has the following characteristics: String[0] = error text if command failed or NULL if successful String[1] = for 'fetch' cmd: data source names String[2..n] = for 'fetch' cmd: retrieved data rows for each interval between start and end parms

init

public static void init()
                 throws java.lang.SecurityException,
                        java.lang.UnsatisfiedLinkError
Load the jrrd library and create the singleton instance of the interface.

Throws:
java.lang.SecurityException - if we don't have permission to load the library
java.lang.UnsatisfiedLinkError - if the library doesn't exist

reload

public static void reload()
                   throws java.lang.SecurityException,
                          java.lang.UnsatisfiedLinkError
Reload the jrrd library and create the singleton instance of the interface.

Throws:
java.lang.SecurityException - if we don't have permission to load the library
java.lang.UnsatisfiedLinkError - if the library doesn't exist

getInstance

public static Interface getInstance()
Return the singleton instance of this class.

Returns:
The current instance.
Throws:
java.lang.IllegalStateException - Thrown if the interface has not yet been initialized.

setInstance

public static void setInstance(Interface instance)

main

public static void main(java.lang.String[] argv)
Debug purposes only



Copyright © 2007. All Rights Reserved.