better ucd/net-snmp memory usage -- update June 21 2009

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

sauron
Posts: 42
Joined: Wed Jul 05, 2006 8:24 am
Location: London, UK

Post by sauron »

By all means compile it in. The downsides are minimal, and you get another 150 or so Mb usable memory.
carpenike
Posts: 6
Joined: Mon Jun 19, 2006 8:05 am

Post by carpenike »

Excellent, that fixed it!

Thanks!

Code: Select all

homefileserv ~ # cat /proc/meminfo
MemTotal:      1036564 kB
MemFree:        865200 kB
Buffers:         21236 kB
Cached:          42736 kB
SwapCached:          0 kB
Active:         119840 kB
Inactive:        38176 kB
HighTotal:      131008 kB
HighFree:          256 kB
LowTotal:       905556 kB
LowFree:        864944 kB
SwapTotal:      987988 kB
SwapFree:       987988 kB
Dirty:              36 kB
Writeback:           0 kB
Mapped:         105328 kB
Slab:             7832 kB
CommitLimit:   1506268 kB
Committed_AS:   304852 kB
PageTables:        744 kB
VmallocTotal:   114680 kB
VmallocUsed:      3440 kB
VmallocChunk:   111240 kB
ts77
Posts: 2
Joined: Wed Jan 31, 2007 3:28 pm

Post by ts77 »

any known problems with net-snmp 5.4?

out of the blue after upgrading net-snmp to 5.4 (on the cacti-box) I got all memory graphs at 100% real memory used and when trying the script I get output like that:

Code: Select all

 php ./netsnmp_memory_usage.php tcp:127.0.0.1, public, 1, , , 16109, 500
totalReal:3082408 availReal:0 totalSwap:0 availSwap:0 memBuffer:0 memCached:0 usedReal:3082408 usedSwap:0
Any ideas what went wrong here and how to solve this?

thanks,

thomas
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

[post deleted--it was in the wrong thread entirely]
Last edited by ehall on Wed Feb 07, 2007 10:24 am, edited 1 time in total.
ts77
Posts: 2
Joined: Wed Jan 31, 2007 3:28 pm

Post by ts77 »

Hmm, I recompiled net-snmp now with lm_sensors but strange thing is, I didn't even have lm_sensors installed before.
Is that really required on the cacti-machine or more on the remote machines which are monitored.

restarted net-snmp on the cacti-machine now but I still get

Code: Select all

snmpwalk -v 2c -c public 192.168.115.11 .1.3.6.1.4.1.2021.13.16
LM-SENSORS-MIB::lmSensors = No Such Object available on this agent at this OID
guess I have to read up more how to enable lm_sensors if thats really what is needed here.
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

[post deleted--it was in the wrong thread entirely]
Last edited by ehall on Wed Feb 07, 2007 10:24 am, edited 1 time in total.
davibou
Posts: 6
Joined: Mon Feb 05, 2007 11:48 am

Post by davibou »

I have a problem whith this script ...

When i do
php -q netsnmp_memory_usage.php 127.0.0.1, public, 1, , , 161, 500

it give me that

totalReal:254848 availReal:19128 totalSwap:524280 availSwap:483900 memBuffer:10124 memCached:50516 usedReal:175080 usedSwap:40380


But the pooler write warning in the log , grph is showing nothing

Code: Select all

02/05/2007 08:35:02 PM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /opt/cacti/scripts/linux_memory.pl MemFree:, output: 13128

 02/05/2007 08:35:04 PM - CMDPHP: Poller[0] Host[1] DS[107] CMD: php /opt/cacti/scripts/netsnmp_memory_usage.php 127.0.0.1, public, 1, , , 161, 500, output: U

02/05/2007 08:35:04 PM - CMDPHP: Poller[0] Host[1] DS[107] WARNING: Result from CMD not valid. Partial Result: Content-type: text/html
X-Powered-By: PHP/4.3.9

What could i do ??
User avatar
exploit-soget
Posts: 40
Joined: Tue Jan 23, 2007 5:31 am

Post by exploit-soget »

I have exactly the same problem.
When I do this command :

/usr/local/bin/php netsnmp_memory_usage.php superexpl, public, 1, , , 161, 500
totalReal:2052988 availReal:43952 totalSwap:4200956 availSwap:4200944 memBuffer:317168 memCached:1017712 usedReal:674156 usedSwap:12

BUT NOTHING IS GRAPH AND RRDTOOL SAYS OK IN THE DEBUG MODE :o :o
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

The posted update contains a fix that converts the SNMP timeout value from Cacti's millisecond format to PHP/Net-SNMP microsecond format. The lack of conversion in the earlier script would sometimes result in excessive retries or complete failure.
Yzo
Posts: 3
Joined: Tue May 16, 2006 4:26 pm

Post by Yzo »

I'm also having the same problem that ts77 reported in his post of 1/31/07.

The PHP script is no longer reporting the proper values for availReal, totalSwap, availSwap, memBuffer, memCached, usedReal, and usedSwap. The only value that is accurate is totalReal.

Example:

Code: Select all

$ php netsnmp_memory_usage.php 127.0.0.1, public, 2, , , 161, 500
totalReal:2067456 availReal:0 totalSwap:0 availSwap:0 memBuffer:0 memCached:0 usedReal:2067456 usedSwap:0
If I manually walk the OIDs the script is checking for, I do get the proper values returned.

Examples:

Code: Select all

$ snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.4.15.0
UCD-SNMP-MIB::memCached.0 = INTEGER: 1427728 kB

$ snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.4.14.0
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 59492 kB

$ snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.4.6.0
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 114640 kB
Here the output of free:

Code: Select all

$ free
             total       used       free     shared    buffers     cached
Mem:       2067456    1984120      83336          0      61224    1448452
-/+ buffers/cache:     474444    1593012
Swap:      1959920        220    1959700
Like ts77, this seems to have started immediately after an update to Net-SNMP 5.4. Downloading the updated script has not helped.

....

Actually, after looking over the script one more time and looking at what I pasted into this post, it looks like the Net-SNMP update has now caused all the OIDs to report "kB" after every value instead of just after totalReal.

After commenting out the IF/ELSE statement in the script so that all the OIDs get parsed, the output seems to be back to normal.

Code: Select all

$ php netsnmp_memory_usage.php 127.0.0.1, public, 2, , , 161, 500
totalReal:2067456 availReal:72428 totalSwap:1959920 availSwap:1959700 memBuffer:62976 memCached:1471788 usedReal:460264 usedSwap:220
Not sure if this calls for a script update, or if I should just find a way to get snmp not to but kBs at the ends of those values.
Suhy
Posts: 2
Joined: Mon Mar 12, 2007 12:08 pm

Post by Suhy »

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)

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?
I have similar problem :(

I don't get anything from graph..
if i run php poller manualy i get :: ERROR: Not enough arguments
Im using centos 4.4 and net-snmp 5.1.2-11el4.7..also i have cacti 0.8.6j

how do i alter snmp cpnfiguration to allow viewing of mib data other than [system]?
pheldens
Posts: 8
Joined: Thu Mar 15, 2007 1:19 pm

Post by pheldens »

change "netsnmp_memory_usage.php" from line 176 to the following to fix "0" output in newer net-snmp.

Code: Select all

        #
        # make sure the data only contains numbers
        #
        if (is_numeric($cmdoutput[$cmdoutputcount]) == FALSE) {

        //      #
        //      # the totalReal OID appends "KBytes" to the value, so eliminate it
        //      #
        //      if ($oid[$cmdoutputcount][0] == "totalReal") {

                        $cmdoutput[$cmdoutputcount] = intval($cmdoutput[$cmdoutputcount]);
        //      }

        //      else {
        //              $cmdoutput[$cmdoutputcount] = 0;
        //      }
        }
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

I uploaded a new tar.gz which contains an updated script that should fix the problem. If the value is not numeric, it checks to see if the trailing characters are "kB" or "KBytes".
Suhy
Posts: 2
Joined: Mon Mar 12, 2007 12:08 pm

Post by Suhy »

Problem still remains. :(

i can import both templates, and i copy php file, after that i chmod to cactiuser on php file, but graph is empty, and php poler.php shows: ERROR: Not enough arguments

i hope this will be implemented in next cacti version
sgn008
Posts: 9
Joined: Tue Apr 10, 2007 12:57 am

Post by sgn008 »

Hi,

Does anyone having problem when graph memory on SuSe Linux 64GB ?

Apparently my graph shows that all 64GB is shown as Real Usage. There is no "Buffer", "Cache", "Free". This contradicts with my top command.

By the way, I use this template with RedHat ES 16GB with no problem.

Any suggestion is greatly appreciated.
Attachments
All physical memory is shown as Real Usage
All physical memory is shown as Real Usage
suse_ucd_memory_usage.png (28.34 KiB) Viewed 12807 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests