3 include_once('/opt/monitor/op5/webconfig/include/import.inc.php');
5 function usage($msg = false)
10 echo "Usage: find_configured.php </path/to/nagios.cfg>\n";
16 $nagios_cfg = $Config['main'];
20 $nagios_cfg = $argv[2];
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();
28 foreach ($obj_array['host'] as $discard => $obj) {
29 if (isset($obj['register']) && $obj['register'] == 0)
31 if (!isset($obj['host_name']))
34 $hosts[] = $obj['host_name'];
36 foreach ($obj_array['service'] as $discard => $obj) {
37 if (isset($obj['register']) && $obj['register'] == 0)
39 if (empty($obj['host_name']))
41 if (empty($obj['service_description']))
44 $services[] = $obj['host_name'] . ';' . $obj['service_description'];
47 echo join("\n", $hosts) . "\n";
48 echo join("\n", $services) . "\n";