1

i have connected a temperature sensor in my raspberry pi, the temperature data are sent by email in text file format every two hours. I do not want to use rrdtool directly with the temperature sensor but i want rrdtool extract these values from text file. Is this possible? I was looking in google i did not find any solution but i found only for extracting value from rrd file. Thank you for your help

1 Answers1

0

RRDtool does not extract data itself. You have to write a little script to extract the data and then hand the data to rrdtool for storing and graphing. Here is a little example in Perl:

#!/usr/bin/perl
use strict;
open my $textfile, '-|', 'tail','-f','/path/to/file';
while (<$textfile>){
   /regex-match (\d)/ && do {
       system "rrdtoo","update","data.rrd","N:$1";
   }
}

ps. you can also use the RRDs module that comes with rrdtool to access rrdtool functionality directly from within perl.

Tobi Oetiker
  • 5,167
  • 2
  • 17
  • 23