Skip to content

How to override the settings via URL?

João Ribeiro edited this page Jun 23, 2020 · 2 revisions

The configuration override was designed for scenarios where there is more than one monitor displaying information from the Nagmap Reborn, for example, one monitors the servers and the other routers.

In the past, to achieve this goal it was necessary to have two copies of the project each with a different config.php.

With the option to overwrite the scenario changes, making only one copy of the project necessary, and making changes to the options dynamically via the URL.

Firstly, it is important to emphasize that for security reasons, only some configurations can be overwritten, namely:

general.debug ngreborn.changes_bar.size ngreborn.priorities.critical
map.centre ngreborn.changes_bar.font_size ngreborn.priorities.down
map.zoom ngreborn.changes_bar.filter ngreborn.play_sound
ngreborn.filter_hostgroup ngreborn.priorities.unknown ngreborn.default_icon_style
ngreborn.filter_service ngreborn.priorities.up ngreborn.update_animation
ngreborn.changes_bar.mode ngreborn.priorities.warning ngreborn.lines

To override settings, you must follow these steps:

In the configuration file, set this option (under security):

'allow_overwrite' => 1,

Having the option enabled, just pass the settings as a parameter in the project URL, example:

Being the URL to access the project: domain.com/nagmapReborn/

To override the option of map centre and ChangesBar mode it would be necessary to add to the end of the URL: ?map.centre=-17.120,-61.688&ngreborn.changes_bar.mode=1

Generating the complete URL: domain.com/nagmapReborn/?map.centre=-17.120,-61.688&ngreborn.changes_bar.mode=1

This way, when accessing the project with this URL, these options would be overwritten and the changes applied dynamically.

Returning to the example of the two monitors to monitor servers and routers, the scenario would be as follows.

In the config.php would be the initial settings for monitoring the servers, such as:

'filter_hostgroup' => "servers",
'default_icon_style' => "marker_shadow",
'filter_service' => "PING"

And to monitor the routers on the second monitor, the options would be overwritten, generating the following complete URL:

domain.com/nagmapReborn/?ngreborn.filter_hostgroup=ROUTERS&ngreborn.default_icon_style=router_border_dark&ngreborn.filter_service=SPEED

In this way the map generated would be limited to the "ROUTERS" Host Group, with the router icon with dark edges and the primary service would be SPEED, thus allowing monitoring with only one config.

In future versions it is intended to create a panel within the project to easily generate these URLs.


João Ribeiro.

Veja aqui em Português.