<HTML>
<P>
<STYLE> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</STYLE>
Hello!</P>
<P>I have made a php script to collect some snmp data from a cable modem.</P>
<P>Code for create:</P>
<P><?php<br>
$fname = "cm.rrd";<br>
$opts = array( "--step", "300", "--start", "now",<br>
"DS:tx:COUNTER:600:0:60",<br>
"DS:rx:COUNTER:600:-25:25",<br>
"DS:snr:COUNTER:600:0:45",<br>
"RRA:AVERAGE:0.5:1:600",<br>
"RRA:AVERAGE:0.5:6:700",<br>
"RRA:AVERAGE:0.5:24:775",<br>
"RRA:AVERAGE:0.5:288:797",<br>
"RRA:MAX:0.5:1:600",<br>
"RRA:MAX:0.5:6:700",<br>
"RRA:MAX:0.5:24:775",<br>
"RRA:MAX:0.5:288:797"<br>
);</P>
<P> $ret = rrd_create($fname, $opts, count($opts));</P>
<P> if( $ret == 0 )<br>
{<br>
$err = rrd_error();<br>
echo "Create error: $err\n";<br>
}<br>
?><br>
</P>
<P>Code for update:</P>
<P><?php</P>
<P>$tx = '.1.3.6.1.2.1.10.127.1.2.2.1.3.2';<br>
$rx = '.1.3.6.1.2.1.10.127.1.1.1.1.6.3';<br>
$snr = '.1.3.6.1.2.1.10.127.1.1.4.1.5.3';<br>
$community = 'public';<br>
$ip = '192.168.100.1';<br>
$fname = "cm.rrd";<br>
while (true) {</P>
<P> $tx_data = snmpget($ip, $community, $tx);<br>
$rx_data = snmpget($ip, $community, $rx);<br>
$snr_data = snmpget($ip, $community, $snr);</P>
<P> $tx_data = eregi_replace ( "string:", "", $tx_data);<br>
$tx_data = eregi_replace ( "integer:", "", $tx_data);<br>
$tx_data = trim($tx_data);<br>
$txdata = $tx_data / 10;</P>
<P> $rx_data = eregi_replace ( "string:", "", $rx_data);<br>
$rx_data = eregi_replace ( "integer:", "", $rx_data);<br>
$rx_data = trim($rx_data);<br>
$rxdata = $rx_data / 10;</P>
<P> $snr_data = eregi_replace ( "string:", "", $snr_data);<br>
$snr_data = eregi_replace ( "integer:", "", $snr_data);<br>
$snr_data = trim($snr_data);<br>
$snrdata = $snr_data / 10;</P>
<P><br>
echo time() . ": " . $txdata . " and " . $rxdata . " and " . $snrdata . "\n";</P>
<P><br>
$ret = rrd_update($fname, "N:$txdata:$rxdata:$snrdata");</P>
<P><br>
if( $ret == 0 )<br>
{<br>
$err = rrd_error();<br>
echo "ERROR occurred: $err\n";<br>
}</P>
<P> sleep(300);<br>
}<br>
?><br>
<br>
When I run the update script all I get is this error:</P>
<P> php update_rrd.php<br>
1248597360: 40 and -10.6 and 36.1<br>
ERROR occurred: Not enough arguments<br>
</P>
<P>I'm newbie on rrdtool, and I have tried to google the problem but I can't understand what's wrong.</P>
<P>Anyone who knows what I'm doing wrong?</P>
<P>--</P>
<P>Kind Regards,</P>
<P>Espen Kristensen.</P></HTML>