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

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

Moderators: Developers, Moderators

User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

can you try that :

Code: Select all

$ snmpwalk -v 1 -c yourcommunity xx.xx.xx.xx mem
I suspect Net-SNMP does not return the correct values.
[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]
sgn008
Posts: 9
Joined: Tue Apr 10, 2007 12:57 am

Post by sgn008 »

Thanks for the suggestion, I verified that NET-SNMP doesn't work correctly. What would you recommend to fix this.

UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 30169
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 0
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 63798
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 0
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 0
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000
UCD-SNMP-MIB::memShared.0 = INTEGER: 0
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 0
UCD-SNMP-MIB::memCached.0 = INTEGER: 0
UCD-SNMP-MIB::memSwapError.0 = INTEGER: 1
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING: Running out of swap space (0)
sgn008
Posts: 9
Joined: Tue Apr 10, 2007 12:57 am

Post by sgn008 »

Hello,

I managed to get NET-SNMP installed onto my Suse Server from source code. Now snmpwalk -v 1 -c public xx.xx.xx.xx mem works for me.

However, the graph shows all the number in "nan". I also tried to play around with sql forum post

mysql> select count(*) from poller_output;
mysql> truncate table poller_output;

These above commands are supposed to be taking care of the no graph or "nan" value issue.

Thankx
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Could you delete the associated .rrd files ?
[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]
sgn008
Posts: 9
Joined: Tue Apr 10, 2007 12:57 am

Post by sgn008 »

It turned out pre-installed SNMP on SuSE 9 is not working properly.
I have to install net-snmp 5.4 source packages in order to graph properly.
The default SNMP 5.4 build doesn't include MIB modules, i need to enable-ucd-snmp-compatibility option.
snmpwalk -v 1 -c public xx.xx.xx.xx .1.3.6.1.2.1.25.2.2.0
Returned value
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 65329680 Kbytes

Then I execute
/usr/local/php/bin/php -q netsnmp_memory_usage.php xx.xx.xx.xx, public, 1, , , 161, 500

Now everything works well.

Thanks for the suggestion
rodolphedj
Posts: 39
Joined: Tue Apr 17, 2007 8:25 am

Post by rodolphedj »

Good stuff !

No problem with OpenBSD devices.

But have you an idea about traffic templates :
If I want use Data Query [SNMP - Interface Statistics] for create graph, I have like message error : "WARNING: Result from SNMP not valid. Partial Result:" only with an OpenBSD device.

Post : http://forums.cacti.net/viewtopic.php?t=20761
changsung
Posts: 17
Joined: Wed Feb 21, 2007 10:26 am
Contact:

Problem with running the scriupt

Post by changsung »

php -q ./netsnmp_memory_usage.php hostname, public, 1, , , 161, 500
is returning "failed: malformed output"

Can someone tell me what his means?
Cain
Posts: 16
Joined: Wed Sep 22, 2004 12:05 pm
Location: Cleveland, OH

Post by Cain »

I am getting the same "malformed output" when I run the script manually. I checked all the OIDs on my Solaris 8 box and all returned values except for the last two.

[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.2.1.25.2.2.0
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 1048576 KBytes
[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.4.1.2021.4.6.0
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 209272
[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.4.1.2021.4.3.0
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 2099184
[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.4.1.2021.4.4.0
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 2099184
[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.4.1.2021.4.14.0
[ ~]$ snmpwalk -v1 -c public 10.2.2.70 .1.3.6.1.4.1.2021.4.15.0

From reading the code it looks like it is a defense measure to stop processing if any value does not return a real value. The membuffer and memcache are probably not supported on Solaris. Is there a way to get the script to process the data anyway?

Thanks!

Matthew
It is always easy when you know how to do it.
Rael
Cacti User
Posts: 129
Joined: Thu Apr 05, 2007 9:28 am

Post by Rael »

Maybe I missed it and this has already been addressed, but my mem is showing k/M instead of M/G in regards to the numbers being shown.

IE: 401k of buffers used when it should be 401M and 8M freemem when it should be 8G

Any clues?
Rael
Cacti User
Posts: 129
Joined: Thu Apr 05, 2007 9:28 am

Post by Rael »

Nevermind. Changed CDEF function on all graphs to use Multiply by 1024
ferrero_sergio
Posts: 27
Joined: Tue Sep 11, 2007 6:33 am

Problem memory graphs

Post by ferrero_sergio »

I have just put control yourself of the memory(report) but now I have a problem...
When it(he,she) paints the graphs to me in the values "Nan" goes out for me always and the graph remains in white(target).
I have put the script inside path_cacti/scrtips/
Some help
super-hornet
Cacti User
Posts: 175
Joined: Sun May 27, 2007 5:42 pm

Post by super-hornet »

To all

This script need to be modified in order to run on cacti 0.8.7

Prior to 0.8.7, the configuration information is stored in config.php. In 0.8.7, most of the information previously in config.php are moved to global.php.

In this 0.8.7, in order to use php snmp call, it require more information.
Thus here is the modification on "netsnmp_memory_usage.php:
# -------------------------------------------------------------------------------

#
# cacti script to read ucd/net-snmp memory usage data with SNMP
#
# uses the basic HOST MIB for phys memory due to swap weirdness in FreeBSD handling
#
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../include/global.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

#
# global declarations
#
...
...
...
...
$cmdoutputcount = 0;

#
# run the program
#

while ($cmdoutputcount < count($oid)) {

$cmdoutput[$cmdoutputcount] = cacti_snmp_get($snmp_hostname,
$snmp_community,
$oid[$cmdoutputcount][1],
$snmp_version,
$snmp_username,
$snmp_password,
"",
"",
"",
"",
$snmp_port,
$snmp_timeout);

#
# make sure the data is not null
#
if (trim($cmdoutput[$cmdoutputcount]) == "") {

echo ("failed: malformed output \n");

exit(1);
}
..
..
..
# ---------------------------------------------------------------------------------


I also attached to complete modification file.

SH
Attachments
netsnmp_memory_usage.php.gz
(1.66 KiB) Downloaded 915 times
Smux
Posts: 40
Joined: Mon Sep 10, 2007 2:47 pm

Post by Smux »

super-hornet, i change to the new php script, and via shell i got receive the infos, but this not send to graph

http://sysmon.forbrazil.com.br/cacti/gr ... 3&rra_id=0

Can you help-me? I use the original template.
toneworks
Posts: 1
Joined: Mon Oct 29, 2007 5:39 am

Post by toneworks »

Hi super-hornet,

I firgured out the exact same modifications myself, but they do not work with SNMPv3, or do they at your server?
ferrero_sergio
Posts: 27
Joined: Tue Sep 11, 2007 6:33 am

Post by ferrero_sergio »

super-hornet!!!
I continue with the same problem of before, when I throw the script it works perfectly but then it does not paint anything in the graphs.
I have put the .php that you have left in the web page.
I need help please
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest