Adding data points (rrdtool update) can be the easiest or hardest part of configuring RRD. This is where you actually insert the data you want to plot into the RRD. The overall idea, however, is extremely simple. Look at the form:
rrdtool update <file.rrd> timestamp:val1[:val2:...]
Typically this command is placed at the end of a script that nabs all your values via SNMPget or whatever method you are using. The form above is simple, rrdtool update (it should be noted you can also just use rrdupdate) followed by the RRD filename and an update string that starts with the timestamp of these values (as with create, you can use "N" to mean "Now"), and is followed by a list of colon separated values. You should be adding 1 value per Data Source, as defined in your RRD. The also must be added in order. You can actually use the rrdtool update --template ds2:ds1:ds3 command form to change the default order of the data sources, but otherwise they are added in the order they were created in your RRD.
Here is an example update script which I run from cron every 5 minutes. It uses a Nagios plugin to get temps from a TempTrax E, does some string manipulation to cut off the output I don't want, and then updates RRD with the values.
Figure 2. TempTrax RRD Update Script
#!/usr/local/bin/perl # RRD Update Script: update_rrd_temps.pl $HOST = "10.10.0.90"; $PATH = "/home/benr/RRD/TempTrax-RRD"; $NumProbes = 4; for($i=1; $i <= $NumProbes; $i++) { $x = `${PATH}/check_temptraxe -H ${HOST} -p ${i}`; $x =~ s/^.*([0-9.]{4}).*$/$1/; chomp($x); push(@TEMPS,$x); } `/usr/local/rrdtool-1.0.48/bin/rrdtool update ${PATH}/temptrax.rrd "N:$TEMPS[0]:$TEMPS[1]:$TEMPS[2]:$TEMPS[3]"`;
Obviously, the more complex you method of getting values is the more complex your update script will be. Typically this script is type of script is run from cron, however you could just use sleeps and a loop to keep the monitoring script running all the time. This is one of the nice things about RRDtools flexibility, you can get much more creative (for good or bad, you decide).