Windows performance counters & VBS/WMI via SNMP

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
lacteolus
Posts: 12
Joined: Tue Jul 15, 2008 2:55 am

Post by lacteolus »

I can't answer for everybody, but as for me - it's not a great problem to replace old dll with the new one, because I use it only on the one test server. Focusing on specific perf counters is useful feature I think. It would be convenient to have a possibility to manually define 5-10 necessary counters with the same OID on all servers in XML file.
Option or main functionality - it's not important IMHO. More significant is to have such function :)
Thanks a lot
Best regards
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hi,

Latest version (1.0.0.5) can manage "hardcoded oid's" for easier deployement over different servers.

put counters="c:\youfile.ini" in [HKEY_LOCAL_MACHINE\SOFTWARE\snmptools\currentversion] and the agent will use this file to match received oid's to perf counters, or fix string or output from executables.

sample ini file:

[1.3.6.1.4.1.15.1]
counter=PhysicalDisk\Avg. Disk Queue Length\_Total

[1.3.6.1.4.1.15.2]
counter=LogicalDisk\Free Megabytes\_Total

[1.3.6.1.4.1.15.3]
type=string
counter=this is a message

[1.3.6.1.4.1.15.4]
type=exec
counter=cscript /nologo c:\my_script.vbs

[1.3.6.1.4.1.15.5]
type=exec
counter=cmd /c ver

Regards,
Erwan.
lacteolus
Posts: 12
Joined: Tue Jul 15, 2008 2:55 am

Post by lacteolus »

Wow!!!!!!
It's cool!!!!
I've just tested it and the first impression - It's the most simple and elegant way to get perfmon statistics I've ever met. And not only perfmon but any WMI classes from Unix. To get it from OIDs via scripts - it's cool!!!
If I get any problems I'll post it but now it's OK.

Best regards.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Thanks for this nice feedback :)

Your idea to customise OID's was rather good and I have extended it to fix string and executables output.
This way, one can build his own snmp landscape.

Regards,
Erwan
lacteolus
Posts: 12
Joined: Tue Jul 15, 2008 2:55 am

Post by lacteolus »

Hi, erwan.l!
As I said it's a very useful tool.
But I've found a little strangeness. There are two servers: ServerA - has a two hard disks (software Windows mirror RAID for logical disk C: ) and serverB - has two hard disks but without RAID (first disk - logical disk C: and the second - D: ). I've created .ini file with such strings:

[1.3.6.1.4.1.15.1.1]
counter=PhysicalDisk\Avg. Disk Queue Length\0 C:
[1.3.6.1.4.1.15.1.2]
counter=PhysicalDisk\Avg. Disk Queue Length\1 D:

I've put this file on each server. I thought that request to ServerA with OID 1.3.6.1.4.1.15.1.2 returns Error because there isn't such counter on this server (instead this one there is a counter "PhysicalDisk\Avg. Disk Queue Length\1 C:" which is not declared in .ini file). But it's wrong - snmpget returns values!!! I can't understand what values. Where are they from? In addition I tried to change .ini file on ServerA to:

[1.3.6.1.4.1.15.1.1]
counter=PhysicalDisk\Avg. Disk Queue Length\0 C:
[1.3.6.1.4.1.15.1.2]
counter=PhysicalDisk\Avg. Disk Queue Length\test

but it still returns values!!! And the values for 1.3.6.1.4.1.15.1.1 and 1.3.6.1.4.1.15.1.2 are different. I tried to use .ini file to get "PhysicalDisk\% Disk Time\0 C:" and "PhysicalDisk\% Disk Time\1 D:" and it returns the same values for ServerA.
It's a mystic :)
Best regards
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hi lacteolus,

Indeed this was a bug.
When the instance did not exist, the agent was sending the value for the default instance (the first one).

This is fixed in version 1.0.0.6 :
if the instance specified in the ini file does not exist, then the agent will send SNMP_ERRORSTATUS_BADVALUE as it should.

Thanks for the bug report !

Regards,
Erwan.
vbouwer
Posts: 11
Joined: Tue Mar 29, 2005 2:08 pm

How to get the tool IpTools

Post by vbouwer »

Hi,

You are referring to a tool 'IpTools', but I can not find out where I can get this tool.

Can you please help?

Regards,
Vincent B.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hi Vbouwer,
I have updated http://erwan.l.free.fr/snmptools/index.html so that it points also to a download link for iptools.

Also, IpTools web page is there : http://erwan.l.free.fr/ .

If you need to list perf counters in IpTools, you'll find it here : goto menu tools \ MS Networks \ Perf Counters.

Regards,
Erwan.
lacteolus
Posts: 12
Joined: Tue Jul 15, 2008 2:55 am

Post by lacteolus »

Hi.
As I said erwan.l's tool is great. I use it to monitor my Windows servers from cacti installed on Solaris. And I have some remarks.

1. This tool helps you to get any perfmon counters from Windows. Most of them return values wich are the same as in the perfmon. But a few ones are not. For examle, PhysicalDisk\% Disk Time or PhysicalDisk\Avg. Disk Bytes/Transfer. They can return two kinds of values and you must specify in ini file wich of them you want. You have to math to get %age values because Windows calculates it for you automatically only in perfmon.

2. Scripts can help you. You can use my script as a model but remember that it was tested only in XP/2003 not in Vista/2008 and it doesn't work in 2000 because there isn't SWbemRefresher object here. Note that I use replace function to change decimal separator. Also there are two different formulas for different counters. See http://www.microsoft.com/technet/script ... rfmon.mspx and http://msdn.microsoft.com/en-us/library/ms974615.aspx for more information.

3. Instead of calculation you can use Win32_PerfFprmattedData_PerfDisk_PhysicalDisk class but it is available only in XP/2003. And values from this class are not accurate (maybe I'm mistaken)

4. If you use my sample you must specify two mandatory arguments for running script. First (-t or -b) is for the counter name and the second is for the disk name (for example, "0 C: D:")

Best regards.
Attachments
wmi.rar
Script to calculate some values using WMI
(628 Bytes) Downloaded 696 times
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hi Lacteolus,
Nice script, thanks for sharing !

Regards,
Erwan.
benzo
Posts: 14
Joined: Wed Aug 13, 2008 6:58 am

x64 support?

Post by benzo »

Hi,

I've been using wbemcli and a WBEM to WMI mapper to retrieve data from my Windows servers to a Linux server running Cacti. An SNMP to WMI mapper seems much more elegant, but I have a number of x64 Windows servers I need to monitor.

Is there any update on getting snmptools to work on x64 Windows?

Thanks,

Ben.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hello benzo,
I'd love to port it to x64 (and I believe it should not be that hard) but I lack an x64 platform to test to compile the source code.

I've been looking on the virtualisation side but I am not sure I can run a virtual guest with x64 on a x32 host.

In short, any idea is welcome :)

Also, I believe x64 may be able to run x32 exe or dll but I dont know exactly what needs to be done to do so..

Regards,
Erwan.
Joop
Posts: 25
Joined: Thu Apr 26, 2007 5:27 am

Post by Joop »

erwan.l wrote:Hello benzo,
I'd love to port it to x64 (and I believe it should not be that hard) but I lack an x64 platform to test to compile the source code.

I've been looking on the virtualisation side but I am not sure I can run a virtual guest with x64 on a x32 host.

In short, any idea is welcome :)

Also, I believe x64 may be able to run x32 exe or dll but I dont know exactly what needs to be done to do so..

Regards,
Erwan.
What if you could remote into a x64 XP or Win2003 ?

Joop
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hello Joop,
I would recompile the source code on that platform and do some trials and errors to see if it works.

I dont believe I would need to install a developement software.
I would simple copy paste the linker in a temp folder.

I would need to install the snmp agent thus.

Regards,
Erwan.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

64 bits

Post by erwan.l »

Hi,
In snmptools.zip, there is now a snmptoolsx64.dll.
Rename it to "snmptools.dll" for windows 64bits and it should work.

Note that I cannot test it myself : I simply used a cross compiler to rebuild it for Win64 for x64.

Feedback very welcome !

Regards,
Erwan.

Edit : I was able to setup a W2K3 server 64 bits on a vmware server.
Dll loads ok. Perf counters will not work yet, but the vbs script will work.

In short, in the following example, the last 2 OID's will work, not the first one.

[1.3.6.1.4.1.15.2]
counter=LogicalDisk\Free Megabytes\_Total

[1.3.6.1.4.1.15.3]
type=string
counter=this is a test

[1.3.6.1.4.1.15.4]
type=exec
counter=cscript /nologo c:\test.vbs
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest