Recently I had a request from rex to modify my nagios ping tool (Official Nagios Exchange page); he wanted to use the tool with his nagios configuration.
Rex appeared to be using Nagios QL (Which I believe to be a nagios management tool) , now QL handles nagios config slightly differently . The Ping Tool reads the nagios hosts.cfg file, and turns it into a couple of arrays to use for ping & display, with QL they generate multiple hosts.cfg files, one for each hosts.
Perhaps a short way of saying it, Rex needed to read in multiple hosts.cfg files from a directory, and below is the hack to do it :)
Simply copy & past the below code into a file called readhosts.php, replace your readhosts.php with the new one , and set the variable \$hostfilepath in config.php, something like \$hostfilepath = "/hosts"; (assuming /hosts is where you keep the files ;-) ) should do the job.