Dumb question of the day - Windows CPU load via SNMP *** solved ***

Started by paul, May 29, 2019, 02:48:09 PM

Previous topic - Next topic

paul

Persistence does not overcome ignorance  :'( :'( - four hours later I accept defeat.

OK - so I walk .1.3.6.1.2.1.25.3.3.1.2 and I get two OID's for my two processors. .3 and .4

I can add each OID as a parameter individually and they return the CPU load for each one.
I can add a table and point it at .1.3.6.1.2.1.25.3.3.1.2 and it loads the CPU load for each CPU into the table.

The above - although working - is completely useless to me :( - it just proves that close is not close enough :(

If I try and add .1.3.6.1.2.1.25.3.3.1.2.{instance}  then I get unsupported error. This is so it can be used on a template and be number of CPU's independent.

Though I would be happy with the outcome from the table if it gave me the AVG of the table - that gives me the device average CPU load -  I cannot seem to work out how to do that.

Why do I persist??

Once I have this working - I will have my first cut of an implementable default Windows template built as I have Memory and Drives already working. It is just this - soooo frustrating :(

https://wiki.netxms.org/wiki/Creating_SNMP_table_DCI did not help enough. It got me to columns but other than having the values in the columns - I could not give them the ID's of the CPU's.

My preference would be to have the CPU's listed using instance type of DCI - and to have a summary transformation somehow.


Victor Kirhenshtein

Hi,

as you are not interested in each individual CPU usage you don't actually need instance discovery. Instead, you could use script DCI that will walk all CPU load OIDs and calculate average. This script should work:


snmp = CreateSNMPTransport($node);
if (snmp == null)
return null;

varbinds = SNMPWalk(snmp, ".1.3.6.1.2.1.25.3.3.1.2");
if (varbinds == null)
return null;

count = 0;
total = 0;
for(v : varbinds)
{
count++;
total += v->value;
}

return total / count;


It returns null to indicate data collection error if SNMP walk fails.

Best regards,
Victor

paul

Thanks Victor.

Apart from being a legend for having such a fantastic product - your 17 lines of code has - again - made my day!!.

I have it implemented in two versions - one as a script and one as a SNMP monitor against .1.3.6.1.2.1.25.3.3.1.2.3 and simply using that code in the transform to provide the answer.

My Windows SNMP template now has the following: (see picture as well)

File system by instance - Total / used /  % used
Physical and Virtual memory (via file system instance DCI )
sysuptime in days - string and floating point.
CPU % Busy as a script and as SNMP DCI via transform.


paul

OK - one more silly question - but that's it (for today)

How would I collect and show each individual CPU load and show it? 

I don't need it for the overview page but it would be handy as there are times when a process goes 100% CPU on a processor - but overall, being under 50%, will not trigger my combined 70% busy exception.

Victor Kirhenshtein

Then you need instance discovery DCI that will create separate DCI for each processor instance. You can set DCI parameter name to .1.3.6.1.2.1.25.3.3.1.2.{instance} and in instance discovery method select SNMP Walk - OIDs and use .1.3.6.1.2.1.25.3.3.1.2 as a base.

Best regards,
Victor

paul

Victor,

Again what can I say - your assistance is immensely appreciated.

It is in and live already - but - it did not enumerate the instance name in the title like it does for my file system equivalent DCI.

Did I miss something?

paul

hmmm instance-name perhaps - let me see.....

Nope - which makes sense.

The instance name of each CPU is the OID of that CPU - which means I need to insert that last octet of the OID into the Description field. $1 does not work - shows as $1 and instance-name returns 0.

Stumped again :(


paul

OK - Rule 1 of every thing I do - WAIT 5  minutes!!.


paul

Done - all working!!

Overkill to have this on the Overview page - but doing so just to demonstrate it working on an 8 CPU server.

Victor and Tursiops - thank you both - a fantastic outcome :)