Skip to content

Commit

Permalink
FIX: The host and service downtime/acknowledgement URLs in context menu
Browse files Browse the repository at this point in the history
can now be configured via main configuration
  • Loading branch information
LarsMichelsen committed Jul 7, 2016
1 parent 7efb935 commit 0366351
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Frontend:
* FIX: Fixed broken hover_delay (JS error when hovering an object)
* FIX: Multisite Snapin: Fixed wrong EDIT link
* FIX: Improved error handling in case of internal server error (500)
* FIX: The host and service downtime/acknowledgement URLs in context menu
can now be configured via main configuration

Automap:
* FIX: Fixed error when searching for objects on non initialized automaps
Expand Down
28 changes: 28 additions & 0 deletions docs/en_US/nagvis_config_format_description.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,34 @@ <h2>Description of the sections in detail</h2>
<td>The default url to follow when a user left-clicks on an map object.
Available macros: [htmlcgi], [htmlbase], [map_name]</td>
</tr>
<tr>
<td>host_downtime_url</td>
<td>[html_cgi]/cmd.cgi?cmd_typ=55&host=[name]</td>
<td>The default url to open when a user clicks on the downtime link in the
context menu of hosts.
Available macros: [htmlcgi], [htmlbase], [host_name], [backend_id]</td>
</tr>
<tr>
<td>host_ack_url</td>
<td>[html_cgi]/cmd.cgi?cmd_typ=96&host=[name]&force_check</td>
<td>The default url to open when a user clicks on the acknowledge link in the
context menu of hosts.
Available macros: [htmlcgi], [htmlbase], [host_name], [backend_id]</td>
</tr>
<tr>
<td>service_downtime_url</td>
<td>[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]</td>
<td>The default url to open when a user clicks on the downtime link in the
context menu of services.
Available macros: [htmlcgi], [htmlbase], [host_name], [service_description], [backend_id]</td>
</tr>
<tr>
<td>service_ack_url</td>
<td>[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check</td>
<td>The default url to open when a user clicks on the acknowledge link in the
context menu of services.
Available macros: [htmlcgi], [htmlbase], [host_name], [service_description], [backend_id]</td>
</tr>
<tr>
<td>view_template</td>
<td>default</td>
Expand Down
8 changes: 8 additions & 0 deletions etc/nagvis.ini.php-sample
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@
;aggrurl=""
; URL template for nested map links
;mapurl="[htmlbase]/index.php?mod=Map&act=view&show=[map_name]"
; URL template for host downtime link in context menus
;host_downtime_url="[html_cgi]/cmd.cgi?cmd_typ=55&host=[name]"
; URL template for host acknowledgement link in context menus
;host_ack_url="[html_cgi]/cmd.cgi?cmd_typ=96&host=[name]&force_check"
; URL template for service downtime in context menus
;service_downtime_url="[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]"
; URL template for service acknowledgement in context menus
;service_ack_url="[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check"
; Templates to be used for the different views.
;view_template="default"
; Enable/disable object labels for all objects
Expand Down
20 changes: 20 additions & 0 deletions share/server/core/classes/GlobalMainCfg.php
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,26 @@ public function __construct() {
'default' => '',
'match' => MATCH_STRING_URL_EMPTY
),
'host_downtime_url' => Array(
'must' => 0,
'default' => '[html_cgi]/cmd.cgi?cmd_typ=55&host=[name]',
'match' => MATCH_STRING_URL_EMPTY
),
'host_ack_url' => Array(
'must' => 0,
'default' => '[html_cgi]/cmd.cgi?cmd_typ=96&host=[name]&force_check',
'match' => MATCH_STRING_URL_EMPTY
),
'service_downtime_url' => Array(
'must' => 0,
'default' => '[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]',
'match' => MATCH_STRING_URL_EMPTY
),
'service_ack_url' => Array(
'must' => 0,
'default' => '[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check',
'match' => MATCH_STRING_URL_EMPTY
),
'view_template' => Array(
'must' => 0,
'editable' => 1,
Expand Down
16 changes: 16 additions & 0 deletions share/server/core/classes/NagVisContextMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ private function replaceStaticMacros() {
if(strpos($this->code,'[lang_action_https]') !== FALSE) {
$this->code = str_replace('[lang_action_https]', l('Connect (HTTPS)'), $this->code);
}

if(strpos($this->code,'[host_downtime_url]') !== FALSE) {
$this->code = str_replace('[host_downtime_url]', cfg('defaults', 'host_downtime_url'), $this->code);
}

if(strpos($this->code,'[host_ack_url]') !== FALSE) {
$this->code = str_replace('[host_ack_url]', cfg('defaults', 'host_ack_url'), $this->code);
}

if(strpos($this->code,'[service_downtime_url]') !== FALSE) {
$this->code = str_replace('[service_downtime_url]', cfg('defaults', 'service_downtime_url'), $this->code);
}

if(strpos($this->code,'[service_ack_url]') !== FALSE) {
$this->code = str_replace('[service_ack_url]', cfg('defaults', 'service_ack_url'), $this->code);
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions share/userfiles/templates/default.context.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<!-- BEGIN host -->
<li class="spacer"><hr /></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=55&host=[name]" target="_blank">[lang_schedule_downtime]</a></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=96&host=[name]&force_check" target="_blank">[lang_reschedule_next_check]</a></li>
<li><a href="[host_downtime_url]" target="_blank">[lang_schedule_downtime]</a></li>
<li><a href="[host_ack_url]" target="_blank">[lang_reschedule_next_check]</a></li>
<!-- BEGIN permitted_perform -->
<li><a href="#" onClick="showAckDialog('[map_name]', '[obj_id]');contextHide();return false">[lang_ack]</a></li>

Expand All @@ -54,8 +54,8 @@

<!-- BEGIN service -->
<li class="spacer"><hr /></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]" target="_blank">[lang_schedule_downtime]</a></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check" target="_blank">[lang_reschedule_next_check]</a></li>
<li><a href="[service_downtime_url]" target="_blank">[lang_schedule_downtime]</a></li>
<li><a href="[service_ack_url]" target="_blank">[lang_reschedule_next_check]</a></li>
<!-- BEGIN permitted_perform -->
<li><a href="javascript:void(0)" onClick="showAckDialog('[map_name]', '[obj_id]');contextHide();return false">[lang_ack]</a></li>

Expand Down

0 comments on commit 0366351

Please sign in to comment.