Re: Issues with Cacti running very long rrdtool commands

Gandalf <[email protected]> Mon, 27 Oct 2014 20:47:19 +0100
Newsgroups gmane.network.cacti.user
Message-ID <[email protected]>
The suggestion is as follows:
I _may_ happen, that there is a buffer of such size created in the code without
any overflow check. Most likely to be found in lib/rrd.php, but there are other
places I don't remember by heart.
Reinhard

Am 27.10.2014 um 20:34 schrieb Ryan Garland:
> I'll give this one last try, since this apparently affects such a small
> number of Cacti users, and others have been unable to solve this thus far.
> 
> Does anybody know why a command, while run internal to Cacti, would have a
> different command line argument character limit than when the command is
> run at the command prompt by any user on the machine, attempted in various
> shells?
> 
> That is the single question that I believe needs to be answered to help
> pinpoint why this is occurring.  If it can be fixed (i.e. allow Cacti to
> use longer argument strings), I would like to know how, as this would
> likely solve the issue entirely.
> 
> If I could somehow emulate the exact command Cacti is running, with the
> same environment variables, via the command prompt, that could also help to
> determine next steps.
> 
> Any suggestions are appreciated.
> 
> Ryan
> 
> On Thu, Oct 23, 2014 at 11:09 AM, Ryan Garland <[email protected]> wrote:
> 
>> If it was an OS limitation, wouldn't the same command fail when run
>> manually at the command line?  Our arg max is quite high.
>>
>> root@netmon100:/usr/local/cacti# getconf ARG_MAX
>> 2097152
>>
>> I found this thread posted by somebody last year describing the exact same
>> issue, but with no resolution:
>>
>> http://forums.cacti.net/viewtopic.php?f=2&t=50123
>>
>> I also confirmed that PHP's memory_limit is listed as 4096M in Cacti
>> (increased from 128M during testing), but that also did not solve the
>> problem.
>>
>> This is fairly easy to reproduce - select 1000 data sources (of the same
>> type) and create an aggregate graph w/ legends using the aggregate plugin
>> and see if the graph draws.  I am curious whether anyone is able to get
>> this to work, and if so, how?
>>
>> If it is not possible to work around this when rrdtool is called via
>> Cacti, we will have to look into other tools to graph this aggregate data
>> and I really don't want to do that.  Cacti has served us very well for many
>> years.
>>
>> Ryan
>>
>> On Thu, Oct 23, 2014 at 10:19 AM, Gandalf <[email protected]> wrote:
>>
>>> This is IMHO a restriction of the underlying OS. At least it is known,
>>> that some
>>> of those have a restriction like that
>>> Reinhard
>>>
>>> Am 23.10.2014 um 07:51 schrieb Ryan Garland:
>>>> To follow up on this, I did some tests with the graph that is failing vs
>>>> the graph that is working by adding:
>>>>
>>>> print strlen($command_line);
>>>>
>>>> inside the following function in rrd.php:
>>>>
>>>> function rrdtool_execute
>>>>
>>>> The graph that fails has a string length of 131104, the graph that
>>> succeeds
>>>> has a string length of 130864.  So, it would seem as though we are
>>> running
>>>> into a 131072 limitation.
>>>>
>>>> Any ideas how we can get around this, or get Cacti to run the command
>>> as if
>>>> it were at the command prompt which does not seem to have such a
>>> limitation?
>>>>
>>>> Cheers,
>>>>
>>>> Ryan
>>>>
>>>> On Wed, Oct 22, 2014 at 9:47 PM, Ryan Garland <[email protected]> wrote:
>>>>
>>>>> I believe I am running into a character limit for the commands that
>>>>> rrdtool can successfully run.
>>>>>
>>>>> I currently have a stacked aggregate graph with 1376 line items (3/4 of
>>>>> which are the Legend lines).  This graph renders just fine, and with
>>> Debug
>>>>> mode turned on, after the long rrdtool command, rrdtool returns "OK".
>>> The
>>>>> character count of the command (including any white space) of this
>>> command
>>>>> is 132961.  (Yes, I know that's a lot - I have my reasons :))
>>>>>
>>>>> However, as soon as I add a new line item to the graph, the graph no
>>>>> longer renders, and with Debug mode turned on, rrdtool does not return
>>> OK
>>>>> -- it merely shows nothing.  The character count of this command is
>>> 133204.
>>>>>
>>>>> Here's the kicker:  When the failing rrdtool command is manually ran at
>>>>> the system's command prompt, the command succeeds.  It seems that only
>>>>> within Cacti does the rrdtool command not work.
>>>>>
>>>>> I have done a lot of research and found some seemingly related
>>> information
>>>>> ( such as http://www.mail-archive.com/[email protected]/msg05522.html )
>>>>> which discusses command length limitations by the OS / kernel,
>>> limiting to
>>>>> 131072 MAX_ARG_STRLEN, but:
>>>>>
>>>>> 1) this number is slightly lower than the length of the full rrdtool
>>>>> command that is succeed, and
>>>>> 2) if that was the problem, the command should not succeed when
>>> manually
>>>>> run at the command prompt
>>>>>
>>>>> So what is Cacti doing when it runs rrdtool that could be limiting the
>>>>> command length?  Does anyone have any suggestions as to how to resolve
>>> this
>>>>> apparent limitation?
>>>>>
>>>>> Any help is appreciated.  Software versions listed below.
>>>>>
>>>>> Cacti Version 0.8.8a
>>>>> PHP Version 5.3.10-1ubuntu3.14
>>>>> Ubuntu Version 12.04
>>>>> RRDTool Version 1.4.x
>>>>>
>>>>> Ryan
>>>>>
>>>>
>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> cacti-user mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/cacti-user
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> cacti-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/cacti-user
>>>
>>
>>
> ------------------------------------------------------------------------------
> _______________________________________________
> cacti-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cacti-user
> 

------------------------------------------------------------------------------