parent
e05ca449ae
commit
2172937138
|
@ -4,6 +4,8 @@
|
|||
|
||||
namespace Icinga\Application;
|
||||
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
|
||||
/**
|
||||
* Class Logger
|
||||
* @package Icinga\Application
|
||||
|
@ -71,7 +73,7 @@ class Logger
|
|||
if ($config->debug && $config->debug->enable == 1) {
|
||||
$this->setupDebugLog($config);
|
||||
}
|
||||
} catch (\Icinga\Exception\ConfigurationError $e) {
|
||||
} catch (ConfigurationError $e) {
|
||||
$this->warn("Could not create debug log: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
|
@ -114,14 +116,14 @@ class Logger
|
|||
* @param $type
|
||||
* @param $target
|
||||
* @param $priority
|
||||
* @throws \Icinga\Exception\ConfigurationError
|
||||
* @throws ConfigurationError
|
||||
*/
|
||||
private function addWriter($type, $target, $priority)
|
||||
{
|
||||
$type[0] = strtoupper($type[0]);
|
||||
$writerClass = "\Zend_Log_Writer_" . $type;
|
||||
if (!class_exists($writerClass)) {
|
||||
throw new \Icinga\Exception\ConfigurationError("Could not create log: Unknown type " . $type);
|
||||
throw new ConfigurationError("Could not create log: Unknown type " . $type);
|
||||
}
|
||||
|
||||
$writer = new $writerClass($target);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
namespace Icinga\Backend;
|
||||
|
||||
use Icinga\Backend\Statusdat\DataView\StatusdatHostView;
|
||||
use Icinga\Backend\Statusdat\DataView\StatusdatServiceView;
|
||||
use Icinga\Protocol\Statusdat as StatusdatProtocol;
|
||||
|
||||
/**
|
||||
|
@ -58,7 +60,7 @@ class Statusdat extends AbstractBackend
|
|||
$result = array($objs["host"][$host]);
|
||||
return new MonitoringObjectList(
|
||||
$result,
|
||||
new \Icinga\Backend\Statusdat\DataView\StatusdatHostView($this->reader)
|
||||
new StatusdatHostView($this->reader)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -78,7 +80,7 @@ class Statusdat extends AbstractBackend
|
|||
$result = array($objs["service"][$idxName]);
|
||||
return new MonitoringObjectList(
|
||||
$result,
|
||||
new \Icinga\Backend\Statusdat\DataView\StatusdatServiceView($this->reader)
|
||||
new StatusdatServiceView($this->reader)
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
namespace Icinga\Backend\Statusdat\DataView;
|
||||
|
||||
use Icinga\Backend\DataView\ObjectRemappingView;
|
||||
use \Icinga\Protocol\Statusdat\IReader;
|
||||
|
||||
/**
|
||||
* Class StatusdatHostView
|
||||
* @package Icinga\Backend\Statusdat\DataView
|
||||
*/
|
||||
class StatusdatHostView extends \Icinga\Backend\DataView\ObjectRemappingView
|
||||
class StatusdatHostView extends ObjectRemappingView
|
||||
{
|
||||
/**
|
||||
* @var mixed
|
||||
|
@ -35,10 +36,7 @@ class StatusdatHostView extends \Icinga\Backend\DataView\ObjectRemappingView
|
|||
"host_state" => "status.current_state",
|
||||
"host_output" => "status.plugin_output",
|
||||
"host_perfdata" => "status.long_plugin_output",
|
||||
"host_state" => "status.current_state",
|
||||
"host_perfdata" => "status.long_plugin_output",
|
||||
"host_last_state_change" => "status.last_state_change",
|
||||
"host_output" => "status.plugin_output",
|
||||
"host_check_command" => "check_command",
|
||||
"host_last_check" => "status.last_check",
|
||||
"host_next_check" => "status.next_check",
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
namespace Icinga\Protocol\Ldap;
|
||||
|
||||
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
||||
|
||||
/**
|
||||
* Search abstraction class
|
||||
*
|
||||
|
@ -302,7 +304,7 @@ class Query
|
|||
}
|
||||
$paginator = new \Zend_Paginator(
|
||||
// TODO: Adapter doesn't fit yet:
|
||||
new \Icinga\Web\Paginator\Adapter\QueryAdapter($this)
|
||||
new QueryAdapter($this)
|
||||
);
|
||||
$paginator->setItemCountPerPage($limit);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
namespace Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Protocol\Statusdat\Exception\ParsingException as ParsingException;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +66,7 @@ class Parser
|
|||
*/
|
||||
public function parseObjectsFile()
|
||||
{
|
||||
\Icinga\Application\Logger::debug("Reading new objects file");
|
||||
Logger::debug("Reading new objects file");
|
||||
$DEFINE = strlen("define ");
|
||||
$filehandle = $this->filehandle;
|
||||
$this->icingaState = array();
|
||||
|
@ -87,7 +89,7 @@ class Parser
|
|||
|
||||
/**
|
||||
* @param null $filehandle
|
||||
* @throws \Icinga\Exception\ProgrammingError
|
||||
* @throws ProgrammingError
|
||||
*/
|
||||
public function parseRuntimeState($filehandle = null)
|
||||
{
|
||||
|
@ -98,7 +100,7 @@ class Parser
|
|||
}
|
||||
|
||||
if (!$this->icingaState) {
|
||||
throw new \Icinga\Exception\ProgrammingError("Tried to read runtime state without existing objects data");
|
||||
throw new ProgrammingError("Tried to read runtime state without existing objects data");
|
||||
}
|
||||
$this->overwrites = array();
|
||||
while (!feof($filehandle)) {
|
||||
|
@ -224,7 +226,7 @@ class Parser
|
|||
if (!$returnString) {
|
||||
while (trim(fgets($this->filehandle)) !== "}") {
|
||||
}
|
||||
return;
|
||||
return null;
|
||||
} else {
|
||||
$str = "";
|
||||
while (($val = trim(fgets($this->filehandle))) !== "}") {
|
||||
|
@ -254,14 +256,14 @@ class Parser
|
|||
protected function registerObjectAsProperty(&$object)
|
||||
{
|
||||
if ($this->currentObjectType == "service" || $this->currentObjectType == "host") {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$isService = strpos($this->currentObjectType, "service") !== false;
|
||||
$isHost = strpos($this->currentObjectType, "host") !== false;
|
||||
|
||||
$name = $this->getObjectIdentifier($object);
|
||||
if ($isService === false && $isHost === false) { // this would be error in the parser implementation
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$property = $this->currentObjectType;
|
||||
if ($isService) {
|
||||
|
@ -292,6 +294,8 @@ class Parser
|
|||
}
|
||||
array_push($source->$property, $object);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,6 +110,8 @@ class Expression implements IQueryPart
|
|||
}
|
||||
$this->function = "count";
|
||||
$tokens[0] = $value[1];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
namespace Icinga\Protocol\Statusdat;
|
||||
|
||||
use Icinga\Backend\MonitoringObjectList;
|
||||
use Icinga\Exception as Exception;
|
||||
use Icinga\Benchmark as Benchmark;
|
||||
|
||||
|
@ -157,6 +158,8 @@ class Reader implements IReader
|
|||
if ($this->lastState == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,6 +172,7 @@ class Reader implements IReader
|
|||
return false;
|
||||
}
|
||||
$this->hasRuntimeState = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,11 +241,11 @@ class Reader implements IReader
|
|||
|
||||
/**
|
||||
* @param Query $query
|
||||
* @return \Icinga\Backend\MonitoringObjectList
|
||||
* @return MonitoringObjectList
|
||||
*/
|
||||
public function fetchAll(Query $query)
|
||||
{
|
||||
return new \Icinga\Backend\MonitoringObjectList(
|
||||
return new MonitoringObjectList(
|
||||
$query->getResult(),
|
||||
$query->getView()
|
||||
);
|
||||
|
|
|
@ -8,6 +8,7 @@ use Icinga\Authentication\Auth;
|
|||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Exception;
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Pdf\File;
|
||||
use Icinga\Web\Notification;
|
||||
use Zend_Layout as ZfLayout;
|
||||
use Zend_Controller_Action as ZfController;
|
||||
|
@ -288,7 +289,7 @@ class ActionController extends ZfController
|
|||
);
|
||||
$html = '<style>' . $css . '</style>' . (string)$this->getResponse();
|
||||
|
||||
$pdf = new \Icinga\Pdf\File();
|
||||
$pdf = new File();
|
||||
$pdf->AddPage();
|
||||
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
|
||||
$pdf->Output('docs.pdf', 'I');
|
||||
|
|
Loading…
Reference in New Issue