This is a discussion on [mrtg] Externat Get Error within the MRTG forums, part of the Networking and Network Related category; --===============1047813703== Content-Type: multipart/alternative; boundary="_86e08432-2a63-4dcd-90c5-c87990799939_" --_86e08432-2a63-4dcd-90c5-c87990799939_ Content-Type: ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
--===============1047813703==
Content-Type: multipart/alternative; boundary="_86e08432-2a63-4dcd-90c5-c87990799939_" --_86e08432-2a63-4dcd-90c5-c87990799939_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi!! =20 I am setting up MRTG to monitor TC Classes. I have created several scripts= regarding this issue.=20 Quote: Script for creating individual Directory with IP addresses as the Directory= name mkdir.sh=20 Code: #!/bin/bash #set -x FILE=3D"/users/ids.ips" cat $FILE | while read ids do i= ps=3D`echo $ids | awk '{print $1}'` mkdir /var/www/mrtg/$ips mkdir /var/www= /mrtg/$ips/images cp /var/www/mrtg/mrtg*.png /var/www/mrtg/$ips/images/ don= e Perl Script used to get values from TC class from a file containing outpu= t of tc -s class show dev eth0 > class.eth0 rate.pl (Downloaded From Intern= et) Code: #!/usr/bin/perl # License: Are you joking? This is trivial... # USAGE: # $A= RGV[0] - infile # $ARGV[1] - inclassmark # use strict; use English; my $fou= ndclass =3D 0; my $classID; my $inbytes; open INFILE, $ARGV[0]; while (<INF= ILE>) { if ((!$foundclass) && (/^class\s+cbq\s+(\d+:\d*)\s+/)) { $= classID =3D $1; if ($classID eq $ARGV[1]) { $foundclass =3D 42; = } } if ($foundclass && (/^\s+Sent\s+(\d+)\s+bytes/)) { $in= bytes =3D $1; last; } } close INFILE; print "$inbytes\n";=20 Script for creating individual scripts for the use of CFG's for individual = IP's=20 make.sh=20 Code: #!/bin/bash NETWORK=3D"eth0" file=3D"/users/ids.ips" dir=3D"/files/stat/scr= ipts" stat=3D"/files/stat/stat.$NETWORK" rate=3D"/files/stat/rate.pl" awk= =3D"/usr/bin/awk" rm -fr $dir mkdir $dir rm -fr $dir/*.sh cat $file | while= read ids do ID=3D`echo $ids | $awk '{print $2}'` IP=3D`echo $ids | $awk '{= print $1}'` touch $dir/$IP.sh echo -e "#!/bin/bash\n\n" >$dir/$IP.sh echo -= e "/usr/bin/perl $rate $stat 10:$ID" >> $dir/$IP.sh done Script for creatin= g individual CFG's to used for MRTG make.cfg=20 Code: #!/bin/bash #set -x idfile=3D"/users/ids.ips" cfgdir=3D"/files/stat/cfgs" s= hdir=3D"/files/stat/scripts" workdir=3D"/var/www/mrtg" awk=3D"/usr/bin/awk"= rm -fr $cfgdir mkdir $cfgdir chmod 777 -R $shdir/ cat $idfile | while read= ids do ID=3D`echo $ids | $awk '{print $2}'` IP=3D`echo $ids | $awk '{print= $1}'` touch $cfgdir/$IP.cfg echo "EnableIPv6: no" > $cfgdir/$IP.cfg echo "= Workdir: /var/www/mrtg/$IP" >> $cfgdir/$IP.cfg echo "Options[_]: growright,= unknaszero" >> $cfgdir/$IP.cfg echo "Target[tc.class]: \`$shdir/$IP.sh\`" = >> $cfgdir/$IP.cfg echo "MaxBytes[tc.class]: 1000000000" >> $cfgdir/$IP.cfg= echo "Title[tc.class]: TC Class $ID, IP Address $IP, Graphs" >> $cfgdir/$I= P.cfg echo "Options[tc.class]: growright, nopercent" >> $cfgdir/$IP.cfg ech= o "PageTop[tc.class]: <H1>TC Class $ID, IP Address $IP, Graphs</H1>" >> $cf= gdir/$IP.cfg echo "YLegend[tc.class]: Bytes/second" >> $cfgdir/$IP.cfg echo= "ShortLegend[tc.class]: Bytes/s" >> $cfgdir/$IP.cfg done Script created to= make index.html by the use of indexmake from CFG's index.sh=20 Code: #!/bin/bash #set -x file=3D"/users/ids.ips" cfgdir=3D"/files/stat/cfgs" wor= kdir=3D"/var/www/mrtg" cat $file | while read ids do IP=3D`echo $ids | awk = '{print $1}'` indexmaker $cfgdir/$IP.cfg > $workdir/$IP/index.html done Now= after running all these script, all scripts work fine with our any error. = When i run=20 Code: env LANG=3DC /usr/bin/mrtg /files/stat/cfgs/*.cfg i get following erroe=20 Quote: WARNING: Problem with External get '/files/stat/scripts/172.16.10.10.sh': E= xpected a Number for 'out' but nothing' ERROR: Target[tc.class][_OUT_] ' $t= arget->[0]{$mode} ' did not eval into defined data=20 Please let me know how can i remove this error and make my MRTG work. =20 Kind RegardsMudasir MirzaCrystal Net Communications (+92)-321-2395320 __________________________________________________ _______________ Discover the new Windows Vista http://search.msn.com/results.aspx?q...US&form=3DQBR= E= --_86e08432-2a63-4dcd-90c5-c87990799939_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html> <head> <style> ..hmmessage P { margin:0px; padding:0px } body.hmmessage { FONT-SIZE: 10pt; FONT-FAMILY:Tahoma } </style> </head> <body class=3D'hmmessage'><SPAN class=3Dpostbody>Hi!!</SPAN><BR> <SPAN class=3Dpostbody></SPAN> <BR> <SPAN class=3Dpostbody> I am setting up MRTG to monitor TC Classes. I = have created several scripts regarding this issue. <BR><BR><BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Quote:</B></SPAN></TD></TR> <TR> <TD class=3Dquote><BR>Script for creating individual Directory with IP addr= esses as the Directory name <BR>mkdir.sh <BR> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>#!/bin/bash <BR><BR>#set -x <BR><BR>FILE=3D"/users/ids= ..ips" <BR><BR>cat $FILE | while read ids <BR>do <BR>ips=3D`echo $ids | awk = '{print $1}'` <BR>mkdir /var/www/mrtg/$ips <BR>mkdir /var/www/mrtg/$ips/ima= ges <BR>cp /var/www/mrtg/mrtg*.png /var/www/mrtg/$ips/images/ <BR>done <BR>= </TD></TR></TBODY></TABLE><SPAN class=3Dpostbody><BR><BR>Perl Script used t= o get values from TC class from a file containing output of <BR>tc -s class= show dev eth0 > class.<FONT face=3D"">eth0</FONT> <BR><BR>rate.pl (Down= loaded From Internet)<BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>#!/usr/bin/perl <BR><BR># License: Are you joking? Thi= s is trivial... <BR><BR># USAGE: <BR># $ARGV[0] - infile <BR># $ARGV[1] - i= nclassmark <BR><BR># <BR>use strict; <BR>use English; <BR><BR>my $foundclas= s =3D 0; <BR>my $classID; <BR>my $inbytes; <BR><BR>open INFILE, $ARGV[0]; <= BR>while (<INFILE>) { <BR> if ((!$foundclass) && = (/^class\s+cbq\s+(\d+:\d*)\s+/)) { <BR> $classID =3D $1= ; <BR> if ($classID eq $ARGV[1]) { <BR> $f= oundclass =3D 42; <BR> } <BR> } <BR> = if ($foundclass && (/^\s+Sent\s+(\d+)\s+bytes/)) { <BR> = $inbytes =3D $1; <BR> last; <BR> &= nbsp;} <BR>} <BR>close INFILE; <BR><BR>print "$inbytes\n"; <BR><BR></TD></T= R></TBODY></TABLE><SPAN class=3Dpostbody> <BR><BR>Script for creating individual scripts for the use of CFG's for ind= ividual IP's <BR> make.sh <BR><BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>#!/bin/bash <BR><BR>NETWORK=3D"eth0" <BR>file=3D"/user= s/ids.ips" <BR>dir=3D"/files/stat/scripts" <BR>stat=3D"/files/stat/stat.$NE= TWORK" <BR>rate=3D"/files/stat/rate.pl" <BR>awk=3D"/usr/bin/awk" <BR>rm -fr= $dir <BR>mkdir $dir <BR>rm -fr $dir/*.sh <BR><BR>cat $file | while read id= s <BR>do <BR>ID=3D`echo $ids | $awk '{print $2}'` <BR>IP=3D`echo $ids | $aw= k '{print $1}'` <BR>touch $dir/$IP.sh <BR>echo -e "#!/bin/bash\n\n" >$di= r/$IP.sh <BR>echo -e "/usr/bin/perl $rate $stat 10:$ID" >> $dir/$IP.s= h <BR>done <BR></TD></TR></TBODY></TABLE><SPAN class=3Dpostbody><BR><BR>Scr= ipt for creating individual CFG's to used for MRTG <BR>make.cfg <BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>#!/bin/bash <BR><BR>#set -x <BR><BR>idfile=3D"/users/i= ds.ips" <BR>cfgdir=3D"/files/stat/cfgs" <BR>shdir=3D"/files/stat/scripts" <= BR>workdir=3D"/var/www/mrtg" <BR>awk=3D"/usr/bin/awk" <BR><BR>rm -fr $cfgdi= r <BR>mkdir $cfgdir <BR>chmod 777 -R $shdir/ <BR><BR>cat $idfile | while re= ad ids <BR>do <BR>ID=3D`echo $ids | $awk '{print $2}'` <BR>IP=3D`echo $ids = | $awk '{print $1}'` <BR>touch $cfgdir/$IP.cfg <BR><BR>echo "EnableIPv6: no= " > $cfgdir/$IP.cfg <BR>echo "Workdir: /var/www/mrtg/$IP" >> $cfgd= ir/$IP.cfg <BR>echo "Options[_]: growright, unknaszero" >> $cfgdir/$I= P.cfg <BR>echo "Target[tc.class]: \`$shdir/$IP.sh\`" >> $cfgdir/$IP.c= fg <BR>echo "MaxBytes[tc.class]: 1000000000" >> $cfgdir/$IP.cfg <BR>e= cho "Title[tc.class]: TC Class $ID, IP Address $IP, Graphs" >> $cfgdi= r/$IP.cfg <BR>echo "Options[tc.class]: growright, nopercent" >> $cfgd= ir/$IP.cfg <BR>echo "PageTop[tc.class]: <H1>TC Class $ID, IP Address = $IP, Graphs</H1>" >> $cfgdir/$IP.cfg <BR>echo "YLegend[tc.class= ]: Bytes/second" >> $cfgdir/$IP.cfg <BR>echo "ShortLegend[tc.class]: = Bytes/s" >> $cfgdir/$IP.cfg <BR><BR>done <BR></TD></TR></TBODY></TABL= E><SPAN class=3Dpostbody><BR><BR>Script created to make index.html by the u= se of indexmake from CFG's <BR>index.sh <BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>#!/bin/bash <BR><BR>#set -x <BR><BR>file=3D"/users/ids= ..ips" <BR>cfgdir=3D"/files/stat/cfgs" <BR>workdir=3D"/var/www/mrtg" <BR><BR= ><BR>cat $file | while read ids <BR>do <BR>IP=3D`echo $ids | awk '{print $1= }'` <BR>indexmaker $cfgdir/$IP.cfg > $workdir/$IP/index.html <BR>done <B= R></TD></TR></TBODY></TABLE><SPAN class=3Dpostbody><BR></SPAN></TD></TR></T= BODY></TABLE><SPAN class=3Dpostbody><BR><BR>Now after running all these scr= ipt, all scripts work fine with our any error. When i run <BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Code:</B></SPAN></TD></TR> <TR> <TD class=3Dcode><BR>env LANG=3DC /usr/bin/mrtg /files/stat/cfgs/*.cfg <BR>= </TD></TR></TBODY></TABLE><SPAN class=3Dpostbody><BR>i get following erroe = <BR></SPAN> <TABLE cellSpacing=3D1 cellPadding=3D3 width=3D"90%" align=3Dcenter border= =3D0> <TBODY> <TR> <TD><SPAN class=3Dgenmed><B>Quote:</B></SPAN></TD></TR> <TR> <TD class=3Dquote>WARNING: Problem with External get '/files/stat/scripts/1= 72.16.10.10.sh': <BR>Expected a Number for 'out' but nothing' <BR><BR>ERROR= : Target[tc.class][_OUT_] ' $target->[0]{$mode} ' did not eval into defi= ned data <BR></TD></TR></TBODY></TABLE><SPAN class=3Dpostbody> <BR><BR>Please let me know how can i remove this error and make my MRTG wor= k.</SPAN><BR><BR> <BR> <BR> <DIV><STRONG>Kind Regards</STRONG><BR><STRONG>Mudasir Mirza</STRONG><BR><ST= RONG>Crystal Net Communications </STRONG><BR><STRONG>(+92)-321-2395320= </STRONG><BR></DIV><BR><br /><hr />Discover the new Windows Vista <a href= =3D'http://search.msn.com/results.aspx?q=3Dwindows+vista&mkt=3Den-US&form= =3DQBRE' target=3D'_new'>Learn more!</a></body> </html>= --_86e08432-2a63-4dcd-90c5-c87990799939_-- --===============1047813703== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ mrtg mailing list mrtg@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/mrtg --===============1047813703==-- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|