Author: Lars Michelsen <[email protected]>
Date: Fri Mar 8 13:54:18 2013 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Fri Mar 8 13:54:18 2013 +0100
automap: no root node needed anymore
Changed default behaviour of the automap concerning the root host. By
default NagVis uses a virtual root node which represents the monitoring
core. It adds the parent tree and all nodes which have no parents defined
below this node. If no parents are configured, all hosts are rendered
below this virtual root node.
---
ChangeLog | 6 +++
etc/nagvis.ini.php-sample | 7 +++-
install.sh | 2 +-
share/server/core/classes/GlobalMainCfg.php | 2 +-
share/server/core/sources/automap.php | 46 +++++++++++++++++--------
share/server/core/sources/automap_pos.php | 9 +----
share/server/core/sources/general.php | 11 ++++++
share/userfiles/images/shapes/std_nagvis.png | Bin 0 -> 1394 bytes
8 files changed, 57 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a693e7b..1b0545e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
1.7.7
+Automap:
+ * Changed default behaviour of the automap concerning the root host. By
+ default NagVis uses a virtual root node which represents the monitoring
+ core. It adds the parent tree and all nodes which have no parents defined
+ below this node. If no parents are configured, all hosts are rendered
+ below this virtual root node.
1.7.6
Core:
diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index 151102d..c61c235 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -287,8 +287,11 @@
[automap]
; Default URL parameters for links to the automap
;defaultparams="&childLayers=2"
-; Default root host (NagVis uses this if it can't detect it via NDO)
-;defaultroot=""
+; Default root host (NagVis uses this if it can't detect it via backend)
+; You can configure a hostname here or use "<<<monitoring>>>" as "virtual"
+; node which shows the parent tree and all hosts which have no parents
+; defined below the is node.
+;defaultroot="<<<monitoring>>>"
; Path to the graphviz binaries (dot,neato,...); Only needed if not in ENV PATH
;graphvizpath="/usr/bin/"
diff --git a/install.sh b/install.sh
index e5d22e9..e1af98c 100755
--- a/install.sh
+++ b/install.sh
@@ -1421,7 +1421,7 @@ if [ "$INSTALLER_ACTION" = "update" -a "$NAGVIS_VER_OLD"
!= "UNKNOWN" ]; then
restore "$USERFILES_DIR/images/iconsets/" "iconset files" "/20x20.png
/std_*_*.png /demo_*.png"
LINE="Restoring custom shapes..."
- restore "$USERFILES_DIR/images/shapes/" "shapes" "*demo*png
/std_dummy.png"
+ restore "$USERFILES_DIR/images/shapes/" "shapes" "*demo*png /std_*"
LINE="Restoring custom templates..."
restore "$USERFILES_DIR/templates/" "templates" "/default.*"
diff --git a/share/server/core/classes/GlobalMainCfg.php
b/share/server/core/classes/GlobalMainCfg.php
index 7ff015e..1e809db 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -799,7 +799,7 @@ class GlobalMainCfg {
'match' => MATCH_STRING_URL),
'defaultroot' => Array('must' => 0,
'editable' => 1,
- 'default' => 'localhost',
+ 'default' => '<<<monitoring>>>',
'match' => MATCH_STRING_NO_SPACE_EMPTY),
'graphvizpath' => Array('must' => 0,
'editable' => 1,
diff --git a/share/server/core/sources/automap.php
b/share/server/core/sources/automap.php
index 21e0031..e950c46 100644
--- a/share/server/core/sources/automap.php
+++ b/share/server/core/sources/automap.php
@@ -76,7 +76,7 @@ $configVars = array(
),
'root' => array(
'must' => false,
- 'default' => '',
+ 'default' => '<<<monitoring>>>',
'match' => MATCH_STRING_NO_SPACE_EMPTY,
),
'filter_by_state' => array(
@@ -130,7 +130,7 @@ $configVars = array(
),
'overlap' => array(
'must' => false,
- 'default' => 'true',
+ 'default' => 'scale',
'match' => MATCH_AUTOMAP_OVERLAP,
'field_type' => 'dropdown',
'list' => 'list_automap_overlaps',
@@ -280,19 +280,28 @@ function automap_obj_base($MAPCFG, &$params,
&$saved_config, $obj_name) {
function automap_obj($MAPCFG, &$params, &$saved_config, $obj_name) {
$obj = automap_obj_base($MAPCFG, $params, $saved_config, $obj_name);
- // Default to params iconset
- if(!isset($obj['iconset']))
- $obj['iconset'] = $params['iconset'];
+ if ($obj_name === '<<<monitoring>>>') {
+ $obj['host_name'] = 'Monitoring';
+ $obj['type'] = 'shape';
+ $obj['icon'] = 'std_nagvis.png';
+ $obj['.width'] = 22;
+ $obj['.height'] = 22;
+ } else {
+ $obj['type'] = 'host';
+ $obj['host_name'] = $obj_name;
- // Calculate the size of the object for later auto positioning
- $size = iconset_size($obj['iconset']);
- $obj['.width'] = $size[0];
- $obj['.height'] = $size[1];
+ // Default to params iconset
+ if(!isset($obj['iconset']))
+ $obj['iconset'] = $params['iconset'];
+
+ // Calculate the size of the object for later auto positioning
+ $size = iconset_size($obj['iconset']);
+ $obj['.width'] = $size[0];
+ $obj['.height'] = $size[1];
+ }
- $obj['type'] = 'host';
// Header menu has z-index 100, this object's label the below+1
$obj['z'] = 98;
- $obj['host_name'] = $obj_name;
$obj['.parents'] = array();
$obj['.childs'] = array();
@@ -327,17 +336,23 @@ function automap_fetch_tree($dir, $MAPCFG, $params,
&$saved_config, $obj_name, $
if($layers_left != 0) {
try {
global $_BACKEND;
- if($dir == 'childs')
- if (cfg('global', 'shinken_features')) {
+ if($dir == 'childs') {
+ if($obj_name == '<<<monitoring>>>') {
+ try {
+ $relations =
$_BACKEND->getBackend($params['backend_id'])->getHostNamesWithNoParent();
+ } catch(BackendConnectionProblem $e) {
+ $relations = array();
+ }
+ } elseif (cfg('global', 'shinken_features')) {
if ($params['min_business_impact']){
$tmp_array = array_flip(list_business_impact());
$min_business_impact =
$tmp_array[$params['min_business_impact']];
}
$relations =
$_BACKEND->getBackend($params['backend_id'])->getDirectChildDependenciesNamesByHostName($obj_name,
$min_business_impact);
- } else {
+ } else {
$relations =
$_BACKEND->getBackend($params['backend_id'])->getDirectChildNamesByHostName($obj_name);
}
- else
+ } else {
if (cfg('global', 'shinken_features')) {
if ($params['min_business_impact']){
$tmp_array = array_flip(list_business_impact());
@@ -347,6 +362,7 @@ function automap_fetch_tree($dir, $MAPCFG, $params,
&$saved_config, $obj_name, $
} else {
$relations =
$_BACKEND->getBackend($params['backend_id'])->getDirectParentNamesByHostName($obj_name);
}
+ }
} catch(BackendException $e) {
$relations = array();
}
diff --git a/share/server/core/sources/automap_pos.php
b/share/server/core/sources/automap_pos.php
index c365be1..473e281 100644
--- a/share/server/core/sources/automap_pos.php
+++ b/share/server/core/sources/automap_pos.php
@@ -55,11 +55,6 @@ function graphviz_config_tree(&$params, &$tree, $layer = 0) {
$str .= 'label="", ';
$str .= 'URL="'.$tree['object_id'].'", ';
$str .= 'tooltip="'.$tree['object_id'].'", ';
-
- // The root host has to be highlighted, these are the options to do this
- /*if($layer == 0) {
- $str .= 'shape="egg",';
- }*/
$width = $tree['.width'];
$height = $tree['.height'];
@@ -110,7 +105,7 @@ function graphviz_config(&$params, &$tree) {
$str .= ' graph [';
$str .= 'dpi="72", ';
//ratio: expand, auto, fill, compress
- $str .= 'ratio="fill", ';
+ //$str .= 'ratio="fill", ';
$str .= 'margin='.graphviz_px2inch($params['margin']).', ';
//$str .= 'bgcolor="'.$this->MAPCFG->getValue(0, 'background_color').'", ';
$str .= 'root="'.$tree['object_id'].'", ';
@@ -145,8 +140,8 @@ function graphviz_config(&$params, &$tree) {
$str .= ' node [';
// default margin is 0.11,0.055
$str .= 'margin="0.0,0.0", ';
- $str .= 'ratio="auto", ';
$str .= 'shape="rect", ';
+ $str .= 'fixedsize="true", ';
$str .= 'color="white", ';
// This may be altered by the single objects depending on the icon size
$str .= 'width="'.graphviz_px2inch(16).'", ';
diff --git a/share/server/core/sources/general.php
b/share/server/core/sources/general.php
index 3eabc92..53db00f 100644
--- a/share/server/core/sources/general.php
+++ b/share/server/core/sources/general.php
@@ -48,4 +48,15 @@ function iconset_size($iconset) {
return array(0, 0);
}
+function shape_size($icon) {
+ $iconPath = path('sys', 'global', 'shapes').'/'.$icon;
+ $iconPathLocal = path('sys', 'local', 'shapes').'/'.$icon;
+ if(file_exists($iconPathLocal))
+ return getimagesize($iconPathLocal);
+ elseif(file_exists($iconPath))
+ return getimagesize($iconPath);
+ else
+ return array(0, 0);
+}
+
?>
diff --git a/share/userfiles/images/shapes/std_nagvis.png
b/share/userfiles/images/shapes/std_nagvis.png
new file mode 100644
index 0000000..ec52f30
Binary files /dev/null and b/share/userfiles/images/shapes/std_nagvis.png differ
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins