-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/mandatory-daemon'
fixes #1905
- Loading branch information
Showing
39 changed files
with
2,228 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Clicommands; | ||
|
||
use Icinga\Module\Director\Cli\Command; | ||
use Icinga\Module\Director\Daemon\BackgroundDaemon; | ||
|
||
class DaemonCommand extends Command | ||
{ | ||
/** | ||
* Run the main Director daemon | ||
* | ||
* USAGE | ||
* | ||
* icingacli director daemon run [--db-resource <name>] | ||
*/ | ||
public function runAction() | ||
{ | ||
$this->app->getModuleManager()->loadEnabledModules(); | ||
$daemon = new BackgroundDaemon(); | ||
if ($dbResource = $this->params->get('db-resource')) { | ||
$daemon->setDbResourceName($dbResource); | ||
} | ||
$daemon->run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Controllers; | ||
|
||
use Icinga\Application\Icinga; | ||
use Icinga\Module\Director\Daemon\RunningDaemonInfo; | ||
use Icinga\Module\Director\Web\Tabs\MainTabs; | ||
use Icinga\Module\Director\Web\Controller\ActionController; | ||
use Icinga\Module\Director\Web\Widget\BackgroundDaemonDetails; | ||
use Icinga\Module\Director\Web\Widget\Documentation; | ||
use ipl\Html\Html; | ||
|
||
class DaemonController extends ActionController | ||
{ | ||
public function indexAction() | ||
{ | ||
$this->setAutorefreshInterval(10); | ||
$this->tabs(new MainTabs($this->Auth(), $this->getDbResourceName()))->activate('daemon'); | ||
$this->setTitle($this->translate('Director Background Daemon')); | ||
// Avoiding layout issues: | ||
$this->content()->add(Html::tag('h1', $this->translate('Director Background Daemon'))); | ||
// TODO: move dashboard titles into controls. Or figure out whether 2.7 "broke" this | ||
|
||
$error = null; | ||
try { | ||
$db = $this->db()->getDbAdapter(); | ||
$daemons = $db->fetchAll( | ||
$db->select()->from('director_daemon_info')->order('fqdn')->order('username')->order('pid') | ||
); | ||
} catch (\Exception $e) { | ||
$daemons = []; | ||
$error = $e->getMessage(); | ||
} | ||
|
||
if (empty($daemons)) { | ||
$documentation = new Documentation(Icinga::app(), $this->Auth()); | ||
$message = Html::sprintf($this->translate( | ||
'The Icinga Director Background Daemon is not running.' | ||
. ' Please check our %s in case you need step by step instructions' | ||
. ' showing you how to fix this.' | ||
), $documentation->getModuleLink( | ||
$this->translate('documentation'), | ||
'director', | ||
'75-Background-Daemon', | ||
$this->translate('Icinga Director Background Daemon') | ||
)); | ||
$this->content()->add(Html::tag('p', ['class' => 'state-hint error'], [ | ||
$message, | ||
($error ? [Html::tag('br'), Html::tag('strong', $error)] : ''), | ||
])); | ||
return; | ||
} | ||
|
||
foreach ($daemons as $daemon) { | ||
$info = new RunningDaemonInfo($daemon); | ||
$this->content()->add([new BackgroundDaemonDetails($info, $daemon) /*, $logWindow*/]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.