<?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[SNMP Get disk free space]]></title><description><![CDATA[<p dir="auto">Hello</p>
<p dir="auto">I want to get the free Disk space on a windows HDD.<br />
But I can find in the host resource mib only "disk size = hrStorageSize" and "disk used space" = hrStorgeUsed.<br />
So I decided to calculate disk free space from paramters above via transfromation script below.<br />
(the DCI = $1 collects the disk size)</p>
<p dir="auto">sub main()<br />
{<br />
  if ($node-&gt;isSNMP)<br />
  {<br />
   transport = CreateSNMPTransport($node);<br />
    if (transport == null)<br />
    {<br />
       return -1;<br />
    }<br />
   <br />
    diskused = SNMPGetValue(transport, ".1.3.6.1.2.1.25.2.3.1.6.2"); // get Disk used <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f627.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--anguished" style="height:1.4em;width:auto;vertical-align:middle" title="D:" alt="😧" /><br />
    blocksize = SNMPGetValue(transport, ".1.3.6.1.2.1.25.2.3.1.4.2");  // get Blocksize <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f627.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--anguished" style="height:1.4em;width:auto;vertical-align:middle" title="D:" alt="😧" /><br />
    if (diskused != null)<br />
    {<br />
        result = ($1 - diskused) ;       // Disk free = Disk size - Disk used<br />
        result = result / ( 1024 * 1024 ) * blocksize / 1024 ; // transform to GByte<br />
        return ( result );<br />
       <br />
    }<br />
  }<br />
}</p>
<p dir="auto">But the script is not working. I always get the following error<br />
"Cannot execute script: Incompatible operation"</p>
<p dir="auto">Do you have any idea what is wrong in my script ?<br />
Are there other possibliies to get the disk free and memory free space via SNMP ?</p>
]]></description><link>https://forum.netxms.org/topic/2974/snmp-get-disk-free-space</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 16:07:08 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/2974.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Mar 2014 17:06:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 24 Jul 2014 02:11:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ytrasse" aria-label="Profile: ytrasse">@<bdi>ytrasse</bdi></a> said in <a href="/post/13153">SNMP Get disk free space</a>:</p>
<blockquote>
<p dir="auto">Hello andrey--k</p>
<p dir="auto">I tested your hdd-template. In general it seems to be ok. But there is no transforamtion script to display the values in GByte.<br />
So I decided to merge your hdd-template with filter and instances with my working transformation script (see above).<br />
But I had no real success, because it seems that {instance} is not allowed in transformation scripts.<br />
e.g.<br />
...<br />
 oid = ".1.3.6.1.2.1.25.2.3.1.5." . {instance};<br />
 disksize = SNMPGetValue(transport,  oid);  // get Disk size</p>
<p dir="auto">I also created a template for getting the memory size/used/free/percent template similar to the disk templates.<br />
My calculation of free memory here is also not working. (Other calculations are working)<br />
transformation script:<br />
sub main()<br />
{<br />
   memused = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.6.".$1));<br />
   memsize = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.5.".$1));<br />
   memfree = (memsize - memused) * 64 / 1024;<br />
   return (memfree);<br />
}</p>
<p dir="auto">Attached there are my templates for Disk size/free/used/percent and Memory size/used/free/percent<br />
It would be nice if somebody could check what is wrong with my templates.</p>
</blockquote>
<p dir="auto">Hi ytrasse,<br />
I have tried your transformation script and it's not working. Is there any updates?</p>
]]></description><link>https://forum.netxms.org/post/14457</link><guid isPermaLink="true">https://forum.netxms.org/post/14457</guid><dc:creator><![CDATA[Bing Wen]]></dc:creator><pubDate>Thu, 24 Jul 2014 02:11:08 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 24 Jul 2014 02:08:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ytrasse" aria-label="Profile: ytrasse">@<bdi>ytrasse</bdi></a> said in <a href="/post/13059">SNMP Get disk free space</a>:</p>
<blockquote>
<p dir="auto">Hello</p>
<p dir="auto">I already found the problem in my script.<br />
It was no script problem, but a usage problem.<br />
I tested it with the "Test" option, but I used it on the template instead of the applied server.<br />
The transofrmation script itself seem's to be OK. It is working and returns the free disk space.</p>
<p dir="auto">However I will also have a look to your hdd template andrey-k.</p>
<p dir="auto">Attached there is my actual template.</p>
</blockquote>
<p dir="auto">Hi ytrasse,</p>
<p dir="auto">I tried to add a new DCI based on your attached file. But i could only get 0 for the last value.</p>
]]></description><link>https://forum.netxms.org/post/14456</link><guid isPermaLink="true">https://forum.netxms.org/post/14456</guid><dc:creator><![CDATA[Bing Wen]]></dc:creator><pubDate>Thu, 24 Jul 2014 02:08:23 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 20 Mar 2014 18:57:21 GMT]]></title><description><![CDATA[<p dir="auto">At the moment I provide some tests:<br />
1 Disk usage/free gives incorrect values on empty/full disks.<br />
2 Memory usage do not gathered 3-5 pools after hard-disk-volume add/remove. later all in order.</p>
<p dir="auto">But also good news: system normaly works when disk manipulation was done.</p>
]]></description><link>https://forum.netxms.org/post/13218</link><guid isPermaLink="true">https://forum.netxms.org/post/13218</guid><dc:creator><![CDATA[andrey--k]]></dc:creator><pubDate>Thu, 20 Mar 2014 18:57:21 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 20 Mar 2014 12:43:14 GMT]]></title><description><![CDATA[<p dir="auto">Hello andrey--k</p>
<p dir="auto">Filter and transfromation scripts are working on machines with several disk partitions, ond machines with and without DVD-drive.</p>
]]></description><link>https://forum.netxms.org/post/13214</link><guid isPermaLink="true">https://forum.netxms.org/post/13214</guid><dc:creator><![CDATA[ytrasse]]></dc:creator><pubDate>Thu, 20 Mar 2014 12:43:14 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Mon, 17 Mar 2014 21:17:41 GMT]]></title><description><![CDATA[<p dir="auto">Am a little busy at the moment. I will begin work against memory/disks DCI implementation in week or two.<br />
Please, can you test behavior of DCI when disk count changes (added or removed hard drive/cd drive/floppy) ?</p>
]]></description><link>https://forum.netxms.org/post/13166</link><guid isPermaLink="true">https://forum.netxms.org/post/13166</guid><dc:creator><![CDATA[andrey--k]]></dc:creator><pubDate>Mon, 17 Mar 2014 21:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Fri, 14 Mar 2014 08:44:38 GMT]]></title><description><![CDATA[<p dir="auto">Hello andrey-k</p>
<p dir="auto">Transformation script is working perfect now.<br />
Attached my modified storage template für disk an memory usage (size/used/free/percent) in Gbyte/MByte.<br />
Maybe you can check it once more if everything is really working perfect and we can add this template to the standard<br />
templates lib for other users.</p>
<p dir="auto">One additional question.<br />
Is there a way to modify also the DCI description in a kind that instead of Disk {instance} the storage description<br />
from OID .1.3.6.1.2.1.25.2.3.1.3 is displayed ?  e.g. Disk C:\System</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000001672-storage-ok.xml">storage-ok.xml</a></p>
]]></description><link>https://forum.netxms.org/post/13158</link><guid isPermaLink="true">https://forum.netxms.org/post/13158</guid><dc:creator><![CDATA[ytrasse]]></dc:creator><pubDate>Fri, 14 Mar 2014 08:44:38 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 13 Mar 2014 19:24:40 GMT]]></title><description><![CDATA[<p dir="auto">Transformation script to get disk space in Gib:</p>
<pre><code>transport = CreateSNMPTransport($node);
if (transport == null)
{
return -1;
}
OidInstance = substr($dci-&gt;name,rindex($dci-&gt;name,".")+1);
oidBlockSize = ".1.3.6.1.2.1.25.2.3.1.4." . OidInstance;
blockSize = SNMPGetValue(transport, oidBlockSize);
blockSize = blockSize/1024;
GiB = round($1 * blockSize/(1024*1024));
return GiB;
</code></pre>
<p dir="auto">Experiment shows, that main () {} is not needed.</p>
]]></description><link>https://forum.netxms.org/post/13156</link><guid isPermaLink="true">https://forum.netxms.org/post/13156</guid><dc:creator><![CDATA[andrey--k]]></dc:creator><pubDate>Thu, 13 Mar 2014 19:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Thu, 13 Mar 2014 13:40:35 GMT]]></title><description><![CDATA[<p dir="auto">Hello andrey--k</p>
<p dir="auto">I tested your hdd-template. In general it seems to be ok. But there is no transforamtion script to display the values in GByte.<br />
So I decided to merge your hdd-template with filter and instances with my working transformation script (see above).<br />
But I had no real success, because it seems that {instance} is not allowed in transformation scripts.<br />
e.g.<br />
...<br />
 oid = ".1.3.6.1.2.1.25.2.3.1.5." . {instance};<br />
 disksize = SNMPGetValue(transport,  oid);  // get Disk size</p>
<p dir="auto">I also created a template for getting the memory size/used/free/percent template similar to the disk templates.<br />
My calculation of free memory here is also not working. (Other calculations are working)<br />
transformation script:<br />
sub main()<br />
{<br />
   memused = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.6.".$1));<br />
   memsize = GetDCIValueByName($node,(".1.3.6.1.2.1.25.2.3.1.5.".$1));<br />
   memfree = (memsize - memused) * 64 / 1024;<br />
   return (memfree);<br />
}</p>
<p dir="auto">Attached there are my templates for Disk size/free/used/percent and Memory size/used/free/percent<br />
It would be nice if somebody could check what is wrong with my templates.</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000001670-storage-notok.xml">storage-notok.xml</a></p>
]]></description><link>https://forum.netxms.org/post/13153</link><guid isPermaLink="true">https://forum.netxms.org/post/13153</guid><dc:creator><![CDATA[ytrasse]]></dc:creator><pubDate>Thu, 13 Mar 2014 13:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Tue, 04 Mar 2014 11:09:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello</p>
<p dir="auto">I already found the problem in my script.<br />
It was no script problem, but a usage problem.<br />
I tested it with the "Test" option, but I used it on the template instead of the applied server.<br />
The transofrmation script itself seem's to be OK. It is working and returns the free disk space.</p>
<p dir="auto">However I will also have a look to your hdd template andrey-k.</p>
<p dir="auto">Attached there is my actual template.</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000001658-server.xml">server.xml</a></p>
]]></description><link>https://forum.netxms.org/post/13059</link><guid isPermaLink="true">https://forum.netxms.org/post/13059</guid><dc:creator><![CDATA[ytrasse]]></dc:creator><pubDate>Tue, 04 Mar 2014 11:09:28 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Mon, 03 Mar 2014 22:35:25 GMT]]></title><description><![CDATA[<p dir="auto">I have get % of used space  <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f60e.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--sunglasses" style="height:1.4em;width:auto;vertical-align:middle" title="8)" alt="😎" /></p>
<p dir="auto">See attach.</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000001657-hdd.xml">hdd.xml</a></p>
]]></description><link>https://forum.netxms.org/post/13056</link><guid isPermaLink="true">https://forum.netxms.org/post/13056</guid><dc:creator><![CDATA[andrey--k]]></dc:creator><pubDate>Mon, 03 Mar 2014 22:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to SNMP Get disk free space on Mon, 03 Mar 2014 20:10:01 GMT]]></title><description><![CDATA[<p dir="auto">I am working on same.<br />
Some experimental work in attached file (template export)</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000001656-hdd.xml">hdd.xml</a></p>
]]></description><link>https://forum.netxms.org/post/13055</link><guid isPermaLink="true">https://forum.netxms.org/post/13055</guid><dc:creator><![CDATA[andrey--k]]></dc:creator><pubDate>Mon, 03 Mar 2014 20:10:01 GMT</pubDate></item></channel></rss>