specfile: Use import's ability to find logfiles by parsing nagios.cfg
[nagios-reports-module.git] / find_configured.php
blob7b6aeefbef5a52f02fa2759e0ca4ce984e1ea3cf
1 #!/usr/bin/php
2 <?php
3 include_once('/opt/monitor/op5/nacoma/include/import.inc.php');
5 function usage($msg = false)
7 if ($msg)
8 echo $msg . "\n";
10 echo "Usage: find_configured.php </path/to/nagios.cfg>\n";
11 exit(1);
14 $out = false;
15 $force = false;
16 $nagios_cfg = $Config['main'];
17 if ($argc > 2)
18 usage();
19 if ($argc == 2)
20 $nagios_cfg = $argv[1];
21 if (!is_file($nagios_cfg))
22 usage("$nagios_cfg is not a file");
24 $Config['main'] = $nagios_cfg;
25 $obj_array = import_object_configuration();
26 echo join("\n", array_keys($index['host'])) . "\n";
27 echo join("\n", array_keys($index['service'])) . "\n";