Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


better ucd/net-snmp memory usage -- update Mar 17, 2007
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Thu Jan 12, 2006 2:02 pm    Post subject: better ucd/net-snmp memory usage -- update Mar 17, 2007 Reply with quote

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.



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).

To install and use, import the XML data definition in the zip file, and then copy the netsnmp_memory_usage.php script to your <cacti_path>/scripts/ directory. That should be it.

This templates were exported from Cacti 0.8.6i and use PHP5. Other combinations may not work.



cacti-netsnmp-memory.tar.gz
 Description:

Download
 Filename:  cacti-netsnmp-memory.tar.gz
 Filesize:  7.25 KB
 Downloaded:  2186 Time(s)



Last edited by ehall on Fri May 02, 2008 8:23 pm; edited 4 times in total
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Fri Jan 13, 2006 3:32 am    Post subject: Reply with quote

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,
Back to top
tman
Cacti User


Joined: 14 Oct 2004
Posts: 89

PostPosted: Fri Jan 13, 2006 4:37 am    Post subject: Reply with quote

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
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Fri Jan 13, 2006 9:35 am    Post subject: Reply with quote

That font is 7pt Vera Mono, which came with SUSE I think
Back to top
driden91



Joined: 20 Jan 2006
Posts: 43

PostPosted: Fri Jan 20, 2006 10:43 am    Post subject: Reply with quote

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
Back to top
driden91



Joined: 20 Jan 2006
Posts: 43

PostPosted: Mon Jan 23, 2006 4:19 am    Post subject: Reply with quote

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 .?
Back to top
redcap



Joined: 23 Jan 2006
Posts: 18

PostPosted: Mon Jan 23, 2006 5:52 am    Post subject: Reply with quote

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
Back to top
redcap



Joined: 23 Jan 2006
Posts: 18

PostPosted: Mon Jan 23, 2006 8:03 am    Post subject: Reply with quote

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
Back to top
intellutions



Joined: 23 Mar 2006
Posts: 1

PostPosted: Thu Mar 23, 2006 8:07 pm    Post subject: Reply with quote

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
Back to top
giovanni



Joined: 20 May 2006
Posts: 17

PostPosted: Sat May 20, 2006 8:07 pm    Post subject: Reply with quote

Works beautifully!

Thank you very much!
Back to top
AntiSpoofing



Joined: 15 May 2006
Posts: 26

PostPosted: Fri Jun 09, 2006 2:45 pm    Post subject: Had to edit the PHP... Reply with quote

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.

Back to top
dio



Joined: 10 Jun 2006
Posts: 1

PostPosted: Sat Jun 10, 2006 9:38 am    Post subject: Reply with quote

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
Back to top
carpenike



Joined: 19 Jun 2006
Posts: 6

PostPosted: Sun Aug 27, 2006 10:49 am    Post subject: Reply with quote

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
Back to top
sauron



Joined: 05 Jul 2006
Posts: 42
Location: London, UK

PostPosted: Tue Aug 29, 2006 3:36 am    Post subject: Reply with quote

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
Back to top
carpenike



Joined: 19 Jun 2006
Posts: 6

PostPosted: Wed Aug 30, 2006 9:13 am    Post subject: Reply with quote

Right right!

Thanks!

Do you think I should compile that into my kernel or leave it out?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 



Powered by phpBB © 2001, 2005 phpBB Group