HOWTO Speed UP cmd.php ???

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
dbenders
Posts: 28
Joined: Mon Oct 14, 2002 2:02 pm
Location: Santiago, CHILE

HOWTO Speed UP cmd.php ???

Post by dbenders »

Hi, currently I have lot of monitors and the script cmd.php get too many time to do all the job, that at the crontab start a new process. The problem is that after a while, I have too many process and the server slow down until it crash.

I hear about alternatives to cmd.php that are faster, because are written in C/C++.

Any documentation in how to implement that?

BTW, CACTI is the best RRD fron end as I know, so thanks to Ian for his dedication in beneffit to all.
lorcro2000
Posts: 5
Joined: Tue Sep 07, 2004 5:20 am

Post by lorcro2000 »

the cactid program is included at least in the 0.8.5 version I have. Just cd to the cactid subdirectory, do a configure and make and use that.

There is even an example cactid.conf file you can edit and then use.

Just add it to the crontab instead of the php command you're using now.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

We have addressed scalability issues with cmd.php in 0.8.6 due to be released in the next few days (and I mean it this time for others who have heard this before).

In 0.8.6 we have adopted a new poller architecture that allows from 1-n cmd.php processes to be run in paralell/concurrently.

In future releases we will also support separate polling servers. How bout' that?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
kelp
Posts: 3
Joined: Wed Sep 15, 2004 7:08 pm

Post by kelp »

If you put this line:

MIBS=""

In the crontab you use to run poller.php you should see about a 4-6x performance increase.
User avatar
Burke
Posts: 42
Joined: Tue Nov 05, 2002 7:22 am
Location: Virginia, USA
Contact:

Post by Burke »

kelp wrote:If you put this line:

MIBS=""

In the crontab you use to run poller.php you should see about a 4-6x performance increase.
Please elaborate; what does this actually do? Does that prevent the script from looking up the text values of the OIDs - I thought that was getting handled already through switches to the walk & get portions of the SNMP queries.

Thanks,
Burke - MCP+I, MCSE, MCSD, CNE, CCA, CCNA, LPIC-1
[url=http://www.technicalvalues.com]My Website[/url] ::[url=http://www.technicalvalues.net]Domain Registrations, SSL Certs, and Hosting[/url]
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

If you use external snmp support each time snmpget is run it loads and parses default MIB files. It takes some time causing longer startup. If you set MIBS variable to empty string snmpget will not load any file therefore you save some time. cmd.php launching snmpget often can work faster this way. The same can be done by using -m '' option of snmpget.

- Piotr
Mikf
Posts: 47
Joined: Fri Aug 13, 2004 11:35 am
Location: Paris, France

Post by Mikf »

thanks for the info
poller.php before : 57 s (using cmd.php)

after using the '-m "" ' option : 25s

how to :
edit the lib/snmp.php
line 72 and 74 :
if (read_config_option("snmp_version") == "ucd-snmp") {
exec(read_config_option("path_snmpget") . " -m \"\" -O vt -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid", $snmp_value);
}elseif (read_config_option("snmp_version") == "net-snmp") {
exec(read_config_option("path_snmpget") . " -m \"\" -O vt $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid", $snmp_value);
lines 123 and 125 :
if (read_config_option("snmp_version") == "ucd-snmp") {
$temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -m \"\" -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid");
}elseif (read_config_option("snmp_version") == "net-snmp") {
$temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -m \"\" $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid");
}
Last edited by Mikf on Wed Oct 20, 2004 1:12 pm, edited 4 times in total.
User avatar
Burke
Posts: 42
Joined: Tue Nov 05, 2002 7:22 am
Location: Virginia, USA
Contact:

Post by Burke »

Thanks for the extra detail --- Is there a particular reason this cannot be included in the next release? Will it break anything? If it doesn't break anything, it seems like a great little add to the source.
Burke - MCP+I, MCSE, MCSD, CNE, CCA, CCNA, LPIC-1
[url=http://www.technicalvalues.com]My Website[/url] ::[url=http://www.technicalvalues.net]Domain Registrations, SSL Certs, and Hosting[/url]
User avatar
Burke
Posts: 42
Joined: Tue Nov 05, 2002 7:22 am
Location: Virginia, USA
Contact:

Post by Burke »

Maybe I found a particular reason... This may not work on all systems.. Are you using UCD or NET snmp?

The system I'm on is using UCD and this didn't appear to do anything for mine. I'm still doing further tests, but so far, no improvements :(

Tried making the entry in crontab - that resulted in all results from CMD being not valid.

Tried the -m MIB -- didn't cause additional errors, but didn't improve performance for me :(

cacti 0.8.6b / Mandrake 9.0 / ucd-snmp-4.2.3-4mdk / apache 1.3.26-6.1mdk
Approx 535 Data Sources being updated. Current Time is 127.7581 s according to the SYSTEM STATS output.
Burke - MCP+I, MCSE, MCSD, CNE, CCA, CCNA, LPIC-1
[url=http://www.technicalvalues.com]My Website[/url] ::[url=http://www.technicalvalues.net]Domain Registrations, SSL Certs, and Hosting[/url]
Mikf
Posts: 47
Joined: Fri Aug 13, 2004 11:35 am
Location: Paris, France

Post by Mikf »

oups!! ucd-snmp is using -m, but not the same syntax:
-m "" is the good one

i have edited the code in the previous post, but i cannot test it
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Please post the code once changed and I will get into CVS for 0.8.7.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Mikf
Posts: 47
Joined: Fri Aug 13, 2004 11:35 am
Location: Paris, France

Post by Mikf »

This code is working with net-snmp and ucd-snmp
but i cannot test it for ucd-snmp
(-m "" option is working in command line for both)

edit the lib/snmp.php
line 72 and 74 :
if (read_config_option("snmp_version") == "ucd-snmp") {
exec(read_config_option("path_snmpget") . " -m \"\" -O vt -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid", $snmp_value);
}elseif (read_config_option("snmp_version") == "net-snmp") {
exec(read_config_option("path_snmpget") . " -m \"\" -O vt $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid", $snmp_value);
lines 123 and 125 :
if (read_config_option("snmp_version") == "ucd-snmp") {
$temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -m \"\" -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid");
}elseif (read_config_option("snmp_version") == "net-snmp") {
$temp_array = exec_into_array(read_config_option("path_snmpwalk") . " -m \"\" $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid");
}
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Mikf,

Unfortunately, this method of performing an SNMPGET or SNMPWALK will fail for some text strings and result in an assertion failure when you select "Verify All Fields" for the reindex type.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ok, this thing is getting real frustrating. It now turns out that the environment variable MIBS=ALL is causing the problem. It turns out that the RFC1213 mib is over writing the IF-MIB causing the text to be displayed as HEX.

Therefore, the fix is to remove the MIBS=ALL entirely. This will resolve the issue. As such, we should be able to add the speedup parameter.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest