mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
commit
3c35674e14
@ -167,6 +167,7 @@ class Monitoring_HostController extends MonitoredObjectController
|
|||||||
$this->assertPermission('monitoring/command/process-check-result');
|
$this->assertPermission('monitoring/command/process-check-result');
|
||||||
|
|
||||||
$form = new ProcessCheckResultCommandForm();
|
$form = new ProcessCheckResultCommandForm();
|
||||||
|
$form->setBackend($this->backend);
|
||||||
$form->setTitle($this->translate('Submit Passive Host Check Result'));
|
$form->setTitle($this->translate('Submit Passive Host Check Result'));
|
||||||
$this->handleCommandForm($form);
|
$this->handleCommandForm($form);
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,7 @@ class Monitoring_HostsController extends Controller
|
|||||||
$this->assertPermission('monitoring/command/process-check-result');
|
$this->assertPermission('monitoring/command/process-check-result');
|
||||||
|
|
||||||
$form = new ProcessCheckResultCommandForm();
|
$form = new ProcessCheckResultCommandForm();
|
||||||
|
$form->setBackend($this->backend);
|
||||||
$form->setTitle($this->translate('Submit Passive Host Check Results'));
|
$form->setTitle($this->translate('Submit Passive Host Check Results'));
|
||||||
$this->handleCommandForm($form);
|
$this->handleCommandForm($form);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ class Monitoring_ServiceController extends MonitoredObjectController
|
|||||||
$this->assertPermission('monitoring/command/process-check-result');
|
$this->assertPermission('monitoring/command/process-check-result');
|
||||||
|
|
||||||
$form = new ProcessCheckResultCommandForm();
|
$form = new ProcessCheckResultCommandForm();
|
||||||
|
$form->setBackend($this->backend);
|
||||||
$form->setTitle($this->translate('Submit Passive Service Check Result'));
|
$form->setTitle($this->translate('Submit Passive Service Check Result'));
|
||||||
$this->handleCommandForm($form);
|
$this->handleCommandForm($form);
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,7 @@ class Monitoring_ServicesController extends Controller
|
|||||||
$this->assertPermission('monitoring/command/process-check-result');
|
$this->assertPermission('monitoring/command/process-check-result');
|
||||||
|
|
||||||
$form = new ProcessCheckResultCommandForm();
|
$form = new ProcessCheckResultCommandForm();
|
||||||
|
$form->setBackend($this->backend);
|
||||||
$form->setTitle($this->translate('Submit Passive Service Check Results'));
|
$form->setTitle($this->translate('Submit Passive Service Check Results'));
|
||||||
$this->handleCommandForm($form);
|
$this->handleCommandForm($form);
|
||||||
}
|
}
|
||||||
|
@ -52,11 +52,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => $this->translate('Status'),
|
'label' => $this->translate('Status'),
|
||||||
'description' => $this->translate('The state this check result should report'),
|
'description' => $this->translate('The state this check result should report'),
|
||||||
'multiOptions' => $object->getType() === $object::TYPE_HOST ? array(
|
'multiOptions' => $object->getType() === $object::TYPE_HOST ? $this->getHostMultiOptions() : array(
|
||||||
ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'),
|
|
||||||
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'),
|
|
||||||
ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state')
|
|
||||||
) : array(
|
|
||||||
ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'),
|
||||||
ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'),
|
||||||
ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'),
|
||||||
@ -115,4 +111,23 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the available host options based on the program version
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getHostMultiOptions()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'),
|
||||||
|
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (substr($this->getBackend()->getProgramVersion(), 0, 2) !== 'v2') {
|
||||||
|
$options[ProcessCheckResultCommand::HOST_UNREACHABLE] = $this->translate('UNREACHABLE', 'icinga.state');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,4 +331,14 @@ class MonitoringBackend implements Selectable, Queryable, ConnectionInterface
|
|||||||
array_push($parts, 'Query', ucfirst(strtolower($query)) . 'Query');
|
array_push($parts, 'Query', ucfirst(strtolower($query)) . 'Query');
|
||||||
return implode('\\', $parts);
|
return implode('\\', $parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch and return the program version of the current instance
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getProgramVersion()
|
||||||
|
{
|
||||||
|
return $this->select()->from('programstatus', array('program_version'))->fetchOne();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user