Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    RRD::Editor 0.11

    Download button

    No screenshots available
    Downloads: 234  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Doug Leith | More programs
    GPL / FREE
    January 29th, 2012, 23:54 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    RRD::Editor description

    Portable, standalone (no need for RRDs.pm) tool to create and edit RRD files

    RRD:Editor is a Perl module that implements most of the functionality of RRDTOOL, apart from graphing, plus adds some new editing and portability features. It aims to be portable and self-contained (no need for RRDs.pm).

    RRD::Editor provides the ability to add/delete DSs and RRAs and to get/set most of the parameters in DSs and RRAs (renaming, resizing etc). It also allows the data values stored in each RRA to be inspected and changed individually. That is, it provides almost complete control over the contents of an RRD.

    The RRD files created by RRDTOOL use a binary format (let's call it native-double) that is not portable across platforms. In addition to this file format, RRD:Editor provides two new portable file formats (portable-double and portable-single) that allow the exchange of files. RRD::Editor can freely convert RRD files between these three formats (native-double,portable-double and portable-single).

    Notes:

    - times must all be specified as unix timestamps (i.e. -1d, -1w etc don't work, and there is no @ option in rrdupdate).
    - there is full support for COUNTER, GAUGE, DERIVE and ABSOLUTE data-source types but the COMPUTE type is only partially supported.
    - there is full support for AVERAGE, MIN, MAX, LAST RRA types but the HWPREDCT, MHWPREDICT, SEASONAL etc types are only partially supported).

    SYNOPSIS

     use strict;
     use RRD::Editor ();
     
     # Create a new object
     my $rrd = RRD::Editor->new();
     
     # Create a new RRD with 3 data sources called bytesIn, bytesOut and
     # faultsPerSec and one RRA which stores 1 day worth of data at 5 minute
     # intervals (288 data points). The argument format is the same as that used
     # by 'rrdtool create', see L
     $rrd->create("DS:bytesIn:GAUGE:600:U:U DS:bytesOut:GAUGE:600:U:U DS:faultsPerSec:COUNTER:600:U:U RRA:AVERAGE:0.5:1:288")

     # Save RRD to a file
     $rrd->save("myfile.rrd");
     # The file format to use can also be optionally specified:
     # $rrd->save("myfile.rrd","native-double"); # default; non-portable format used by RRDTOOL
     # $rrd->save("myfile.rrd","portable-double"); # portable, data stored in double-precision
     # $rrd->save("myfile.rrd","portable-single"); # portable, data stored in single-precision

     # Load RRD from a file. Automagically figures out the file format
     # (native-double, portable-double etc)
     $rrd->open("myfile.rrd");
     
     # Add new data to the RRD for the same 3 data sources bytesIn,
     # bytesOut and faultsPerSec. The argument format is the same as that used by
     # 'rrdtool update', see L
     $rrd->update("N:10039:389:0.4");
     
     # Show information about an RRD. Output generated is similar to
     # 'rrdtool info'.
     print $rrd->info();
     
     # XML dump of RRD contents. Output generated is similar to 'rrdtool dump'.
     print $rrd->dump();
     
     # Extract data measurements stored in RRAs of type AVERAGE
     # The argument format is the same as that used by 'rrdtool fetch' and
     # the output generated is also similar, see
     # L
     print $rrd->fetch("AVERAGE");
     
     # Get the time when the RRD was last updated (as a unix timestamp)
     printf "RRD last updated at %d\n", $rrd->last();

     # Get the measurements added when the RRD was last updated
     print $rrd->lastupdate();
     
     # Get the min step size (or resolution) of the RRD. This defaults to 300s unless specified
     otherwise when creating an RRD.
     print $rrd->minstep()

    Edit Data Sources

     # Add a new data-source called bytes. Argument format is the same as $rrd->create().
     $rrd->add_DS("DS:bytes:GAUGE:600:U:U");
     
     # Delete the data-source bytesIn
     $rrd->delete_DS("bytesIn");
     
     # Get a list of the data-sources names
     print $rrd->DS_names();
     
     # Change the name of data-source bytes to be bytes_new
     $rrd->rename_DS("bytes", "bytes_new")
     
     # Get the heartbeat value for data-source bytesOut (the max number of seconds that
     # may elapse between data measurements)
     printf "Heartbeat for DS bytesOut = %d\n", $rrd->DS_heartbeat("bytesOut");

     # Set the heartbeat value for data-source bytesOut to be 1200 secs
     $rrd->set_DS_heartbeat("bytesOut",1200);
     
     # Get the type (COUNTER, GAUGE etc) of data-source bytesOut
     printf "Type of DS bytesOut = %s\n", $rrd->DS_type("bytesOut");
     
     # Set the type of data-source bytesOut to be COUNTER
     $rrd->set_DS_type("bytesOut", "COUNTER");
     
     # Get the minimum value allowed for measurements from data-source bytesOut
     printf "Min value of DS bytesOut = %s\n", $rrd->DS_min("bytesOut");

     # Set the minimum value allowed for measurements from data-source bytesOut to be 0
     $rrd->set_DS_min("bytesOut",0);
     
     # Get the maximum value allowed for measurements from data-source bytesOut
     printf "Max value of DS bytesOut = %s\n", $rrd->DS_max("bytesOut");
     
     # Set the maximum value allowed for measurements from data-source bytesOut to be 100
     $rrd->set_DS_max("bytesOut",100);


    Edit RRAs

     # Add a new RRA which stores 1 weeks worth of data (336 data points) at 30 minute
     # intervals (30 mins = 6 x 5 mins)
     $rrd->add_RRA("RRA:AVERAGE:0.5:6:336");

     # RRAs are identified by an index in range 0 .. $rrd->num_RRAs(). The index
     # of an RRD can also be found using $rrd->info() or $rrd->dump()
     my $rra_idx=1;
     
     # Delete an existing RRA with index $rra_idx.
     $rrd->delete_RRA($rra_idx);
     
     # Get the number of rows/data points stored in the RRA with index $rra_idx
     $rra_idx=0;
     printf "number of rows of RRA %d = %d\n", $rra_idx, $rrd->RRA_numrows($rra_idx);
     
     # Change the number of rows/data points stored in the RRA with index
     # $rra_idx to be 600.
     $rra->resize_RRA($rra_idx, 600);
     
     # Get the value of bytesIn stored at the 10th row/data-point in the
     # RRA with index $rra_idx.
     printf "Value of data-source bytesIn at row 10 in RRA %d = %d", $rra_idx, $rra->RRA_el($rra_idx, "bytesIn", 10);
     
     # Set the value of bytesIn at the 10th row/data-point to be 100
     $rra->set_RRA_el($rra_idx, "bytesIn", 10, 100);
     
     # Get the xff value for the RRA with index $rra_idx
     printf "Xff value of RRA %d = %d\n", $rra_idx, $rra->RRA_xff($rra_idx);

     # Set the xff value to 0.75 for the RRA with index $rra_idx
     $rra->RRA_xff($rra_idx,0.75);
     
     # Get the type (AVERAGE, LAST etc) of the RRA with index $rra_idx
     print $rrd->RRA_type($rra_idx);
     
     # Get the step (in seconds) of the RRA with index $rra_idx
     print $rrd->RRA_step($rra_idx);



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    RRD editor | RRD creator | Perl module | Perl | RRD | editor

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM