better ucd/net-snmp memory usage -- update June 21 2009
Moderators: Developers, Moderators
I've uploaded a new version of the script that addresses some of the problems that have been reported. The script should now work with 0.8.6 and 0.8.7 and should not NAN as often. However it does not currently support the 0.8.7 SNMPv3 interface due to command-line length restrictions in Cacti. I will try to rearchitect and fix this in the next update.
I posted a new version of the script with many significant enhancements. The biggest change is a switch from the expensive and slow script query interface to the persistent and fast script server interface. I also dropped the comma-separated parameters and switched to a colon-separated "bundle" for SNMP arguments, tightened up the array and variable management, added a lot more error checking, and otherwise did a complete rewrite of the script.
Due to the changes, the script and resource xml files need to be reinstalled and any data queries need to be reimported. However the existing graphs and data sources should continue to operate afterwards.
I've also moved the files to this page on my web server so that I can more easily maintain them
Due to the changes, the script and resource xml files need to be reinstalled and any data queries need to be reimported. However the existing graphs and data sources should continue to operate afterwards.
I've also moved the files to this page on my web server so that I can more easily maintain them
issues when running via poller, but command line works
First off, thank you for writing the xml template as well as the script. I can get it to run on the command line, but when it is executed via Cacti, I get the following:
SERVER: /usr/share/cacti/scripts/ss_netsnmp_memory.php ss_netsnmp_memory hostname:2:community:admin:test:MD5::DES::161:500, output: Syntax: ss_netsnmp_memory.php <hostname>:<snmp_version>:[<snmp_community>]:\
php /usr/share/cacti/scripts/ss_netsnmp_memory.php hostname:2:community:admin:test:MD5::DES::161:500
totalReal:2072640 availReal:1240436 totalSwap:2031608 availSwap:1801524 memBuffer:47900 memCached:673392 usedReal:110912 usedSwap:230084
I am stumped, and I was wondering if you could give some guidance, if it's not too troubling.
cacti version 0.8.7d
php 5.1
SERVER: /usr/share/cacti/scripts/ss_netsnmp_memory.php ss_netsnmp_memory hostname:2:community:admin:test:MD5::DES::161:500, output: Syntax: ss_netsnmp_memory.php <hostname>:<snmp_version>:[<snmp_community>]:\
php /usr/share/cacti/scripts/ss_netsnmp_memory.php hostname:2:community:admin:test:MD5::DES::161:500
totalReal:2072640 availReal:1240436 totalSwap:2031608 availSwap:1801524 memBuffer:47900 memCached:673392 usedReal:110912 usedSwap:230084
I am stumped, and I was wondering if you could give some guidance, if it's not too troubling.
cacti version 0.8.7d
php 5.1
-
- Cacti User
- Posts: 175
- Joined: Sun May 27, 2007 5:42 pm
Hi bunkzilla
Since you are using cacti 0.8.7d, there is a bug regarding about importing scripts.
See this:
http://forums.cacti.net/about32035.html&highlight=
Please double check your "Data Input Methods" for the "ucd/net - Memory Usage"
The correct "Input String" should be:
<path_cacti>/scripts/ss_netsnmp_memory.php ss_netsnmp_memory <hostname>:<snmp_ver>:<snmp_community>:<snmp3_username>:<snmp3_password>:<snmp3_authprot>:<snmp3_privpass>:<snmp3_privprot>:<snmp3_context>:<snmp_port>:<snmp_timeout>
Take note that I now using cacti 0.8.7e and it still has the same bug.
SH
Since you are using cacti 0.8.7d, there is a bug regarding about importing scripts.
See this:
http://forums.cacti.net/about32035.html&highlight=
Please double check your "Data Input Methods" for the "ucd/net - Memory Usage"
The correct "Input String" should be:
<path_cacti>/scripts/ss_netsnmp_memory.php ss_netsnmp_memory <hostname>:<snmp_ver>:<snmp_community>:<snmp3_username>:<snmp3_password>:<snmp3_authprot>:<snmp3_privpass>:<snmp3_privprot>:<snmp3_context>:<snmp_port>:<snmp_timeout>
Take note that I now using cacti 0.8.7e and it still has the same bug.
SH
I have verified my data input string is what is specified above. I guess because I cut and paste to do the import, I did not run into the issue with the missing <>
Any other suggestions on what this could be?
I'm going to try to add some debugging lines to the php script to see what exactly it is receiving.
Any other suggestions on what this could be?
I'm going to try to add some debugging lines to the php script to see what exactly it is receiving.
What's weird to me is that you get the syntax message without a preceding error. Every call of the syntax function is preceded by an error, so if you are getting the syntax message WITHOUT an error then you are apparently falling into the syntax function from the main function without getting an error. Did you edit the script?
explode function
Hi guys !
I ve modifed , the data input method in order to have parameters separated with # instead of : .
As well I ve modified the explode function in order to split the parameters with # instead of : .
The reason is that my remote server is defined as tcp:xxx.xxx.xxx.xxx so my hostname was 'exploded' by the script giving error messages as :
CMDPHP: Poller[0] Host[11] DS[67] WARNING: Result from SERVER not valid. Partial Result: FATAL: Too many elements
Now it works perfectly .
SammIO
(Cacti newbie)
I ve modifed , the data input method in order to have parameters separated with # instead of : .
As well I ve modified the explode function in order to split the parameters with # instead of : .
The reason is that my remote server is defined as tcp:xxx.xxx.xxx.xxx so my hostname was 'exploded' by the script giving error messages as :
CMDPHP: Poller[0] Host[11] DS[67] WARNING: Result from SERVER not valid. Partial Result: FATAL: Too many elements
Now it works perfectly .
SammIO
(Cacti newbie)
Re: better ucd/net-snmp memory usage -- update June 21 2009
Since install of this template I can't see any data income in RRA and Graphs - only zeros.
After a long investigation I found a problem on my config.
Every host has SNMP timeout 3000 ms. It seams this script has problems with such big timeouts.
So I set it to 2000 ms and data start collecting.
After a long investigation I found a problem on my config.
Every host has SNMP timeout 3000 ms. It seams this script has problems with such big timeouts.
So I set it to 2000 ms and data start collecting.
-
- Posts: 15
- Joined: Tue Oct 17, 2006 10:27 pm
Re: better ucd/net-snmp memory usage -- update June 21 2009
Hello,
Bit of a late update on this thread.
But I've been watching my poller runtime and notice it exceeds the default 300 seconds quite regularly.
Digging into it further, uncovers the following:
And the only script/server script I have running is this memory graph.
Anyway, I hope I've interpreted things correctly.
Has anyone else had this experience?
Bit of a late update on this thread.
But I've been watching my poller runtime and notice it exceeds the default 300 seconds quite regularly.
Digging into it further, uncovers the following:
Code: Select all
cacti 6161 1 0 09:00 ? 00:00:00 /usr/bin/php -q /var/www/cacti/cmd.php 354 411
cacti 6196 6161 0 09:00 ? 00:00:00 /usr/bin/php -q /var/www/cacti/script_server.php cmd
cacti 12598 1 0 08:10 ? 00:00:00 /usr/bin/php -q /var/www/cacti/cmd.php 489 503
cacti 12628 12598 0 08:10 ? 00:00:00 /usr/bin/php -q /var/www/cacti/script_server.php cmd
cacti 16725 1 0 09:20 ? 00:00:00 /usr/bin/php -q /var/www/cacti/cmd.php 159 265
cacti 16754 16725 0 09:20 ? 00:00:00 /usr/bin/php -q /var/www/cacti/script_server.php cmd
cacti 23084 1 0 08:30 ? 00:00:00 /usr/bin/php -q /var/www/cacti/cmd.php 123 157
cacti 23115 23084 0 08:30 ? 00:00:00 /usr/bin/php -q /var/www/cacti/script_server.php cmd
Anyway, I hope I've interpreted things correctly.
Has anyone else had this experience?
Re: better ucd/net-snmp memory usage -- update June 21 2009
Hi!
I am having problems getting this template to work with cacti 1.1.21.
Here is the error that poller gets:
SCRIPT: /var/www/html/cacti-1.1.21/scripts/ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500', output: FATAL: No SNMP parameter bundle provided
Syntax: ss_netsnmp_memory.php <hostname>:<snmp_version>:[<snmp_community>]:\
[<snmp3_username>]:[<snmp3_password>]:[<snmp3_auth_protocol>]:[<snmp3_priv_password>]:\
[<snmp3_priv_protocol>]:[<snmp32017-09-10 18:44:32 - SPINE: Poller[1] Device[9] TH[1] DS[237] SS[0] SERVER: /var/www/html/cacti-1.1.21/scripts/ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500', output: U
It seems that there are quotes added to the data input method. I also red from here that this could be sql injection protection. I am using mariadb 10.1.
viewtopic.php?f=2&t=57577
To get it work I can modify directly inside database the poller_item but would be great to get it done automatically.
Has anyone got it working with newer cacti/mariadb?
Rene
I am having problems getting this template to work with cacti 1.1.21.
Here is the error that poller gets:
SCRIPT: /var/www/html/cacti-1.1.21/scripts/ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500', output: FATAL: No SNMP parameter bundle provided
Syntax: ss_netsnmp_memory.php <hostname>:<snmp_version>:[<snmp_community>]:\
[<snmp3_username>]:[<snmp3_password>]:[<snmp3_auth_protocol>]:[<snmp3_priv_password>]:\
[<snmp3_priv_protocol>]:[<snmp32017-09-10 18:44:32 - SPINE: Poller[1] Device[9] TH[1] DS[237] SS[0] SERVER: /var/www/html/cacti-1.1.21/scripts/ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500', output: U
It seems that there are quotes added to the data input method. I also red from here that this could be sql injection protection. I am using mariadb 10.1.
viewtopic.php?f=2&t=57577
To get it work I can modify directly inside database the poller_item but would be great to get it done automatically.
Has anyone got it working with newer cacti/mariadb?
Rene
Re: better ucd/net-snmp memory usage -- update June 21 2009
As mentioned here I have produced a working 1.x version of this graph. I've also sent Eric an email about it to see if there are any issues with this.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
-
- Cacti User
- Posts: 151
- Joined: Mon Feb 05, 2007 3:57 am
- Location: Munich, Germany
Re: better ucd/net-snmp memory usage -- update June 21 2009
Hello,
with php7 the script does not produce any output at all anymore:
[helmut@BSDHelmut /var/www/cacti]$ sudo /usr/local/bin/php -q /var/www/cacti/scripts/netsnmp_memory_usage.php
[helmut@BSDHelmut /var/www/cacti]$
[helmut@BSDHelmut /var/www/cacti]$ php -v
PHP 7.0.27 (cli) (built: Jan 10 2018 18:37:56) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
[helmut@BSDHelmut /var/www/cacti]$
[helmut@BSDHelmut /var/www/cacti]$ uname -a
FreeBSD BSDHelmut.charlieroot.de 11.1-RELEASE-p6 FreeBSD 11.1-RELEASE-p6 #0 r326851: Thu Dec 14 17:36:23 CET 2017 root@BSDHelmut.charlieroot.de:/usr/obj/usr/src/sys/GENERIC-PF-ALTQ amd64
[helmut@BSDHelmut /var/www/cacti]$
If I comment out
include(dirname(__FILE__) . "/../include/global.php");
I at least get some output:
[helmut@BSDHelmut /var/www/cacti]$ sudo /usr/local/bin/php -q /var/www/cacti/scripts/netsnmp_memory_usage.php
failed: insufficient parameters provided
syntax: /var/www/cacti/scripts/netsnmp_memory_usage.php <hostname>, [<snmp_community>], <snmp_version>,
[<snmp3_username>], [<snmp3_password>], <snmp_port>, <snmp_timeout>
[helmut@BSDHelmut /var/www/cacti]$
with php7 the script does not produce any output at all anymore:
[helmut@BSDHelmut /var/www/cacti]$ sudo /usr/local/bin/php -q /var/www/cacti/scripts/netsnmp_memory_usage.php
[helmut@BSDHelmut /var/www/cacti]$
[helmut@BSDHelmut /var/www/cacti]$ php -v
PHP 7.0.27 (cli) (built: Jan 10 2018 18:37:56) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
[helmut@BSDHelmut /var/www/cacti]$
[helmut@BSDHelmut /var/www/cacti]$ uname -a
FreeBSD BSDHelmut.charlieroot.de 11.1-RELEASE-p6 FreeBSD 11.1-RELEASE-p6 #0 r326851: Thu Dec 14 17:36:23 CET 2017 root@BSDHelmut.charlieroot.de:/usr/obj/usr/src/sys/GENERIC-PF-ALTQ amd64
[helmut@BSDHelmut /var/www/cacti]$
If I comment out
include(dirname(__FILE__) . "/../include/global.php");
I at least get some output:
[helmut@BSDHelmut /var/www/cacti]$ sudo /usr/local/bin/php -q /var/www/cacti/scripts/netsnmp_memory_usage.php
failed: insufficient parameters provided
syntax: /var/www/cacti/scripts/netsnmp_memory_usage.php <hostname>, [<snmp_community>], <snmp_version>,
[<snmp3_username>], [<snmp3_password>], <snmp_port>, <snmp_timeout>
[helmut@BSDHelmut /var/www/cacti]$
Re: better ucd/net-snmp memory usage -- update June 21 2009
If you remove the -q, do you see anything more once you've added the include back in?
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
-
- Cacti User
- Posts: 151
- Joined: Mon Feb 05, 2007 3:57 am
- Location: Munich, Germany
Re: better ucd/net-snmp memory usage -- update June 21 2009
No:
[helmut@BSDHelmut ~]$ sudo /usr/local/bin/php /var/www/cacti/scripts/ss_netsnmp_memory.php ss_netsnmp_mem
ory '192.168.0.10':'2':'public':'':'':::::'161':'500'
[helmut@BSDHelmut ~]$ sudo grep include /var/www/cacti/scripts/netsnmp_memory_usage.php
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../include/global.php");
include(dirname(__FILE__) . "/../lib/snmp.php");
[helmut@BSDHelmut ~]$
# /usr/local/bin/php ./ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500'
#
[helmut@BSDHelmut ~]$ sudo /usr/local/bin/php /var/www/cacti/scripts/ss_netsnmp_memory.php ss_netsnmp_mem
ory '192.168.0.10':'2':'public':'':'':::::'161':'500'
[helmut@BSDHelmut ~]$ sudo grep include /var/www/cacti/scripts/netsnmp_memory_usage.php
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../include/global.php");
include(dirname(__FILE__) . "/../lib/snmp.php");
[helmut@BSDHelmut ~]$
# /usr/local/bin/php ./ss_netsnmp_memory.php ss_netsnmp_memory '192.168.0.10':'2':'public':'':'':::::'161':'500'
#
Who is online
Users browsing this forum: No registered users and 4 guests