<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=ES link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Hello, i’m
using mrtg without snmp so i’m gathering information with externals
scripts but I face with some “strange” problems when returning the
four lines.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>For example, the
following script running into bash give me the four lines output needed by
mrtg:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>arrosdev23:/vmachines/#
`/bin/echo -e `/usr/bin/top -n 1 | /usr/bin/awk '/Cpu/{print 100-$5}' |
/usr/bin/cut -c -4` "\n0\n\n"<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>3.3<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>0<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>#<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Then I edit my
.cfg file with this:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Target[cpu]:
`/bin/echo -e \`/usr/bin/top -n 1 | /usr/bin/awk '/Cpu/{print 100-$5}' |
/usr/bin/cut -c -4\` "\n0\n\n"` (I escaped internal "`"
like mentioned in mrtg-reference)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>The mrtg.log
says:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>2007-08-27
15:57:01: WARNING: Problem with External get '/bin/echo -e `/usr/bin/top -n 1 |
/usr/bin/awk '/Cpu/{print 100-$5}' | /usr/bin/cut -c -4` "\n0\n\n"':<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> Expected a
Number for 'in' but got ''<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>2007-08-27
15:57:01: ERROR: Target[cpu][_IN_] ' $target->[2]{$mode} ' did not eval into
defined data<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Then I tried a
more simple script:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Target[cpu]:
`/usr/bin/top -n 1 | /usr/bin/awk '/Cpu/{print 100-$5}' | /usr/bin/cut -c -4;
echo -e "0\n\n"`<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Then mrtg.log
complains with:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>2007-08-27
16:05:02: WARNING: Problem with External get '/usr/bin/top -n 1 | /usr/bin/awk
'/Cpu/{print 100-$5}' | /usr/bin/cut -c -4; echo -e "0\n\n"':<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> Expected a
Number for 'out' but got ''<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>2007-08-27
16:05:02: ERROR: Target[cpu][_OUT_] ' $target->[2]{$mode} ' did not eval
into defined data<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Could anyone tell
me which is the error? I'm only having problems with this script and I made
several others well.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=ES-AR style='font-size:10.0pt;font-family:"Courier New"'>Thanks in advance!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
</div>
<FONT face=Verdana><FONT size=2>
<HR>
</FONT><STRONG><FONT size=1>Este documento puede incluir información
confidencial y propiedad de Neoris y deberá ser leído solamente por la o las
personas a quienes está dirigido. Si usted ha recibido este mensaje por error,
por favor avise inmediatamente al remitente contestando y eliminando este
correo. Cualquier punto de vista u opiniones expresadas en este mensaje son del
remitente y no necesariamente coinciden con aquellas de Neoris. Este documento
no deberá ser reproducido, copiado, distribuido, publicado, ni modificado por
terceros sin la autorización por escrito de Neoris.</STRONG></FONT></FONT><FONT
face=Verdana size=2> </FONT>
<P><FONT color=#ff0000 size=1><STRONG>Este mensaje ha sido <SPAN
class=254115416-27052005>verificado </SPAN>contra virus. Visítenos en
</STRONG></FONT><A title=http://www.neoris.com href="http://www.neoris.com"><U
title=http://www.neoris.com><FONT title=http://www.neoris.com size=1><EM
title=http://www.neoris.com><STRONG
title=http://www.neoris.com>www.neoris.com</STRONG></EM></FONT></U></A><FONT
color=#ff0000 size=1><STRONG>. </STRONG></FONT>
<HR>
</body>
</html>