Skip to content

Commit

Permalink
ImportSourceNagiosConfig: skeleton
Browse files Browse the repository at this point in the history
refs #9775
  • Loading branch information
Thomas-Gelf committed Jul 30, 2015
1 parent 10d2d51 commit c03431b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions library/Director/Import/ImportSourceNagiosConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Icinga\Module\Director\Import;

use Icinga\Module\Director\Web\Form\QuickForm;
use Icinga\Module\Director\Web\Hook\ImportSourceHook;
use Icinga\Web\Form;

class ImportSourceNagiosConfig extends ImportSourceHook
{
public function fetchData()
{
return array();
}

public function listColumns()
{
return array_keys((array) current($this->fetchData()));
}

public static function addSettingsFormFields(QuickForm $form)
{
$form->addElement('text', 'nagios_config', array(
'label' => 'Nagios config',
'description' => 'Path to nagios.cfg, often /etc/nagios/nagios.cfg',
'required' => true,
));
$form->addElement('select', 'core_type', array(
'label' => 'Core Type',
'multiOptions' => array(
null => '- please choose -',
'nagios3' => 'Nagios 3.x',
'icinga1' => 'Icinga 1.x',
),
'required' => true,
));
$form->addElement('select', 'core_type', array(
'label' => 'Object Type',
'multiOptions' => array(
null => '- please choose -',
'host' => 'Hosts',
'hostgroup' => 'Hostgroups',
'service' => 'Services',
),
'required' => true,
));
return $form;
}
}
1 change: 1 addition & 0 deletions run.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

$this->registerHook('Monitoring\\HostActions', '\\Icinga\\Module\\Director\\Web\\HostActions');
$this->registerHook('Director\\ImportSource', '\\Icinga\\Module\\Director\\Import\\ImportSourceSql', 'sql');
$this->registerHook('Director\\ImportSource', '\\Icinga\\Module\\Director\\Import\\ImportSourceNagiosConfig', 'nagios');

$this->registerHook('Director\\DataType', '\\Icinga\\Module\\Director\\DataType\\DataTypeString', 'string');
$this->registerHook('Director\\DataType', '\\Icinga\\Module\\Director\\DataType\\DataTypeNumber', 'number');
Expand Down

0 comments on commit c03431b

Please sign in to comment.