Location: PHPKode > projects > NaWui > nawui/exporter.php
<?php

define("PAGE_ID","exporter");
define("PAGE_TITLE","Export Configurations to Nagios");

require_once("includes/main.inc.php");
include_once("html_wrap/head.inc.php");

$errormsg = "";
$action = (isset($action)) ? $action : "";

function DisplayForm()	{

?>
<br>
<div align="center">
<table cellpadding="2" cellspacing="4" border="0">
<tr class="dataOdd">
  <td class="center">
  <form action="exporter.php" method="POST">
  <input type="submit" value="Export configurations">
  <input type="hidden" name="action" value="exportconfigs">
  </form>
  </td>
  <td>&nbsp;This will <font color="#AA0000"><b>recreate</b></font> Nagios main configuration files:<br>
      &nbsp;<b>nagios.cfg</b>, <b>cgi.cfg</b> and <b>resource.cfg</b>.
      &nbsp;
  </td>
</tr>
<tr class="dataOdd">
  <td align="center">
  <form action="exporter.php" method="POST">
  <input type="submit" value="Export objects">
  <input type="hidden" name="action" value="exportobjects">
  </form>
  </td>
  <td>&nbsp;This will export every object (hosts, services, contacts, commands, etc.)<br>
      &nbsp;<font color="#AA0000"><b>replacing</b></font> every object configuration file specified in "Nagios.cfg" section.
      &nbsp;
  </td>
</tr>
</table>
</div>
<br><hr>
<?
}
		
DisplayForm();

switch ($action)	{

	case "exportconfigs":

		print "<p>Exporting configuration files:</p>\n";

		if ($errormsg = $Plugin->NagiosWriteConfigs()) print $errormsg;
		print "<br><br>Done exporting configuration.<br><br><hr>";
		break;

	case "exportobjects":
		print "<p>Exporting objects to it's respective files: </p>\n";

		if ($errormsg = $Plugin->NagiosWriteObjects()) print "Problem: ".$errormsg;
		else {
			print "<br>Done exporting objects.<br><br>";
			print "Note: If you can't see some configuration files in the above list,";
			print "     it could be that there are no objects yet to be written to those files.<br>";
		}
		echo "<br><hr>";
		break;
} 





include_once("html_wrap/tail.inc.php");

?>
Return current item: NaWui