<?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[Automatic Rule for process name in SNMP table]]></title><description><![CDATA[<p dir="auto">Hey guys,</p>
<p dir="auto">I am using the following rule automatic rule to add a template if a specific SNMP values has been found:</p>
<pre><code>transport = CreateSNMPTransport($node);
if (transport == null) {
    return false;
}

value = SNMPGetValue(transport, ".1.3.6.1.2.1.25.4.1.0");
if (value == null) {
    return false;
}
else {
    return true;
}
</code></pre>
<p dir="auto">This works so far pretty well.</p>
<p dir="auto">But now I have some device where I want to check if specific processes are running on it.<br />
I want to check via SNMP thecomplete hrSWRunTable (.1.3.6.1.2.1.25.4.2) if there is a process with a specific name (hrSWRunName has the OID .1.3.6.1.2.1.25.4.2.1.2).</p>
<p dir="auto">So maybe I have to get all values form the tabel and then iterate over the entries and compare them. But I don't know how.</p>
<p dir="auto">Do you have an idea how I should adjust my rule to find out if the process is running?<br />
Maybe there is a better solution?</p>
<p dir="auto">Btw: I am using NetXMS Version 2.0.7.</p>
<p dir="auto">Thanks in advance guys.</p>
<p dir="auto">Best regards,<br />
Danny</p>
]]></description><link>https://forum.netxms.org/topic/4843/automatic-rule-for-process-name-in-snmp-table</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 14:00:40 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4843.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 23 Dec 2016 11:43:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Automatic Rule for process name in SNMP table on Tue, 27 Dec 2016 15:23:16 GMT]]></title><description><![CDATA[<p dir="auto">Just one comment: code block</p>
<pre><code>if (found_process == true) {
  return true; // process has been found
} else {
  return false; // process has not been found
}
</code></pre>
<p dir="auto">could be replaced with simple</p>
<pre><code>return found_process;
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/21553</link><guid isPermaLink="true">https://forum.netxms.org/post/21553</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 27 Dec 2016 15:23:16 GMT</pubDate></item><item><title><![CDATA[Reply to Automatic Rule for process name in SNMP table on Tue, 27 Dec 2016 07:32:06 GMT]]></title><description><![CDATA[<p dir="auto">Okay- I just solved my own problem.<br />
In case somebody wants to do something similar (or maybe for the docs) here is how I solved this:</p>
<pre><code>process = "My-Running-SW-In-The-hrSWRunTable.exe"; // defines process name for lookup

// Create SNMP transport for node
transport = CreateSNMPTransport($node);
if (transport == null) {
  return false;
}

// walk over running software processes
// .iso.org.dod.internet.mgmt.mib-2.host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunName
vars = SNMPWalk(transport, ".1.3.6.1.2.1.25.4.2.1.2");
if (vars == null) {
  return false;
}

found_process = false; // set flag initially to false

// find process, set flag and break loop if process found
foreach (v: vars) {
  if(v-&gt;value == process) {
    trace(1, "SNMP WALK; Search for process: ".process."; Found: ".v-&gt;name."=".v-&gt;value);
    found_process = true;
    break;
  }
}

if (found_process == true) {
  return true; // process has been found
} else {
  return false; // process has not been found
}
</code></pre>
<p dir="auto">Best regards,<br />
Danny</p>
]]></description><link>https://forum.netxms.org/post/21550</link><guid isPermaLink="true">https://forum.netxms.org/post/21550</guid><dc:creator><![CDATA[dkoppenhagen]]></dc:creator><pubDate>Tue, 27 Dec 2016 07:32:06 GMT</pubDate></item></channel></rss>