mrtg-2.16.2_1,1 |\__ perl-5.10.1 |\__ p5-SNMP_Session-1.12 | \__ perl-5.10.1 |\__ p5-Pod-Parser-1.38 | \__ perl-5.10.1 |\__ png-1.2.40 |\__ jpeg-7 |\__ pkg-config-0.23_1 |\__ freetype2-2.3.9_1 | \__ pkg-config-0.23_1 |\__ libiconv-1.13.1 \__ gd-2.0.35_1,1 |\__ png-1.2.40 |\__ jpeg-7 |\__ pkg-config-0.23_1 |\__ freetype2-2.3.9_1 | \__ pkg-config-0.23_1 \__ libiconv-1.13.1 |
1行目 : 値1(整数・必須) 2行目 : 値2(整数・必須) 3行目 : システムが起動してから経過した時間 4行目 : 値の説明 |
#!/usr/bin/perl $sp = " "; $slash = "/"; $target_ip=$ARGV[0]; $resultofping=`ping -c 5 $target_ip | grep round-trip`; @array = split(/$sp/,$resultofping); $array[6] =~ s/time=//; @array2 = split(/$slash/,$array[3]); print $array2[1] *1000 . "\n"; print $array2[2] *1000 . "\n"; #print `uptime | awk '{print $3$4}' | sed -e "s/,//g"` $uptime_raw=`uptime`; @array3 = split(/$sp/,$uptime_raw); $array3[5] =~ s/,//; print $array3[4]. $sp . $array3[5] . "\n"; print "ICMP_RTT_of_$ARGV[0]\n" |
SetEnv[_] : LANG="C" Options[_] : gauge, absolute YLegend[_] : RTT (micro sec.) Target[TKY]: `/usr/local/bin/rtt-mrtg.pl 10.10.20.254` Target[OSA]: `/usr/local/bin/rtt-mrtg.pl 10.10.50.254` |
# cat /etc/crontab | grep mrtg */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg |