better ucd/net-snmp memory usage -- update June 21 2009
Moderators: Developers, Moderators
better ucd/net-snmp memory usage -- update June 21 2009
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).
--> see this page for the tarball and instructions <--
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.
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
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 :
instead of
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,
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: Select all
$ 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
Code: Select all
$ 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
Regards,
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
When i import the xml file i have this error :
I use cacti 0.8.6.g
Code: Select all
Error: XML: Hash version does not exist.
No idee .?driden91 wrote:When i import the xml file i have this error :I use cacti 0.8.6.gCode: Select all
Error: XML: Hash version does not exist.
I run into the same error.driden91 wrote:When i import the xml file i have this error :I use cacti 0.8.6.gCode: Select all
Error: XML: Hash version does not exist.
It also says:
Code: Select all
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
Thanks,
Redcap
-
- Posts: 1
- Joined: Thu Mar 23, 2006 7:55 pm
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
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
- AntiSpoofing
- Posts: 26
- Joined: Mon May 15, 2006 11:21 am
Had to edit the PHP...
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.
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.
What version of snmp are you using?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
Did you alter your snmp cpnfiguration to allow viewing of mib data other than [system]?
--dio
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
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
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.homefileserv ~ # cat /proc/meminfo
MemTotal: 906604 kB
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
Who is online
Users browsing this forum: No registered users and 1 guest