Module: nagvis
Branch: master
Commit: eb11fe961968ffd35eb3cd03500418cabd69b7c9
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=eb11fe961968ffd35eb3cd03500418cabd69b7c9

Author: Lars Michelsen <[email protected]>
Date:   Wed Aug 26 22:41:09 2009 +0200

#2 Added configuration options to make state colors and sounds configurable

---

 etc/nagvis.ini.php-sample                       |   30 ++++++
 share/nagvis/includes/classes/GlobalMainCfg.php |  110 ++++++++++++++++++++++-
 share/nagvis/includes/defines/matches.php       |    1 +
 3 files changed, 140 insertions(+), 1 deletions(-)

diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index f772676..06ccdfe 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -48,6 +48,36 @@
 ;up=1
 ;ok=1
 ;pending=0
+; Colors of the different states
+;unreachable_bgcolor=#F1811B
+;unreachable_color=#F1811B
+;down_bgcolor=#FF0000
+;down_color=#FF0000
+;critical_bgcolor=#FF0000
+;critical_color=#FF0000
+;warning_bgcolor=#FFFF00
+;warning_color=#FFFF00
+;unknown_bgcolor=#FFCC66
+;unknown_color=#FFCC66
+;error_bgcolor=#0000FF
+;error_color=#0000FF
+;up_bgcolor=#00FF00
+;up_color=#00FF00
+;ok_bgcolor=#00FF00
+;ok_color=#00FF00
+;pending_bgcolor=#C0C0C0
+;pending_color=#C0C0C0
+; Sound of the different states to be used by the sound eventhandler in the
+; frontend
+;unreachable_sound=std_unreachable.mp3
+;down_sound=std_down.mp3
+;critical_sound=std_critical.mp3
+;warning_sound=std_warning.mp3
+;unknown_sound=
+;error_sound=
+;up_sound=
+;ok_sound=
+;pending_sound=
 
 ; Path definitions
 [paths]
diff --git a/share/nagvis/includes/classes/GlobalMainCfg.php 
b/share/nagvis/includes/classes/GlobalMainCfg.php
index 43d3ca2..037154e 100644
--- a/share/nagvis/includes/classes/GlobalMainCfg.php
+++ b/share/nagvis/includes/classes/GlobalMainCfg.php
@@ -78,6 +78,18 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'unreachable_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#F1811B',
+                                       'match' => MATCH_COLOR),
+                               'unreachable_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#F1811B',
+                                       'match' => MATCH_COLOR),
+                               'unreachable_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => 'std_unreachable.mp3',
+                                       'match' => MATCH_MP3_FILE),
                                'down' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '5',
@@ -90,6 +102,18 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'down_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FF0000',
+                                       'match' => MATCH_COLOR),
+                               'down_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FF0000',
+                                       'match' => MATCH_COLOR),
+                               'down_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => 'std_down.mp3',
+                                       'match' => MATCH_MP3_FILE),
                                'critical' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '5',
@@ -102,6 +126,18 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'critical_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FF0000',
+                                       'match' => MATCH_COLOR),
+                               'critical_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FF0000',
+                                       'match' => MATCH_COLOR),
+                               'critical_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => 'std_critical.mp3',
+                                       'match' => MATCH_MP3_FILE),
                                'warning' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '4',
@@ -114,6 +150,18 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'warning_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FFFF00',
+                                       'match' => MATCH_COLOR),
+                               'warning_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FFFF00',
+                                       'match' => MATCH_COLOR),
+                               'warning_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => 'std_warning.mp3',
+                                       'match' => MATCH_MP3_FILE),
                                'unknown' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '2',
@@ -126,6 +174,18 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'unknown_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FFCC66',
+                                       'match' => MATCH_COLOR),
+                               'unknown_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#FFCC66',
+                                       'match' => MATCH_COLOR),
+                               'unknown_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_MP3_FILE),
                                'error' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '2',
@@ -138,18 +198,66 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '2',
                                        'match' => MATCH_INTEGER),
+                               'error_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#0000FF',
+                                       'match' => MATCH_COLOR),
+                               'error_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#0000FF',
+                                       'match' => MATCH_COLOR),
+                               'error_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_MP3_FILE),
                                'up' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '1',
                                        'match' => MATCH_INTEGER),
+                               'up_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#00FF00',
+                                       'match' => MATCH_COLOR),
+                               'up_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#00FF00',
+                                       'match' => MATCH_COLOR),
+                               'up_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_MP3_FILE),
                                'ok' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '1',
                                        'match' => MATCH_INTEGER),
+                               'ok_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#00FF00',
+                                       'match' => MATCH_COLOR),
+                               'ok_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#00FF00',
+                                       'match' => MATCH_COLOR),
+                               'ok_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_MP3_FILE),
                                'pending' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '0',
-                                       'match' => MATCH_INTEGER)),
+                                       'match' => MATCH_INTEGER)
+                               'pending_bgcolor' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#C0C0C0',
+                                       'match' => MATCH_COLOR),
+                               'pending_color' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '#C0C0C0',
+                                       'match' => MATCH_COLOR),
+                               'pending_sound' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_MP3_FILE)),
                        'defaults' => Array(
                                'backend' => Array('must' => 0,
                                        'editable' => 0,
diff --git a/share/nagvis/includes/defines/matches.php 
b/share/nagvis/includes/defines/matches.php
index ca0b78d..7c88ace 100644
--- a/share/nagvis/includes/defines/matches.php
+++ b/share/nagvis/includes/defines/matches.php
@@ -50,6 +50,7 @@ define('MATCH_VIEW_TYPE', '/^(?:icon|line)$/i');
 define('MATCH_VIEW_TYPE_SERVICE', '/^(?:icon|line|gadget)$/i');
 
 define('MATCH_CFG_FILE', '/^(.+)\.cfg$/i');
+define('MATCH_MP3_FILE', '/^(.+)\.mp3$/i');
 define('MATCH_HTML_TEMPLATE_FILE', '/^tmpl\.(.+)\.html$/i');
 define('MATCH_PHP_FILE', '/^(.+\.php)$/i');
 define('MATCH_INTEGER_PRESIGN', '/^[\+\-]?[0-9]+$/');


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to