[Solved] Physical Memory Usage with Cacti and Windows 2000 S

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

Moderators: Developers, Moderators

Post Reply
bab5470
Posts: 6
Joined: Sun May 21, 2006 11:45 am

[Solved] Physical Memory Usage with Cacti and Windows 2000 S

Post by bab5470 »

I am trying to monitor physical memory usage for about thirty Windows 2000 servers running service pack 4 but I am having problems.

I searched around the Cacti forums and this seems to be a common problem but I can't seem to find a good solution. So far what I have found is:

- According to this post monitoring physical memory should work in Windows 2000 SP4.

- This post lists total physical memory OID, however based on this website the used physical memory can only be determined by adding the results of several OIDs together?

- It also seems from this post that you can monitor used physical memory using third party applications such as SNMP Informant (www.snmp-informant.com) or nsclient (I'm not sure what nsclient is but it seems to be agent based). The problem is this software costs money, can effect server performance, and would have to be deployed to a large number of servers.

- Lastly I've found that WMI can be used to collect physical memory usage. My cacti server is running on Windows 2003 so I figured this might work. I found several WMI scripts:
http://www.cacti.net/downloads/scripts/scripts4nt.zip
http://snmpboy.msft.net/

But I can't seem to figure out how to make the WMI scripts work in Cacti.

Why is this so painful? :) Surely there is a way to monitor physical memory usage on Windows 2000 which is a bit more straight-forward? Any tips or suggestions would be appreciated.

Thank You,
Brad
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Read this on how to make custom scripts work with cacti.
bab5470
Posts: 6
Joined: Sun May 21, 2006 11:45 am

Post by bab5470 »

BSOD2600 -

Thanks for the link. I wish I would have found this before I attempted to setup a WMI script in cacti. In reviewing the how to it looks like I managed to do all the right things without the how to but the graph is still not working as I would expect.

I turned on debug logging and found the following:

05/22/2006 12:01:09 AM - CMDPHP: Poller[0] Host[8] DS[195] WARNING: Result from CMD not valid. Partial Result:
05/22/2006 12:01:09 AM - CMDPHP: Poller[0] Host[8] DS[195] CMD: /scripts/usedMem.vbs , output: U

I'm not sure why I am getting this result, as the command/script I setup was as follows:

cscript //nologo C:/inetpub/wwwroot/cacti/scripts/usedMem.vbs <host>

When I run that command from the command line (substituting the correct server in place of <host>) I get the following results:

542408
2096400

The first number being the used memory - the second number being the total memory. I created two output fields for each number - although I'm not certain how cacti decides which number should get stored in which field.

How can I get more information about why my graph is empty? (Values read NaN) By the way - I verified an rrd file was being generated so at least that much is happening.

Thanks,
Brad
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Looks like cacti maybe isn't executing cscript //nologo, so it doesn't know what to do with a vbs file?

Also, when you have more than one outputted value, you really want to assign it text like: val1:234 val2:345 so the data input method can match the output values. Take a look at this script. I haven't used it, but he is using a wmi script to collect data. Look how he set up the data input method.
bab5470
Posts: 6
Joined: Sun May 21, 2006 11:45 am

Post by bab5470 »

Ok... I'm getting close. I have the following WMI script which is meant to display the total physical memory in a server and the total used memory:

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from
Win32_PerfRawData_PerfOS_Memory",,48)
For Each objItem in colItems
available_memory = objItem.AvailableMBytes
Next

Set colItems = objWMIService.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each colItem In colItems
total_physical = CLng(colItem.TotalPhysicalMemory / 1024)
Next

used_physical_memory = (total_physical - available_memory)
wscript.echo "totalPhysical" & ":" & total_physical & "
used_physical_memory" & ":" & used_physical_memory

The script seems to work fine on a system with less than 1GB of memory, but when I run it on a server with say 4GB of RAM I get inaccurate results. For instance I get the following results: totalPhysical:2047
used_physical_memory:574

The total physical should read 4GB (4096) and used phyiscal should read
1.5GB (1536). I'm not sure what the problem is. I've posted a note on the Microsoft Newsgroups but I was hoping someone here might have some ideas. Any suggestions would be appreciated.

Thanks!
Brad
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Sorry dude, I don't run any computers with more than 1GB of memory (yet!.. just wait till Vista ;-) ) so I haven't run into this problem. Being that WMI is reporting an invalid number, it sounds like a MS problem. Maybe there is another WMI object you're suppose to read which isn't a cooked counter that reports the true value?
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Post by DevilSun »

Don't use that class and values.

Use the "Win32_OperatingSystem" (SELECT * FROM Win32_OperatingSystem), and the values from FreePhysicalMemory and TotalVisibleMemorySize. Those report correctly...here are some other useful ones in the Win32_OperatingSystem class -- TotalVirtualMemorySize,FreeVirtualMemory,MaxProcessMemorySize,FreeSpaceInPagingFiles,SizeStoredInPagingFiles.

Good luck, I know these report correctly...we have a few servers with 2GB, 4GB, and more memory.
Jey
Posts: 41
Joined: Wed Aug 22, 2007 8:01 am

Post by Jey »

Hello,

Sorry for my english.


I have the same problem on Windows 2000 Server SP4 (French).

Before, all Windows 2003 and XP PC are ok.

I add the only Win2000 Server and I don't have Physical Memory (virtual Memory are present).


But, I don't understand what I must to do.

I Use "Version 0.8.7b" with Windows SNMP Service on the server.
And, now (this topic gave 2 years), the solution are (maybe) different ?


Thanks for your help !
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

I believe windows 2000 doesn't report it via SNMP.
Jey
Posts: 41
Joined: Wed Aug 22, 2007 8:01 am

Post by Jey »

ok, thank you !
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests