bug in perfdataproc.php mv with too many files

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jvestrum
Posts: 46
Joined: Tue Mar 03, 2015 10:45 am

bug in perfdataproc.php mv with too many files

Post by jvestrum »

Minor bug report, I don't need support at this time but wanted to pass this along:

In /usr/local/nagiosxi/cron/perfdataproc.php, files are moved from /usr/local/nagios/var/spool/xidpe/ to /usr/local/nagios/var/spool/perfdata/ with a simple "mv *" command. Normally that works fine, but our perfdata cronjob was broken for a few days (for unrelated reasons). So thousands of files built up in the xidpe dir, and then when we got the perfdata job going again, the mv failed with "Argument list too long". So perfdata wasn't getting processed, and the xidpe dir kept growing.

I moved all the files over manually and perfdata is now working fine. It might be worth replacing the mv with something that can handle large numbers of files - many ways to do it: a find|xargs mv combo, rsync with --remove-source-files, tar/untar pipe, etc.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: bug in perfdataproc.php mv with too many files

Post by abrist »

Good to know, though it is odd that npcd did not fail on parsing the perfdata directory due to the number of files after your manual move.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jvestrum
Posts: 46
Joined: Tue Mar 03, 2015 10:45 am

Re: bug in perfdataproc.php mv with too many files

Post by jvestrum »

abrist wrote:Good to know, though it is odd that npcd did not fail on parsing the perfdata directory due to the number of files after your manual move.
Nope, it took an hour but it didn't fail :).
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: bug in perfdataproc.php mv with too many files

Post by abrist »

Nice, the power of C!
EDIT: I created a feature request:

Code: Select all

NEW TASK ID 5198 created - Nagios XI Feature Request: XI: Change the xidpe move commands to use a method that does not fail stat() when there are too many files
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked