Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate issues with very long RRDtool command lines #2856

Closed
randymendes123 opened this issue Jul 29, 2019 · 15 comments
Closed

Aggregate issues with very long RRDtool command lines #2856

randymendes123 opened this issue Jul 29, 2019 · 15 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@randymendes123
Copy link

randymendes123 commented Jul 29, 2019

Hi all,
I have the same issues, someone can help me to redolve this isues
cacti Version 1.2.5
rrdtool 1.7.1
IOS: UBUNTU 19.0.4

when add more than 498 INTERFACES on the aggragate receive RRdtoll error
please help me to solved this problem.
image

rrdtool_errror.txt
@neclimdul @mhoran @Xake @rlaager @ablyler @netniV help me

@randymendes123
Copy link
Author

@cigamit could you help me with this issue ?

@jav4
Copy link
Contributor

jav4 commented Aug 3, 2019

Command line for rrdtool becomes too long for PHP "popen". Please try this patch:

--- site/lib/rrd.php    2019-07-25 13:03:47.401160762 +0200
+++ site/lib/rrd.php    2019-07-27 13:51:11.809388002 +0200
@@ -261,10 +261,11 @@
        /* output information to the log file if appropriate */
        cacti_log('CACTI2RRD: ' . read_config_option('path_rrdtool') . " $command_line", $log_to_stdout, $logopt, POLLER_VERBOSITY_DEBUG);
 
+       $debug = '';
        /* if we want to see the error output from rrdtool; make sure to specify this */
        if ($config['cacti_server_os'] != 'win32') {
                if ($output_flag == RRDTOOL_OUTPUT_STDERR && !is_resource($rrdtool_pipe)) {
-                       $command_line .= ' 2>&1';
+                       $debug .= ' 2>&1';
                }
        }
 
@@ -285,9 +286,19 @@
 
                session_write_close();
                if (is_file(read_config_option('path_rrdtool')) && is_executable(read_config_option('path_rrdtool'))) {
-                       $fp = popen(read_config_option('path_rrdtool') . escape_command(" $command_line"), $pipe_mode);
-                       if (!is_resource($fp)) {
-                               unset($fp);
+                       $descriptorspec = array(
+                               0 => array('pipe', 'r'),
+                               1 => array('pipe', 'w')
+                       );
+
+                       $process = proc_open(read_config_option('path_rrdtool') . ' - ' . $debug, $descriptorspec, $pipes);
+
+                       if (!is_resource($process)) {
+                               unset($process);
+                       } else {
+                               fwrite($pipes[0], escape_command($command_line));
+                               fclose($pipes[0]);
+                               $fp = $pipes[1];
                        }
                } else {
                        cacti_log("ERROR: RRDtool executable not found, not executable or error in path '" . read_config_option('path_rrdtool') . "'.  No output written to RRDfile.");
@@ -338,14 +349,16 @@
                                $output .= fgets($fp, 4096);
                        }
 
-                       pclose($fp);
+                       fclose($fp);
+                       proc_close($process);
 
                        return $output;
                        break;
                case RRDTOOL_OUTPUT_STDERR:
                        $output = fgets($fp, 1000000);
 
-                       pclose($fp);
+                       fclose($fp);
+                       proc_close($process);
 
                        if (substr($output, 1, 3) == 'PNG') {
                                return 'OK';

@randymendes123
Copy link
Author

hi @jav4
wher i can change this _ could you share the path please ?

@jav4
Copy link
Contributor

jav4 commented Aug 5, 2019

In the root directory of a source tree you just need to execute: patch -p1 <patchfile

If you want to patch an installed version, you need to locate the rrd.php file. In a Debian/Ubuntu installation it'll be at /usr/share/cacti/site/lib

@randymendes123
Copy link
Author

@jav4 see the path below
image

@jav4
Copy link
Contributor

jav4 commented Aug 6, 2019

@randymendes123 in your case rrd.php should be at /var/www/html/cacti/lib

@cigamit
Copy link
Member

cigamit commented Aug 11, 2019

I'm going to dispute that this is either faster or slower than the existing method. You need to provide some validation through citations or better examples before we will merge anything.

@cigamit cigamit added the unverified Some days we don't have a clue label Aug 11, 2019
@rlaager
Copy link
Contributor

rlaager commented Aug 11, 2019

I don’t know why I was tagged here, but... @cigamit, I don’t see any claim about performance being made here. The tentative claim is that the command line is too long and fails outright for that reason.

@cigamit
Copy link
Member

cigamit commented Aug 11, 2019

Oh, my bad, was not reading closely enough.

@cigamit
Copy link
Member

cigamit commented Aug 11, 2019

Can you create a pull request against the 1.2.x branch then?

@cigamit cigamit added bug Undesired behaviour and removed unverified Some days we don't have a clue labels Aug 11, 2019
@randymendes123
Copy link
Author

@jav4
please find in attachment my rrd.php to help me add the code above I can not find some parameters
rrd.zip

@jav4
Copy link
Contributor

jav4 commented Aug 12, 2019

Pull request created.

@cigamit cigamit changed the title Aggregate Issusues Aggregate issues with very long RRDtool command lines Aug 16, 2019
@cigamit cigamit added the resolved A fixed issue label Aug 16, 2019
@cigamit
Copy link
Member

cigamit commented Aug 16, 2019

Resolved.

@cigamit cigamit closed this as completed Aug 16, 2019
@cigamit cigamit added this to the v1.2.6 milestone Aug 16, 2019
@randymendes123
Copy link
Author

@cigamit I am lost, was resolved, whatis the solution?

@netniV
Copy link
Member

netniV commented Aug 19, 2019

This was committed as part of a pull request I believe.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

5 participants