org.jrobin.cmd

Class RrdCommander

public class RrdCommander extends Object

Class to be used to execute various RRDTool commands (original syntax of RRDTool 1.0.x must be used). Currently supported commands are CREATE, UPDATE, LAST, FETCH, DUMP, RESTORE, XPORT, GRAPH, TUNE, INFO
Method Summary
static Objectexecute(String command)
Executes single RRDTool command.
static booleanisRrdDbPoolUsed()
Checks if the class uses RrdDbPool internally while executing RRDTool commands.
static booleanisStandardOutUsed()
Checks if the output from any RRDTool command will be visible on the standard output device (console).
static voidmain(String[] args)
A small demo which allows you to pass arbitrary RRDTool commands to JRobin
static voidsetRrdDbPoolUsed(boolean rrdDbPoolUsed)
Forces or prohibits RrdDbPool usage internally while executing RRDTool commands
static voidsetStandardOutUsed(boolean standardOutUsed)
Method used to control access to stdout (System.out, console) for all RRDTool commands.

Method Detail

execute

public static Object execute(String command)
Executes single RRDTool command. The command string should start with some well known RRDTool command word (create, update, fetch, graph...)

Parameters: command RRDTool command like:

                create test.rrd --start "noon yesterday" --step 300 DS:x:GAUGE:600:U:U RRA:AVERAGE:0.5:5:1000
                update test.rrd N:1000
                last test.rrd
                ...
                

Returns: Result of specific RRDTool command. It is guaranteed that the result of any successfully executed command will be always different from null. Unsuccessfully executed commands will always throw an exception, so you need not check for null results.

Exact type of the result depends from the type of executed RRDTool command:

Throws: IOException thrown in case of I/O error RrdException thrown for all other errors (parsing errors, unknown RRDTool syntax/command/option, internal RRD errors...)

isRrdDbPoolUsed

public static boolean isRrdDbPoolUsed()
Checks if the class uses RrdDbPool internally while executing RRDTool commands.

Returns: true if the pool is used, false otherwise

isStandardOutUsed

public static boolean isStandardOutUsed()
Checks if the output from any RRDTool command will be visible on the standard output device (console). Default setting is true.

Returns: true, if the output will be visible on the standard output device; false, otherwise.

main

public static void main(String[] args)
A small demo which allows you to pass arbitrary RRDTool commands to JRobin

Parameters: args Not used

Throws: IOException

setRrdDbPoolUsed

public static void setRrdDbPoolUsed(boolean rrdDbPoolUsed)
Forces or prohibits RrdDbPool usage internally while executing RRDTool commands

Parameters: rrdDbPoolUsed true, to force pool usage, false otherwise.

setStandardOutUsed

public static void setStandardOutUsed(boolean standardOutUsed)
Method used to control access to stdout (System.out, console) for all RRDTool commands. By default, all RRDTool commands are allowed to print results to stdout, in a form used by RRDTool.

Parameters: standardOutUsed true if the output should be visible on the standard output device, false otherwise.