Skip to content

Commit

Permalink
Merge pull request #41 from jocafamaka/developing
Browse files Browse the repository at this point in the history
Realease v2.1.0 (final)
  • Loading branch information
jocafamaka committed May 10, 2023
2 parents fabb5e6 + 34548e9 commit 25de31e
Show file tree
Hide file tree
Showing 79 changed files with 600 additions and 334 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ tests/
features/
storage/
*.old
cache/*.php
cache/*.php
.vs/
custom_icons.json
22 changes: 2 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Making it possible to easily and visually identify the status of what is monitor

<sub>Nagmap Reborn is based on Nagmap project developed by [Marcel Hecko](https://github.com/hecko).</sub>

## v2.0.0
## v2.x.x
This version brings significant logical changes, being a break-point in the API compatibility between v1.x.x and v2.x.x.

With these changes it was possible to achieve the following objectives:
Expand Down Expand Up @@ -34,13 +34,6 @@ Currently Nagmap Reborn can easily integrate directly with:

<sub>It is possible to integrate with other systems that have the structure similar to these, if it worked with some other server monitoring system please let me know!</sub>

## Live preview (Coming soon)
<p align="center">
<kbd>
<img src="https://i.imgur.com/4igZSkB.gif">
</kbd>
</p>

## Contribution

Contribution are always **welcome and recommended**! Here is how:
Expand All @@ -56,15 +49,4 @@ You can [see here](https://github.com/jocafamaka/nagmapReborn/wiki/) the Wiki /

## Terms of use (Leaflet / OpenStreetMap)
* By using this API Implementation, your are agreeing to be bound by Leaflet and OpenStreetMap Terms of Use.
* This app uses the OpenStreetMap's tiles. [See here](https://wiki.osmfoundation.org/wiki/Privacy_Policy) the privacy policy.

## Donation
As an Information Systems student about to graduate me, I use my free time to bring updates and improvements to the project, without any financial purpose.

So if you like this project, help me to continue development and free support, buy me a coffee:

[![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G6E995UWUM2J6&item_name=Buy+me+a+coffee&currency_code=BRL&source=url)

<p align="center">
<img src="https://media.giphy.com/media/UqTEN18TcQniWLWQBM/giphy.gif">
</p>
* This app uses the OpenStreetMap's tiles. [See here](https://wiki.osmfoundation.org/wiki/Privacy_Policy) the privacy policy.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.1.0
20 changes: 13 additions & 7 deletions config.php.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ return [
'user_pass' => "ngradmin",
],
'map' => [
// Set to the centre of your map (lat,long)
// Set the centre of your map (lat,long)
'centre' => "-6.469293, -50.913464",

// Default zoom level of the map
'zoom' => 6.2,

// Leaflet styles/tiles.
// Use a provider of images / vectors other than OpenStreetMap.
// Use a provider of images/vectors other than OpenStreetMap.
// You can see several for free here:
// (http://leaflet-extras.github.io/leaflet-providers/preview/)
// Some of these need a token to access. Put the full link.
// For example: https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}{r}.png
// How to use the Mapbox styles:
// https://github.com/jocafamaka/nagmapReborn/wiki/How-to-use-the-Mapbox-styles%3F
// Leave blank to use the default.
// For example: https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}{r}.png
'style' => "",
],
'ngreborn' => [
Expand Down Expand Up @@ -85,7 +85,7 @@ return [
// Font size in pixels used in ChangesBar. (use only numbers)
'font_size' => 20,

// Includes a field at the top of ChanesBar to filter the information displayed regardless of usage mode.
// Includes a field at the top of ChangesBar to filter the information displayed regardless of usage mode.
// Useful when there are a lot of hosts.
// 0 = NO.
// 1 = YES.
Expand All @@ -102,7 +102,7 @@ return [
'down' => 5
],

// Play alert when a server"s status changes to down?
// Play alert when a host's status changes to down?
// To change the alert sound, simply replace the file "alert.mp3" in the resources folder
// In some browsers it is necessary for user to interact with the page before it emits a sound,
// so an initial interaction is required for the alert to be played.
Expand All @@ -111,13 +111,19 @@ return [
'play_sound' => 1,

// Defines if icons will be animated when the host status is updated.
// Disable for best performance when there are many hosts (500+)
// 0 = NO.
// 1 = YES.
'update_animation' => 1,

// The default icon style to be used when there is no specific definition;
// Pre-existing options: marker_retro, marker_shadow, marker_border, wifi_border_dark, wifi_border_light, router_border_dark, router_border_light
// This option can be overridden by the definitions contained in resources/icons/icons.json
// Pre-existing options:
// marker_retro, marker_shadow, marker_border
// wifi, wifi_border_dark, wifi_border_light
// router, router_border_dark, router_border_light
// server, server_border_dark, server_border_light
// This option can be overridden by the definitions contained in resources/icons/custom_icons.json
// Read more: https://github.com/jocafamaka/nagmapReborn/wiki/About-icon-styles
'default_icon_style' => "marker_shadow",

// Show lines between hosts and their parents.
Expand Down
32 changes: 27 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,16 @@
// Setting initial parameters.
var config = {},
_paq = [],
i18nConfig = {},
generalStatus = 0,
tp = null,
tooLong = null,
alertAudio = null,
waitConfigInterval,
_u,
realTime = true,
firstRadial = 1,
generalStatus = 0,
secondRadial = 44,
direction = "up",
realTime = true,
waitConfigInterval,
_u,
STATUS = {
GENERAL: {
accessDenied: -4,
Expand All @@ -89,6 +88,29 @@
warning: 1,
critical: 2,
down: 3
},
COLORS: {
up: "#007F00",
warning: "#FFFF00",
critical: "#D25700",
down: "#C92A2A",
unknown: "#A9ABAE"
}
},
i18nConfig = {
lng: "<?php echo config('ngreborn.language', 'en-US') ?>",
fallbackLng: 'en-US',
debug: <?php echo config('general.debug', 0) ?>,
resources: {
"en-US": {
translation: <?php echo file_get_contents(NGR_DOCUMENT_ROOT . "/resources/langs/en-US.json") ?>
},
"pt-BR": {
translation: <?php echo file_get_contents(NGR_DOCUMENT_ROOT . "/resources/langs/pt-BR.json") ?>
},
"fr-FR": {
translation: <?php echo file_get_contents(NGR_DOCUMENT_ROOT . "/resources/langs/fr-FR.json") ?>
},
}
};
</script>
Expand Down
44 changes: 27 additions & 17 deletions initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
if (isset($nagios_cfg_file))
return jsonResponse(['error' => ["It looks like you just updated Nagmap Reborn, <b><a href='https://github.com/jocafamaka/nagmapReborn/wiki/Migrating-from-v1.6.x-to-v2.x.x' target='_blank'>see here</a></b> the changes that are necessary for version migration."]], 400);
else
return jsonResponse(['error' => [sprintf("%s.json does not exist in the languages folder! Please set the proper LANG option in Nagmap Reborn config file!", config('ngreborn.language'))]], 400);
return jsonResponse(['error' => [sprintf("%s.json does not exist in the languages folder! Please set the proper ngreborn.language option in Nagmap Reborn config file!", config('ngreborn.language'))]], 400);
}

// Load language
require_once(NGR_DOCUMENT_ROOT . "/src/NagmapReborn/i18n.class.php");
$i18n = new i18n(NGR_DOCUMENT_ROOT . "/resources/langs/" . config('ngreborn.language') . ".json", NGR_DOCUMENT_ROOT . "/cache/");
$i18n = new i18n(NGR_DOCUMENT_ROOT . "/resources/langs/" . config('ngreborn.language') . ".json", NGR_DOCUMENT_ROOT . "/cache");
$i18n->init();

$fails = [];
Expand Down Expand Up @@ -111,6 +111,9 @@


// SECURITY
if (!is_int(config('security.allow_overwrite')) || (config('security.allow_overwrite') < 0) || (config('security.allow_overwrite') > 1))
$fails[] = L::config_error("security.allow_overwrite", config('security.allow_overwrite'));

if (!is_string(config('security.key')))
$fails[] = L::config_error("security.key", config('security.key'));

Expand Down Expand Up @@ -144,33 +147,40 @@
requiredAuth(config('security.use_auth'), config('security.user'), config('security.user_pass'), L::class);

return jsonResponse([
"ngRebornVersion" => config('ngreborn.version'),
"ngr_version" => config('ngreborn.version'),
"debug" => config('general.debug'),
"mapCenter" => [$centre[0], $centre[1]],
"mapDefaultZoom" => config('map.zoom'),
"mapTiles" => (config('map.style') == "" ? "//{s}.tile.osm.org/{z}/{x}/{y}.png" : config('map.style')),
"locale" => config('ngreborn.language'),
"cbMode" => config('ngreborn.changes_bar.mode'),
"cbSize" => config('ngreborn.changes_bar.size'),
"cbFilter" => config('ngreborn.changes_bar.filter'),
"cbFontSize" => config('ngreborn.changes_bar.font_size'),
"map" => [
"center" => [$centre[0], $centre[1]],
"default_zoom" => config('map.zoom'),
"tiles" => config('map.style')
],
"changes_bar" => [
"mode" => config('ngreborn.changes_bar.mode'),
"size" => config('ngreborn.changes_bar.size'),
"filter" => config('ngreborn.changes_bar.filter'),
"fonte_size" => config('ngreborn.changes_bar.font_size')
],
"priorities" => [
'unknown' => config('ngreborn.priorities.unknown'),
'up' => config('ngreborn.priorities.up'),
'warning' => config('ngreborn.priorities.warning'),
'critical' => config('ngreborn.priorities.critical'),
'down' => config('ngreborn.priorities.down')
],
"soundAlert" => config('ngreborn.play_sound'),
"updateAnimation" => config('ngreborn.update_animation'),
"sound_alert" => config('ngreborn.play_sound'),
"update_animation" => config('ngreborn.update_animation'),
"defaultIconStyle" => config('ngreborn.default_icon_style'),
"icons" => json_decode(@file_get_contents(NGR_DOCUMENT_ROOT . "/resources/icons/icons.json")),
"showLines" => config('ngreborn.lines'),
"updateTime" => config('ngreborn.time_update'),
"secKey" => config('security.key'),
"defaultAuth" => checkDefaultAuth(config('security.use_auth'), config('security.user'), config('security.user_pass')),
"custom_icons" => json_decode(@file_get_contents(NGR_DOCUMENT_ROOT . "/resources/icons/custom_icons.json")),
"show_lines" => config('ngreborn.lines'),
"update_time" => config('ngreborn.time_update'),
"secret_key" => config('security.key'),
"allow_overwrite" => config('security.allow_overwrite'),
"default_auth" => checkDefaultAuth(config('security.use_auth'), config('security.user'), config('security.user_pass')),
"reporting" => config('ngreborn.reporting'),
"domain" => config('ngreborn.domain'),
"initialHosts" => (isset($final_hosts) ? $final_hosts : []),
"initial_hosts" => (isset($final_hosts) ? $final_hosts : []),
"hostgroups" => (isset($hostgroups_list) ? $hostgroups_list : []),
"translation" => json_decode(file_get_contents(NGR_DOCUMENT_ROOT . "/resources/langs/" . config('ngreborn.language') . ".json"))
]);
21 changes: 18 additions & 3 deletions resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ hr {
top: 15px;
}

.modal {
#modal_error.modal {
z-index: 3002 !important;
border-radius: 10px !important;
/* opacity: 0.5 !important; */
Expand All @@ -238,11 +238,26 @@ hr {
text-shadow: 2px 2px 4px #000 !important;
}

.modal-footer {
#modal_error .modal-footer {
background-color: #00000021 !important;
}

.modal-close {
#modal_error .modal-close {
color: #fff !important;
}

#modal_overwrite.modal {
z-index: 3002 !important;
border-radius: 10px !important;
background: #ffffffd4 !important;
color: #000 !important;
}

#modal_overwrite .modal-footer {
background-color: #00000021 !important;
}

#modal_overwrite .modal-close {
color: #fff !important;
}

Expand Down
62 changes: 62 additions & 0 deletions resources/icons/example_custom_icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"// READ": "For this to work make the necessary changes, rename this file to custom_icons.json and then you can delete all the lines starting with '//' and examples",

"// DOCS: Dynamic icons": "https://github.com/jocafamaka/nagmapReborn/wiki/About-icon-styles#dynamic-icons",
"names": {
"Exact name of a style here (pre-existing or custom)": "THE EXACT NAME OF A HOST",
"Exact name of other style here (pre-existing or custom)": ["THE EXACT NAME OF A HOST 1", "THE EXACT NAME OF A HOST 2"]
},

"hostgroups": {
"Exact name of a style here (pre-existing or custom)": "THE EXACT NAME OF A HOSTGROUP",
"Exact name of other style here (pre-existing or custom)": ["THE EXACT NAME OF A HOSTGROUP 1", "THE EXACT NAME OF A HOSTGROUP 2"]
},

"// DOCS: Custom styles": "https://github.com/jocafamaka/nagmapReborn/wiki/About-icon-styles",
"styles": {
"some_custom_style": {
"grey": {
"iconUrl": "custom_style_folder/Grey.png",
"iconSize": [29, 43]
},
"green": {
"iconUrl": "custom_style_folder/Green.png",
"iconSize": [29, 43]
},
"yellow": {
"iconUrl": "custom_style_folder/Yellow.png",
"iconSize": [29, 43]
},
"orange": {
"iconUrl": "custom_style_folder/Orange.png",
"iconSize": [29, 43]
},
"red": {
"iconUrl": "custom_style_folder/Red.png",
"iconSize": [29, 43]
}
},
"another_custom_style": {
"grey": {
"iconUrl": "another_custom_style_folder/Grey.png",
"iconSize": [29, 43]
},
"green": {
"iconUrl": "another_custom_style_folder/Green.png",
"iconSize": [29, 43]
},
"yellow": {
"iconUrl": "another_custom_style_folder/Yellow.png",
"iconSize": [29, 43]
},
"orange": {
"iconUrl": "another_custom_style_folder/Orange.png",
"iconSize": [29, 43]
},
"red": {
"iconUrl": "another_custom_style_folder/Red.png",
"iconSize": [29, 43]
}
}
}
}
Loading

0 comments on commit 25de31e

Please sign in to comment.