[rrd-users] i can¡®t use the rrdtool in crontabs on SUN Solaris

juer at 990.net juer at 990.net
Tue Feb 29 13:43:50 MET 2000


i write a program as following .It 's running correctly as a command line , but It can't run when i use the crontabs on sun solaris ( user: root):

#!/usr/local/bin/perl
use lib qw( /usr/local/rrdtool-1.0.7/lib/perl );
use RRDp;
use BER;
require 'SNMP_Session.pm';
# some magic to find the correct rrdtol executable
if ( -x "/usr/local/rrdtool-1.0.7/bin/rrdtool") {
   RRDp::start "/usr/local/rrdtool-1.0.7/bin/rrdtool";
} elsif ( -x "../bin/rrdtool") {
   RRDp::start "../bin/rrdtool";
} else {
   RRDp::start "../src/rrdtool";
}

# Set $host to the name of the host whose SNMP agent you want
# to talk to.  Set $community to the community name under
# which you want to talk to the agent.  Set port to the UDP
# port on which the agent listens (usually 161).
$host='10.0.0.1';
$community='public1';
$session = SNMP_Session->open ($host, $community, 161)
    || die "couldn't open SNMP session to $host";

$RRD="kyl.rrd";

#$oid1=encode_oid(1,3,6,1,2,1,2,2,1,8,2);
push @enoid , $oid2;
if ($session->get_request_response (@enoid)) {
    ($bindings) = $session->decode_get_response ($session->{pdu_buffer});

    while ($bindings ne '') {
        ($binding,$bindings) = &decode_sequence ($bindings);
        ($oid,$value) = &decode_by_template ($binding, "%O%@");
$value1=&pretty_print($value);
$line="update $RRD N:".$value1;
RRDp::cmd $line;
$answer = RRDp::read;
             print &pretty_print ($value), "\n";
    }
} else {
    die "No response from agent on $host";

}
RRD::end;


__________________________________________________
»¶Ó­Ê¹ÓýðÁêÈÈÏßÃâ·Ñµç×ÓÓʼþϵͳhttp://www.990.net

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users



More information about the rrd-users mailing list