Skip to content

Commit c3d6710

Browse files
committed
Show Service description in hint on used service selector
Classes renamed without IE prefix +few another fixes/renames
1 parent fcee019 commit c3d6710

95 files changed

Lines changed: 269 additions & 387 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
icinga_config_editor
1+
Icinga Configurator
22
====================
33

44
Gui for generating Icinga configuration files and much more...
55

6+
[![Source Code](http://img.shields.io/badge/source-Vitexus/icinga_configurator-blue.svg?style=flat-square)](https://github.com/Vitexus/icinga_configurator)
7+
[![Latest Version](https://img.shields.io/github/release/Vitexus/icinga_configurator.svg?style=flat-square)](https://github.com/Vitexus/icinga_configurator/releases)
8+
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat-square)](https://github.com/Vitexus/icinga_configurator/blob/master/LICENSE)
9+
[![Build Status](https://img.shields.io/travis/Vitexus/icinga_configurator/master.svg?style=flat-square)](https://travis-ci.org/Vitexus/icinga_configurator)
10+
[![Coverage Status](https://img.shields.io/coveralls/Vitexus/icinga_configurator/master.svg?style=flat-square)](https://coveralls.io/r/Vitexus/icinga_configurator?branch=master)
11+
612
Instalation:
713

814
wget -O - http://v.s.cz/info@vitexsoftware.cz.gpg.key|sudo apt-key add -
@@ -11,6 +17,7 @@ Instalation:
1117
aptitude install icinga-editor
1218

1319

14-
Note: Current version works only with MySQL.
15-
Sorry: Current Default localization is CZECH. English translation is just finished. Please test and start issues in case you have found one.
20+
Sorry: Current Default localization is CZECH. English translation is just finished.
21+
Sorry: Only for Icinga 1.x yet ...
22+
Please test and start issues in case you have found one.
1623

debian/bin/iecfgimporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
$params = array('public' => true, 'generate' => true);
1919

20-
$importer = new Engine\IEImporter($params);
20+
$importer = new Engine\Importer($params);
2121
$importer->importCfgFile('/etc/icinga/icinga.cfg');
2222

2323
foreach ($importer->files as $cfgFile) {

nbproject/private/private.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
<file>file:/home/vitex/Projects/VitexSoftware/iciedit/src/includes/Configure.php</file>
1212
</group>
1313
<group>
14-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/WebPage.php</file>
15-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/CfgEditor.php</file>
16-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/MainMenu.php</file>
17-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/service.php</file>
18-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/BootstrapMenu.php</file>
19-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/PageTop.php</file>
20-
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/hostgroups.php</file>
14+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/engine/IEService.php</file>
15+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/modules/CheckDriveSize.inc.php</file>
2116
</group>
2217
</open-files>
2318
</project-private>

src/apply.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
$fileName), 'warning');
3939
}
4040

41-
$generator = new Engine\IEImporter();
41+
$generator = new Engine\Importer();
4242
$generator->writeConfigs($fileName);
4343

4444
$testing = popen("sudo /usr/sbin/icinga -v /etc/icinga/icinga.cfg", 'r');
@@ -92,7 +92,7 @@
9292
switch (trim($keywords[2])) {
9393
case 'specified for contact':
9494
$errorLine->addItem(' specifikovaná pro kontakt ');
95-
$contact = new Engine\IEContact($keywords[3]);
95+
$contact = new Engine\Contact($keywords[3]);
9696
$errorLine->addItem(new \Ease\Html\ATag('contact.php?contact_id='.$contact->getMyKey(),
9797
$keywords[3]));
9898
break;

src/cfgconfirm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
$hash = $oPage->getRequestValue('hash');
1616

1717
if ($host_id && $hash) {
18-
$host = new Engine\IEHost($host_id);
18+
$host = new Engine\Host($host_id);
1919
$host->setDataValue('config_hash', $hash);
2020
if ($host->saveToSQL()) {
2121
echo sprintf(_('Konfigurace %s potvrzena'), $host->getName());
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @author vitex
1212
*/
13-
class IEDataSource extends \Ease\Brick
13+
class DataSource extends \Ease\Brick
1414
{
1515
public $charset = 'WINDOWS-1250//TRANSLIT';
1616
public $incharset = 'UTF-8';
Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Icinga\Editor;
34

45
/**
@@ -9,7 +10,7 @@
910
* @author Vitex <vitex@hippy.cz>
1011
* @copyright 2015 Vitex@hippy.cz (G)
1112
*/
12-
class IEDbFixer extends \Ease\Html\UlTag
13+
class DbFixer extends \Ease\Html\UlTag
1314
{
1415

1516
public function __construct()
@@ -18,17 +19,35 @@ public function __construct()
1819
$this->fixContactIDs();
1920
$this->fixHostNameIDs();
2021
$this->fixHostHostgroupID();
22+
$this->cleanUnusedServices();
2123
$this->setTagClass('list-group');
2224
}
2325

26+
/**
27+
* Delete unused child services
28+
*/
29+
public function cleanUnusedServices()
30+
{
31+
$which = 'host_name = \'a:0:{}\' AND parent_id IS NOT NULL';
32+
$services = \Ease\Shared::db()->queryToArray('SELECT service_description FROM service WHERE '.$which);
33+
if (count($services)) {
34+
\Ease\Shared::db()->exeQuery('DELETE FROM service WHERE '.$which);
35+
foreach ($services as $service) {
36+
$servicesDeleted[] = current($service);
37+
}
38+
$this->addItemSmart(_('Smazané nepoužívané služby').': '.implode(' , ',
39+
$servicesDeleted), ['class' => 'list-group-item']);
40+
}
41+
}
42+
2443
public function fixHostNameIDs()
2544
{
2645
$hostsOK = [];
2746
$hostsErr = [];
2847

29-
$host = new Engine\IEHost;
48+
$host = new Engine\Host();
3049

31-
$service = new Engine\IEService;
50+
$service = new Engine\Service();
3251
$services = $service->getColumnsFromSQL([$service->myKeyColumn, $service->nameColumn,
3352
'host_name'], null, null, $service->myKeyColumn);
3453
foreach ($services as $serviceId => $serviceInfo) {
@@ -62,7 +81,7 @@ public function fixHostNameIDs()
6281
}
6382
}
6483

65-
$hostgroup = new Engine\IEHostgroup;
84+
$hostgroup = new Engine\Hostgroup();
6685
$hostgroups = $hostgroup->getListing();
6786
foreach ($hostgroups as $hostgroupId => $hostgroupInfo) {
6887
$hostgroup->loadFromSQL($hostgroupId);
@@ -94,10 +113,10 @@ public function fixHostNameIDs()
94113
.'parents'.' IS NOT NULL && parents !=\'a:0:{}\'',
95114
$host->myKeyColumn);
96115
foreach ($childsAssigned as $chid_id => $child_info) {
97-
$child = new Engine\IEHost($chid_id);
116+
$child = new Engine\Host($chid_id);
98117
$parents = $child->getDataValue('parents');
99118
foreach ($parents as $parent_id => $parent_name) {
100-
$parent = new Engine\IEHost($parent_name);
119+
$parent = new Engine\Host($parent_name);
101120
if ($parent->getId()) {
102121
//Ok Host toho jména existuje
103122
if ($parent->getId() != $parent_id) { //Ale nesedí ID
@@ -126,8 +145,8 @@ function fixContactIDs()
126145
$contactsOK = [];
127146
$contactsErr = [];
128147

129-
$contact = new Engine\IEContact;
130-
$service = new Engine\IEService;
148+
$contact = new Engine\Contact;
149+
$service = new Engine\Service;
131150
$services = $service->getColumnsFromSQL([$service->myKeyColumn]);
132151
foreach ($services as $serviceId => $serviceInfo) {
133152
$serviceId = intval(current($serviceInfo));
@@ -160,7 +179,7 @@ function fixContactIDs()
160179
}
161180
}
162181

163-
$host = new Engine\IEHost;
182+
$host = new Engine\Host;
164183
$hosts = $host->getColumnsFromSQL([$host->myKeyColumn]);
165184
foreach ($hosts as $hostInfo) {
166185
$hostId = intval(current($hostInfo));
@@ -198,8 +217,8 @@ function fixHostHostgroupID()
198217
{
199218
$hostgroupsOK = [];
200219
$hostgroupsErr = [];
201-
$host = new Engine\IEHost;
202-
$hostgroup = new Engine\IEHostgroup;
220+
$host = new Engine\Host;
221+
$hostgroup = new Engine\Hostgroup;
203222
$hosts = $host->getColumnsFromSQL([$host->myKeyColumn]);
204223
foreach ($hosts as $hostInfo) {
205224
$hostId = intval(current($hostInfo));

src/classes/IETwitter.php

Lines changed: 0 additions & 90 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @author vitex
99
*/
10-
class IEIcingaWebUser
10+
class IcingaWebUser
1111
{
1212

1313
public $icingaWebDir = '/usr/share/icinga-web';
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @author vitex
88
*/
9-
class IENRPEConfigGenerator extends EaseAtom
9+
class NRPEConfigGenerator extends EaseAtom
1010
{
1111
/**
1212
* Objekt hostu
@@ -82,7 +82,7 @@ function cfgGeneralSet()
8282
*/
8383
function cfgServices()
8484
{
85-
$service = new Engine\IEService();
85+
$service = new Engine\Service();
8686

8787
$servicesAssigned = $service->dblink->queryToArray('SELECT '.$service->myKeyColumn.','.$service->nameColumn.',`use` FROM '.$service->myTable.' WHERE host_name LIKE \'%"'.$this->host->getName().'"%\'',
8888
$service->myKeyColumn);
@@ -110,7 +110,7 @@ function cfgServices()
110110
if (isset($service['use'])) {
111111
$remote = $service['check_command-remote'];
112112
if (!isset($commandsCache[$remote])) {
113-
$command = new Engine\IECommand($remote);
113+
$command = new Engine\Command($remote);
114114
$commandsCache[$remote] = $command->getData();
115115
}
116116
}
@@ -119,7 +119,7 @@ function cfgServices()
119119
$use = $service['use'];
120120

121121
if (!isset($usedCache[$use])) {
122-
$used = new Engine\IEService;
122+
$used = new Engine\Service;
123123
$used->nameColumn = 'name';
124124

125125
if ($used->loadFromSQL($use)) {

0 commit comments

Comments
 (0)