Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Apr 23, 2019 3:25 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 87 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: better ucd/net-snmp memory usage -- update June 21 2009
PostPosted: Thu Jan 12, 2006 2:02 pm 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
I have been working on a way to get better information about memory usage on my *NIX servers and have come up with the following.

Image

That graph shows the total real memory installed, real mem used by processes, cache, and buffers, and real memory that is unused. It also displays used swap space as a pink strip on the top, above the real memory.

A script is used to gather various bits of information from the Host MIB as well as ucd/net-snmp, then does some basic math, and returns all of the information back to cacti (this includes data not in the graph, such as total amount of installed swap space). The script is necessary because some *NIX flavors do weird things with some of the net-snmp numbers (FreeBSD changes the amount of memory available whenever swap space is activated for example, while Solaris 10 does not provide any numbers for buffers and cache).

--> see this page for the tarball and instructions <--


Last edited by ehall on Tue Jun 23, 2009 11:19 am, edited 13 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 3:32 am 
Offline
Cacti Guru User
User avatar

Joined: Fri Sep 19, 2003 8:36 am
Posts: 2326
Location: Sophia-Antipolis, France
Hi

many thanks for this template, it works great.

I had to modify the data input method to add the "-q" flag to php, in order to suppress HTTP Header output :
Code:
$ php -q /cacti/cacti-0.8.6h/scripts/netsnmp_memory_usage.php 10.37.12.82, xxxx, 1, , , 161, 500
totalReal:4150332 availReal:3817268 totalSwap:4192956 availSwap:4192956 memBuffer:68124 memCached:178876 usedReal:86064 usedSwap:0

instead of
Code:
$ php /cacti/cacti-0.8.6h/scripts/netsnmp_memory_usage.php 10.37.12.82, xxxx, 1, , , 161, 500
Content-type: text/html
X-Powered-By: PHP/4.3.9

totalReal:4150332 availReal:3817268 totalSwap:4192956 availSwap:4192956 memBuffer:68124 memCached:178876 usedReal:86064 usedSwap:0


As cactid 0.8.6g is out (http://www.cacti.net/cactid_download.php), it should also be a good idea to add the full path to php.

Regards,

_________________

HOWTOs :
Templates :


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 4:37 am 
Offline
Cacti User

Joined: Thu Oct 14, 2004 4:14 pm
Posts: 97
Thanks ehall, very useful.

On a sidenote, can I ask what font you are using for your legend items in your graphs. Looks like your squeezing a lot of info in there.

Cheers


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 9:35 am 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
That font is 7pt Vera Mono, which came with SUSE I think


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 20, 2006 10:43 am 
Offline
Cacti User

Joined: Fri Jan 20, 2006 10:38 am
Posts: 52
When i import the xml file i have this error :
Code:
Error: XML: Hash version does not exist.


I use cacti 0.8.6.g


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 4:19 am 
Offline
Cacti User

Joined: Fri Jan 20, 2006 10:38 am
Posts: 52
driden91 wrote:
When i import the xml file i have this error :
Code:
Error: XML: Hash version does not exist.


I use cacti 0.8.6.g


No idee .?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 5:52 am 
Offline

Joined: Mon Jan 23, 2006 5:49 am
Posts: 18
driden91 wrote:
When i import the xml file i have this error :
Code:
Error: XML: Hash version does not exist.


I use cacti 0.8.6.g

I run into the same error.
It also says:

Code:
Notice: Only variable references should be returned by reference in /usr/share/cacti/site/lib/import.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/lib/import.php:44) in /usr/share/cacti/site/templates_import.php on line 67


also using 0.8.6.g

Thanks,
Redcap


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 8:03 am 
Offline

Joined: Mon Jan 23, 2006 5:49 am
Posts: 18
I upgraded to 0.8.6h (Debian unstable package), and now I can import without any problems.

Thanks for this nice template!
These memory graphs are finally showing what I want to see ;-)
redcap


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 8:07 pm 
Offline

Joined: Thu Mar 23, 2006 7:55 pm
Posts: 1
I haven't been able to get this report to work, or any other report that involves load average or memory stats. I just don't get any data back from certain MIBs. (ex: .1.3.6.1.4.1.2021.4.6.0)

An snmpwalk shows results such as:

UCD-SNMP-MIB::memAvailReal.0 = No more variables left in this MIB View (It is past the end of the MIB tree)

Other stats and graphs work fine (ex: ethernet traffic) so I know I have snmp and cacti setup correctly.

Is there something I need to do/edit/upgrade on my servers to get these other stats?

Servers are Fedora Core 1.

Any tips/hints would be great.

Thank You,
Rich


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 20, 2006 8:07 pm 
Offline

Joined: Sat May 20, 2006 8:06 pm
Posts: 17
Works beautifully!

Thank you very much!


Top
 Profile  
 
 Post subject: Had to edit the PHP...
PostPosted: Fri Jun 09, 2006 2:45 pm 
Offline
User avatar

Joined: Mon May 15, 2006 11:21 am
Posts: 26
Works like a champ - but in the off chance that someone else runs into the concrete wall that I hit, here goes...

In the PHP file - which I put to the scripts directory. The command-line kept trying to go to /var.... I edited the lines to put the exact path to the binaries referenced and all was well after that...

If someone can give me the proper way to inherit the cacti path - I would be happy to revert - or not - cause I got it to work.

:wink:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 9:38 am 
Offline

Joined: Sat Jun 10, 2006 9:33 am
Posts: 1
intellutions wrote:
I haven't been able to get this report to work, or any other report that involves load average or memory stats. I just don't get any data back from certain MIBs. (ex: .1.3.6.1.4.1.2021.4.6.0)
Rich


What version of snmp are you using?
Did you alter your snmp cpnfiguration to allow viewing of mib data other than [system]?
--dio


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 27, 2006 10:49 am 
Offline

Joined: Mon Jun 19, 2006 8:05 am
Posts: 6
Thank you for an awesome script! Just what I was looking for!

I'm having issues with it not correctly reporting the amount of memory I have...

The graph says I have 885MB, but there's a gig in there.. and here's my meminfo...

Is this expected behavior?

homefileserv ~ # cat /proc/meminfo
MemTotal: 906604 kB
MemFree: 90164 kB
Buffers: 283556 kB
Cached: 279512 kB
SwapCached: 0 kB
Active: 322144 kB
Inactive: 319968 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 906604 kB
LowFree: 90164 kB
SwapTotal: 987988 kB
SwapFree: 987988 kB
Dirty: 24 kB
Writeback: 0 kB
Mapped: 90684 kB
Slab: 168492 kB
CommitLimit: 1441288 kB
Committed_AS: 294220 kB
PageTables: 744 kB
VmallocTotal: 122580 kB
VmallocUsed: 3440 kB
VmallocChunk: 119140 kB


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 3:36 am 
Offline

Joined: Wed Jul 05, 2006 8:24 am
Posts: 42
Location: London, UK
Quote:
homefileserv ~ # cat /proc/meminfo
MemTotal: 906604 kB


That isn't 1Gb - 906604 Kb is 885Mb - divide by 1024. So, the amount reported by the graph is correct - at least as far as your system is concerned.

Assuming this is Linux, I suspect you have a kernel compiled without HIGHMEM support, which limits the available memory for the system. Some memory is reserved for storing kernel data structures that hold information about the memory map and page tables. On x86, this subtracts 128 MB from the 1Gb physical RAM you have installed, as kernel virtual addresses in this 128 MB are mapped to physical memory. If you recompile your kernel with 4Gb HIGHMEM support, you should find the available RAM increases, as the virtual address space has changed.

There's another 10Mb or so missing that I can't account for, but perhaps you have a graphics chipset that shares system RAM or something?

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 9:13 am 
Offline

Joined: Mon Jun 19, 2006 8:05 am
Posts: 6
Right right!

Thanks!

Do you think I should compile that into my kernel or leave it out?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 87 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group