From bb794d6993110d4074b181b10198be06f564bd48 Mon Sep 17 00:00:00 2001 From: cstegm Date: Thu, 9 Nov 2017 14:14:09 +0100 Subject: [PATCH] Detect UP and DOWN in plugin output to colorize output Signed-off-by: Eric Lippmann --- .../application/views/helpers/PluginOutput.php | 6 +++++- modules/monitoring/public/css/module.less | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 92500e4e2..5224185bc 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -28,6 +28,8 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract '~(\[|\()WARNING(\]|\))~', '~(\[|\()CRITICAL(\]|\))~', '~(\[|\()UNKNOWN(\]|\))~', + '~(\[|\()UP(\]|\))~', + '~(\[|\()DOWN(\]|\))~', '~\@{6,}~' ); @@ -44,6 +46,8 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract '$1WARNING$2', '$1CRITICAL$2', '$1UNKNOWN$2', + '$1UP$2', + '$1DOWN$2', '@@@@@@', ); @@ -101,7 +105,7 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract */ protected function processHtml($html) { - $pattern = '/[([](OK|WARNING|CRITICAL|UNKNOWN)[)\]]/'; + $pattern = '/[([](OK|WARNING|CRITICAL|UNKNOWN|UP|DOWN)[)\]]/'; $doc = new DOMDocument(); $doc->loadXML('
' . $html . '
', LIBXML_NOERROR | LIBXML_NOWARNING); $dom = new RecursiveIteratorIterator(new DomNodeIterator($doc), RecursiveIteratorIterator::SELF_FIRST); diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index 5ce6c93e9..c15a6944b 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -560,6 +560,18 @@ form.instance-features span.description, form.object-features span.description { background-color: @color-warning; color: @body-bg-color; padding: 0.2em; + } + + .state-down { + background-color: @color-down; + color: @body-bg-color; + padding: 0.2em; + } + + .state-up { + background-color: @color-up; + color: @body-bg-color; + padding: 0.2em; } }