For the sake of anyone who tried this script, I realised I fluffed the logic..<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span style="font-family: courier new,monospace;">MEMFREEEQN=&quot;`egrep &quot;^(MemTotal|MemFree|Buffers|Cached):&quot; /proc/meminfo |\</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">        awk &#39;{print $1 &quot; &quot; $2}&#39; |\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        sed -r &#39;s/^MemTotal:/+/g</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">                s/^(MemFree|Buffers|Cached):/-/g&#39;`&quot;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMFREE=&quot;$(( ${MEMFREEEQN} ))&quot;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">MEMPCFREE=&quot;$(( ( ${MEMFREE} * 100 ) / ${MEMTOTAL} ))&quot;</span><br style="font-family: courier new,monospace;"></blockquote><div><br>This should do the trick :)<br>
<br>
</div></div><font size="1"><span style="font-family: courier new,monospace;">#!/bin/bash</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">STATE_OK=0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">STATE_WARNING=1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">STATE_CRITICAL=2</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">STATE_UNKNOWN=3</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">STATE_DEPENDENT=4</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMTOTAL=&quot;`grep &quot;^MemTotal: &quot; /proc/meminfo |\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        awk &#39;{print $2}&#39;`&quot;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMUSEDEQN=&quot;`egrep &quot;^(MemTotal|MemFree|Buffers|Cached):&quot; /proc/meminfo |\</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        awk &#39;{print $1 &quot; &quot; $2}&#39; |\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        sed -r &#39;s/^MemTotal:/+/g</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                s/^(MemFree|Buffers|Cached):/-/g&#39;`&quot;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMUSED=&quot;$(( ${MEMUSEDEQN} ))&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">MEMPCUSED=&quot;$(( ( ${MEMUSED} * 100 ) / ${MEMTOTAL} ))&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMPCFREE=&quot;$(( 100 - ${MEMPCUSED} ))&quot;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMPCFREECRIT=5</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">MEMPCFREEWARN=10</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if [ ${MEMPCFREE} -gt ${MEMPCFREEWARN} ]; then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        echo &quot;OK: ${MEMUSED} (${MEMPCUSED}%) used, ${MEMPCFREE}% free&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        exit $STATE_OK</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">elif [ ${MEMPCFREE} -gt ${MEMPCFREECRIT} ]; then</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        echo &quot;WARNING: ${MEMUSED} (${MEMPCUSED}%) used, ${MEMPCFREE}% free&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        exit $STATE_WARNING</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">elif [ ${MEMPCFREE} -le ${MEMPCFREECRIT} ]; then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        echo &quot;CRITICAL: ${MEMUSED} (${MEMPCUSED}%) used, ${MEMPCFREE}% free&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        exit $STATE_CRITICAL</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">fi</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">echo &quot;UNKNOWN: Something went awry!&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">exit $STATE_UNKNOWN</span><br>
<br></font><br>