opendcim / openDCIM

An open source (GPL v3) Data Center Inventory Management (DCIM) application.
http://opendcim.org
305 stars 204 forks source link

23.04 reports - "Search/Export by Data Center" not working for "all Data Centers" but works great when a single Data center is selected. #1497

Closed cpbonamico closed 5 months ago

cpbonamico commented 7 months ago

installed 23.04 on rocky 8.9 imported sqldump and pictures and image directories. Upgraded opendcim. Configured relative path for pictures and images directories. All data is intact, everything is looking great.

Go to reports - "Search/Export by Data Center" select a Data Center from the drop down selection. Within seconds the report appears. This is the same result for every data center that we have....(We have many......Some bigger than others...but they all report) in the same report..select "all Data Centers" from the drop down and we get nothing and after a long timeout....and we get a web page that says "Oppps..out of memory"

I have increased the amount of memory for PHP to 8192M and this doesn't help. I have tried it on the test site and it works.

we have ~40000 entries in our instance.

When I run this query from sql ... MariaDB [dcim]> SELECT a.Name AS DataCenter, b.DeviceID, c.Location, b.Position, b.Height, b.Label, b.DeviceType, b.AssetTag, b.SerialNo, b.InstallDate, b.WarrantyExpire, b.PrimaryIP, b.ParentDevice, b.PrimaryContact, b.TemplateID, b.Owner, b.Status, b.HalfDepth, b.BackSide, b.Hypervisor, c.CabinetID, c.DataCenterID FROM fac_DataCenter a, fac_Cabinet c, fac_Device b LEFT OUTER JOIN fac_DeviceCustomValue d on b.DeviceID=d.DeviceID WHERE b.Cabinet=c.CabinetID AND c.DataCenterID=a.DataCenterID GROUP BY DeviceID ORDER BY DataCenter ASC, Location ASC, Position ASC;

without including $custom_concat and $dclimit variable, it runs in under 1/2 second for 39456 rows.

I really need these reports to function....can you please steer me in the right direction?

Thank You!

Chris B.

php-mem
wilpig commented 7 months ago

I don't have a dataset that large to test against. You're welcome to hit us up on IRC or email me directly with a dump of your db that I can test against to try to replicate. That large of a data set could be a script timeout, could be an OOM event. what errors are you getting in the php error log? assuming a default rocky install /var/log/php-fpm/www-error.log

wilpig commented 7 months ago

$dclimit is just the bit that gets injected to limit the results to a specific datacenter so that would be excluded from the sql.

The custom_concat is the field for the custom attributes. https://github.com/opendcim/openDCIM/blob/master/search_export.php#L124 They too aren't really necessary but I doubt that is the issue.

wilpig commented 7 months ago

You can test just the table generation apart from the UI stuff that generates the table by using this https://dev.opendcim.org/search_export.php?datacenterid=0&ajax

cpbonamico commented 7 months ago

Yes, the above works for a while but then said ..out of memory....but it started displaying data.... I did have a DataCenter that was old gear and I deleted that DataCenter and now the report works.~37K lines

any way to keep this from puking?

wilpig commented 7 months ago

Is the web server going OOM or is it your browser cutting it off? It is sounding like the browser is limiting the memory the tab can use. Do you get the OOM message if you hit that same url via curl on the command line?

cpbonamico commented 7 months ago

Do you have the curl command?

cpbonamico commented 5 months ago

OK. I stopped using Chrome for reports. That seems to help with the Oppps error. Also increased the httpd timeout by adding "TimeOut 600" to the /etc/https/conf/httpd.conf file. Now it takes some time, but the report runs!