On Wed, Oct 24, 2007 at 05:20:59PM +0530, Deepak CHAUHAN wrote:
> Hello All,
>
> I have installed ganglia for windows 2003 server but its not showing RAM
> more than 2 GB and server is having 16 GB of RAM.Pls. help me in resolving
> the issue.
Can you see if the attached patch fixes the issue?
Carlo
PS. patch comes from 3.1.0 but should apply cleanly also to older versions if
you use the right directory and -p option
Index: trunk/monitor-core/libmetrics/cygwin/metrics.c
===================================================================
--- trunk/monitor-core/libmetrics/cygwin/metrics.c (revision 858)
+++ trunk/monitor-core/libmetrics/cygwin/metrics.c (working copy)
@@ -4,6 +4,7 @@
#include <time.h>
#include <unistd.h>
#include <ctype.h>
+#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iphlpapi.h>
#include <sys/types.h>
@@ -38,7 +39,6 @@
timely_file proc_stat = { 0, 1, "/proc/stat" };
timely_file proc_loadavg = { 0, 5, "/proc/loadavg" };
-timely_file proc_meminfo = { 0, 5, "/proc/meminfo" };
static time_t
get_netbw(double *in_bytes, double *out_bytes,
@@ -340,15 +340,18 @@
g_val_t
mem_total_func ( void )
{
- char *p;
+ MEMORYSTATUSEX stat;
+ DWORDLONG size;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "MemTotal:");
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
+ stat.dwLength = sizeof(stat);
+
+ if ( GlobalMemoryStatusEx (&stat)) {
+ size = stat.ullTotalPhys;
+ /* get the value in kB */
+ val.uint32 = size / 1024;
} else {
- val.uint32 = 0;
+ val.uint32 = 0;
}
return val;
@@ -357,15 +360,18 @@
g_val_t
swap_total_func ( void )
{
- char *p;
+ MEMORYSTATUSEX stat;
+ DWORDLONG size;
g_val_t val;
-
- p = strstr( update_file(&proc_meminfo), "SwapTotal:" );
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
+
+ stat.dwLength = sizeof(stat);
+
+ if ( GlobalMemoryStatusEx (&stat)) {
+ size = stat.ullTotalPageFile;
+ /* get the value in kB */
+ val.uint32 = size / 1024;
} else {
- val.uint32 = 0;
+ val.uint32 = 0;
}
return val;
@@ -853,67 +859,52 @@
g_val_t
mem_free_func ( void )
{
- char *p;
+ MEMORYSTATUSEX stat;
+ DWORDLONG size;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "MemFree:" );
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
+ stat.dwLength = sizeof(stat);
+
+ if ( GlobalMemoryStatusEx (&stat)) {
+ size = stat.ullAvailPhys;
+ /* get the value in kB */
+ val.uint32 = size / 1024;
} else {
- val.uint32 = 0;
+ val.uint32 = 0;
}
return val;
}
+/* FIXME */
g_val_t
mem_shared_func ( void )
{
- char *p;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "MemShared:" );
- if (p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
- } else {
- val.uint32 = 0;
- }
+ val.uint32 = 0;
return val;
}
+/* FIXME */
g_val_t
mem_buffers_func ( void )
{
- char *p;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "Buffers:" );
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
- } else {
- val.uint32 = 0;
- }
+ val.uint32 = 0;
return val;
}
+/* FIXME */
g_val_t
mem_cached_func ( void )
{
- char *p;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "Cached:");
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
- } else {
- val.uint32 = 0;
- }
+ val.uint32 = 0;
return val;
}
@@ -921,15 +912,18 @@
g_val_t
swap_free_func ( void )
{
- char *p;
+ MEMORYSTATUSEX stat;
+ DWORDLONG size;
g_val_t val;
- p = strstr( update_file(&proc_meminfo), "SwapFree:" );
- if(p) {
- p = skip_token(p);
- val.uint32 = strtol( p, (char **)NULL, 10 );
+ stat.dwLength = sizeof(stat);
+
+ if ( GlobalMemoryStatusEx (&stat)) {
+ size = stat.ullAvailPageFile;
+ /* get the value in kB */
+ val.uint32 = size / 1024;
} else {
- val.uint32 = 0;
+ val.uint32 = 0;
}
return val;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers