diff --git a/application/tables/GeneratedConfigFileTable.php b/application/tables/GeneratedConfigFileTable.php
index d670bde0..44aa1335 100644
--- a/application/tables/GeneratedConfigFileTable.php
+++ b/application/tables/GeneratedConfigFileTable.php
@@ -15,6 +15,8 @@ class GeneratedConfigFileTable extends QuickTable
'size' => 'LENGTH(f.content)',
'cnt_object' => 'f.cnt_object',
'cnt_template' => 'f.cnt_template',
+ 'cnt_apply' => 'f.cnt_apply',
+ 'cnt_all' => "f.cnt_object || ' / ' || f.cnt_template || ' / ' || f.cnt_apply",
'checksum' => 'LOWER(HEX(f.checksum))',
'config_checksum' => 'LOWER(HEX(cf.config_checksum))',
);
@@ -52,8 +54,12 @@ class GeneratedConfigFileTable extends QuickTable
$view = $this->view();
return array(
'file_path' => $view->translate('File'),
+ 'cnt_all' => $view->translate('Object/Tpl/Apply'),
+ /*
'cnt_object' => $view->translate('Objects'),
'cnt_template' => $view->translate('Templates'),
+ 'cnt_apply' => $view->translate('Apply rules'),
+ */
'size' => $view->translate('Size'),
);
}
diff --git a/application/views/scripts/deployment/index.phtml b/application/views/scripts/deployment/index.phtml
index ab5b1cf9..ff7b0496 100644
--- a/application/views/scripts/deployment/index.phtml
+++ b/application/views/scripts/deployment/index.phtml
@@ -85,9 +85,10 @@ function colorize($log, $logLink) {
'deployment_id' => $deployment->id
)
) ?>, = sprintf(
- $this->translate('%d objects, %d templates'),
+ $this->translate('%d objects, %d templates, %d apply rules'),
$config->getObjectCount(),
- $config->getTemplateCount()
+ $config->getTemplateCount(),
+ $config->getApplyCount()
)?>, = Format::bytes($config->getSize()) ?>
diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php
index c7b48023..549aa71f 100644
--- a/library/Director/IcingaConfig/IcingaConfig.php
+++ b/library/Director/IcingaConfig/IcingaConfig.php
@@ -111,6 +111,15 @@ class IcingaConfig
return $cnt;
}
+ public function getApplyCount()
+ {
+ $cnt = 0;
+ foreach ($this->getFiles() as $file) {
+ $cnt += $file->getApplyCount();
+ }
+ return $cnt;
+ }
+
public function getChecksum()
{
return $this->checksum;
@@ -614,6 +623,7 @@ apply Service for (title => params in host.vars["%s"]) {
'content' => 'f.content',
'cnt_object' => 'f.cnt_object',
'cnt_template' => 'f.cnt_template',
+ 'cnt_apply' => 'f.cnt_apply',
)
)->join(
array('f' => 'director_generated_file'),
@@ -626,7 +636,8 @@ apply Service for (title => params in host.vars["%s"]) {
$this->files[$row->file_path] = $file
->setContent($row->content)
->setObjectCount($row->cnt_object)
- ->setTemplateCount($row->cnt_template);
+ ->setTemplateCount($row->cnt_template)
+ ->setApplyCount($row->cnt_apply);
}
return $this;
diff --git a/library/Director/IcingaConfig/IcingaConfigFile.php b/library/Director/IcingaConfig/IcingaConfigFile.php
index 8a411bcd..0bb12b64 100644
--- a/library/Director/IcingaConfig/IcingaConfigFile.php
+++ b/library/Director/IcingaConfig/IcingaConfigFile.php
@@ -55,6 +55,11 @@ class IcingaConfigFile
return $this->cntTemplate;
}
+ public function getApplyCount()
+ {
+ return $this->cntApply;
+ }
+
public function getSize()
{
return strlen($this->content);
@@ -72,6 +77,12 @@ class IcingaConfigFile
return $this;
}
+ public function setApplyCount($cnt)
+ {
+ $this->cntApply = $cnt;
+ return $this;
+ }
+
public function getHexChecksum()
{
return Util::binary2hex($this->getChecksum());
diff --git a/schema/mysql-migrations/upgrade_122.sql b/schema/mysql-migrations/upgrade_122.sql
new file mode 100644
index 00000000..6a94e05d
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_122.sql
@@ -0,0 +1,12 @@
+ALTER TABLE director_generated_file
+ ADD COLUMN cnt_apply INT(10) UNSIGNED NOT NULL DEFAULT 0;
+
+UPDATE director_generated_file
+SET cnt_apply = ROUND(
+ (LENGTH(content) - LENGTH( REPLACE(content, 'apply ', '') ) )
+ / LENGTH('apply ')
+);
+
+INSERT INTO director_schema_migration
+ (schema_version, migration_time)
+ VALUES (122, NOW());
diff --git a/schema/mysql.sql b/schema/mysql.sql
index a6e46ed5..ce7678e7 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -47,6 +47,7 @@ CREATE TABLE director_generated_file (
content MEDIUMTEXT NOT NULL,
cnt_object INT(10) UNSIGNED NOT NULL DEFAULT 0,
cnt_template INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ cnt_apply INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (checksum)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1354,4 +1355,4 @@ CREATE TABLE sync_run (
INSERT INTO director_schema_migration
(schema_version, migration_time)
- VALUES (121, NOW());
+ VALUES (122, NOW());
diff --git a/schema/pgsql-migrations/upgrade_122.sql b/schema/pgsql-migrations/upgrade_122.sql
new file mode 100644
index 00000000..6f3f884f
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_122.sql
@@ -0,0 +1,12 @@
+ALTER TABLE director_generated_file
+ ADD COLUMN cnt_apply SMALLINT NOT NULL DEFAULT 0;
+
+UPDATE director_generated_file
+SET cnt_apply = ROUND(
+ (LENGTH(content) - LENGTH( REPLACE(content, 'apply ', '') ) )
+ / LENGTH('apply ')
+);
+
+INSERT INTO director_schema_migration
+ (schema_version, migration_time)
+ VALUES (122, NOW());
diff --git a/schema/pgsql.sql b/schema/pgsql.sql
index 84fd2ac3..e3198bcd 100644
--- a/schema/pgsql.sql
+++ b/schema/pgsql.sql
@@ -95,6 +95,7 @@ CREATE TABLE director_generated_file (
content text DEFAULT NULL,
cnt_object SMALLINT NOT NULL DEFAULT 0,
cnt_template SMALLINT NOT NULL DEFAULT 0,
+ cnt_apply SMALLINT NOT NULL DEFAULT 0,
PRIMARY KEY (checksum)
);
@@ -1581,4 +1582,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
INSERT INTO director_schema_migration
(schema_version, migration_time)
- VALUES (121, NOW());
+ VALUES (122, NOW());