NRPE Memory Limit 2GB ??

Wengrzik, Andreas Wengrzik at ewr.de
Thu Oct 7 11:25:55 CEST 2004


> Wengrzik, Andreas wrote:
> >>That would be the check_swap or check_mem source-code file.
> >>
> > 
> > Hi!
> > 
> > There are some files for the memload check:
> > 
> > memload_nrpe_nt.cpp
> > memload_nrpe_nt.dsp
> > memload_nrpe_nt.dsw
> > memload_nrpe_nt.ncb
> > memload_nrpe_nt.opt
> > memload_nrpe_nt.plg
> > 
> > I searched for 'signed int' in these files but there was no 
> result :/
> > 
> 
> Variables are signed by default. Search for 'int' and see how 
> it's used. 
> I'm sure you'll be able to deduce the variable name, and then you can 
> simply change its declaration to be make it unsigned long long.
> 

Sorry about maybe boring you... i´ve found these part of a file:

int main(int argc, char* argv[])
{
	int freeswap_memory;
	int totalswap_memory;
	int freephys_memory;
	int totalphys_memory;
	int warning_threshold;
	int critical_threshold;	
	MEMORYSTATUS stat;

	/* Get Values from command line */
	if (argc != 3) {
      printf ("NRPE_NT Plugin, MEMORY Load, GX Networks, Stephen Strudwick\n");
      printf ("usage: memload warning threshold(%%) critical threshold(%%)\n");
      printf ("example: 70 90\n");
      return Unknown;
	}

    warning_threshold = atoi(argv[1]);
	critical_threshold = atoi(argv[2]);

    GlobalMemoryStatus (&stat);

	totalphys_memory = stat.dwTotalPhys/1048576;
	freephys_memory = stat.dwAvailPhys/1048576;
	totalswap_memory = stat.dwTotalPageFile/1048576;
	freeswap_memory = stat.dwAvailPageFile/1048576;

	if (!totalswap_memory) {
      return Unknown;
	}
  
	if (!freephys_memory) {
      return Unknown;
	}
  
	if (!totalphys_memory) {
      return Unknown;
	}
  
	if (!freeswap_memory) {
      return Unknown;
	}

	double mean_used = ((double)((totalphys_memory)-(freephys_memory)) / (double)totalphys_memory) * 100;
	double mean_free = ((double)freephys_memory / (double)totalphys_memory) * 100;

	double mean_pused = ((double)((totalswap_memory)-(freeswap_memory)) / (double)totalswap_memory) * 100;
	double mean_pfree = ((double)freeswap_memory / (double)totalswap_memory) * 100;

	printf("Mem: %d MB (%d%%) / %d MB (%d%%) ", ((totalphys_memory)-(freephys_memory)), (int)floor(mean_used), (totalphys_memory), (int)floor(mean_free));

	/* hack, on some systems the paged memory values are reversed !?? So dont print out anything if its fscked */
	if (mean_pused >= 0 && mean_pused <= 100) {
	  printf("Paged Mem: %d MB (%d%%) / %d MB (%d%%)\n", ((totalswap_memory)-(freeswap_memory)), (int)floor(mean_pused), (totalswap_memory), (int)floor(mean_pfree));
    }




There are a lot of information with int, is this the right way?
I really don´t know which int i should change and which one should stay :(
I think this is the last question to success.
Thanks for all your help!!!
I´ve often look into the list and about 70% of the solutions comes from you :)


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list