<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ExternalParameters, some parse some don't]]></title><description><![CDATA[<p dir="auto">I have one that parses just fine:</p>
<p dir="auto">ExternalParameter = pserver:/bin/ps -ef | /usr/local/bin/grep pserver | /usr/local/bin/grep -v grep | /bin/wc -l | /usr/local/bin/awk '{print $1}'</p>
<p dir="auto">This will output an integer that I can parse on.</p>
<p dir="auto">This one doesn't seem to parse right:</p>
<p dir="auto">ExternalParameter = rootInodes:/usr/sbin/df -F ufs -o i / | /bin/tail -1 | /usr/local/bin/awk '{print $4}' | /bin/sed -e 's/%//g'</p>
<p dir="auto">Instead I get something like this:<br />
/dev/md/dsk/d4 38901 220171 15 /var</p>
<p dir="auto">due to all the awk and sed work, I should only see the 15.  Interestingly enough, it seems that the sed worked to strip the % off, but the awk fails in the second example.  However it works in the first example.</p>
<p dir="auto">Thanks,<br />
Dan</p>
]]></description><link>https://forum.netxms.org/topic/478/externalparameters-some-parse-some-don-t</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 12:27:24 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/478.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Oct 2008 21:42:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ExternalParameters, some parse some don't on Thu, 02 Oct 2008 09:58:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">This is because $1 .. $9 is a macros substituted by NetXMS agent itself - they represent arguments for a parameter. If you need to pass $ sign as part of a command, you should use $$.<br />
So your command should looks like:<br />
ExternalParameter = rootInodes:/usr/sbin/df -F ufs -o i / | /bin/tail -1 | /usr/local/bin/awk '{print $$4}' | /bin/sed -e 's/%//g'</p>
<p dir="auto">First example works, because wc -l gives you only one word, so { print $1 } transformed to { print } doesn't actually affect anything.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/2371</link><guid isPermaLink="true">https://forum.netxms.org/post/2371</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 02 Oct 2008 09:58:57 GMT</pubDate></item></channel></rss>