#!/usr/bin/perl -w use strict; use RRDTool::OO; my @points = (); while( <> ) { chomp; my($time, $value) = split /,/, $_; push @points, [$time, split /:/, $value]; } my $rrd = RRDTool::OO->new( file => "ts.rrd" ); $rrd->create( step => 3600*24*45, start => $points[0]->[0] - 1, data_source => { name => "high", type => "GAUGE" }, data_source => { name => "low", type => "GAUGE" }, archive => { rows => 10_000 }); for(@points) { $rrd->update( time => $_->[0], values => [ @{ $_ }[1,2] ] ); } $rrd->graph( width => 600, height => 400, image => "blood-pressure.png", vertical_label => "Blood Pressure", start => $points[0]->[0], end => $points[-1]->[0], draw => { legend => "systolic", dsname => "high", type => "area", color => "FF0000", }, draw => { legend => "diastolic", dsname => "low", type => "area", color => "00FF00", } );