Merge pull request #3079 from cstegm/patch-1

Detect UP and DOWN in plugin output to colorize output
This commit is contained in:
lippserd 2017-11-10 11:35:36 +01:00 committed by GitHub
commit 226efe2e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -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
'<span class="state-warning">$1WARNING$2</span>',
'<span class="state-critical">$1CRITICAL$2</span>',
'<span class="state-unknown">$1UNKNOWN$2</span>',
'<span class="state-up">$1UP$2</span>',
'<span class="state-down">$1DOWN$2</span>',
'@@@@@@',
);
@ -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('<div>' . $html . '</div>', LIBXML_NOERROR | LIBXML_NOWARNING);
$dom = new RecursiveIteratorIterator(new DomNodeIterator($doc), RecursiveIteratorIterator::SELF_FIRST);

View File

@ -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;
}
}