From 0d9cd86350c7749cde002b78b7643c0e63e0c8a0 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Thu, 7 Oct 2021 04:47:21 -0500 Subject: [PATCH] Docs: edit existing install url (#13342) * Docs: edit existing install url not blank * did not define superfences correctly --- doc/Extensions/Oxidized.md | 128 +++++++++++++++++----------------- doc/js/docs-settings-links.js | 26 ++++++- 2 files changed, 88 insertions(+), 66 deletions(-) diff --git a/doc/Extensions/Oxidized.md b/doc/Extensions/Oxidized.md index d75a499640..4e00dabe4a 100644 --- a/doc/Extensions/Oxidized.md +++ b/doc/Extensions/Oxidized.md @@ -34,18 +34,18 @@ your devices. When you have that, you only need the following config to enable the display of device configs within the device page itself: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.enabled true -lnms config:set oxidized.url http://127.0.0.1:8888 -``` + ```bash + lnms config:set oxidized.enabled true + lnms config:set oxidized.url http://127.0.0.1:8888 + ``` LibreNMS supports config versioning if Oxidized does. This is known to work with the git output module. !!! setting "external/oxidized" -```bash -lnms config:set oxidized.features.versioning true -``` + ```bash + lnms config:set oxidized.features.versioning true + ``` Oxidized supports various ways to utilise credentials to login to devices, you can specify global username/password within Oxidized, @@ -55,31 +55,31 @@ group credentials within Oxidized. To enable this support please switch on 'Enable the return of groups to Oxidized': !!! setting "external/oxidized" -```bash -lnms config:set oxidized.group_support true -``` + ```bash + lnms config:set oxidized.group_support true + ``` You can set a default group that devices will fall back to with: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.default_group default -``` + ```bash + lnms config:set oxidized.default_group default + ``` You can ignore specific groups !!! setting "external/oxidized" -```bash -lnms config:set oxidized.ignore_groups '["badgroup", "nobackup"]' -``` + ```bash + lnms config:set oxidized.ignore_groups '["badgroup", "nobackup"]' + ``` One trick you can do to ignore all ungrouped devices is set both of these settings !!! setting "external/oxidized" -```bash -lnms config:set oxidized.default_group nobackup -lnms config:set oxidized.ignore_groups.+ nobackup -``` + ```bash + lnms config:set oxidized.default_group nobackup + lnms config:set oxidized.ignore_groups.+ nobackup + ``` ## SELinux @@ -123,9 +123,9 @@ Settings>External Settings>Oxidized Integration or add the following to your config. !!! setting "external/oxidized" -```bash -lnms config:set oxidized.reload_nodes true -``` + ```bash + lnms config:set oxidized.reload_nodes true + ``` ## Creating overrides @@ -151,18 +151,18 @@ To match on the device hostnames or sysNames that contain 'lon-sw' or if the location contains 'London' then you would set the following: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.maps.group.hostname.+ '{"regex": "/^lon-sw/", "value": "london-switches"}' -lnms config:set oxidized.maps.group.sysName.+ '{"regex": "/^lon-sw/", "value": "london-switches"}' -lnms config:set oxidized.maps.group.location.+ '{"regex": "/london/", "value": "london-switches"}' -``` + ```bash + lnms config:set oxidized.maps.group.hostname.+ '{"regex": "/^lon-sw/", "value": "london-switches"}' + lnms config:set oxidized.maps.group.sysName.+ '{"regex": "/^lon-sw/", "value": "london-switches"}' + lnms config:set oxidized.maps.group.location.+ '{"regex": "/london/", "value": "london-switches"}' + ``` To match on a device os of edgeos then please use the following: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.maps.group.os.+ '{"match": "edgeos", "value": "wireless"}' -``` + ```bash + lnms config:set oxidized.maps.group.os.+ '{"match": "edgeos", "value": "wireless"}' + ``` Matching on OS requires system name of the OS. For example, "match": "RouterOS" will not work, while "match": "routeros" will. @@ -170,31 +170,29 @@ will not work, while "match": "routeros" will. To edit an existing map, you must use the index to override it. !!! setting "external/oxidized" -```bash -lnms config:get oxidized.maps.os.os -array ( - 0 => - array ( - 'match' => 'airos-af-ltu', - 'value' => 'airfiber', - ), - 1 => - array ( - 'match' => 'airos-af', - 'value' => 'airfiber', - ), -) - -lnms config:set oxidized.maps.os.os.1 '{"match": "airos-af", "value": "something-else"}' -``` + ```bash + lnms config:get oxidized.maps.os.os + [ + { + "match": "airos-af-ltu", + "value": "airfiber" + }, + { + "match": "airos-af", + "value": "airfiber" + }, + ] + + lnms config:set oxidized.maps.os.os.1 '{"match": "airos-af", "value": "something-else"}' + ``` To override the IP Oxidized uses to poll the device, set the following: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.maps.ip.sysName.+ '{"regex": "/^my.node/", "value": "192.168.1.10"}' -lnms config:set oxidized.maps.ip.sysName.+ '{"match": "my-other.node", "value": "192.168.1.20"}' -``` + ```bash + lnms config:set oxidized.maps.ip.sysName.+ '{"regex": "/^my.node/", "value": "192.168.1.10"}' + lnms config:set oxidized.maps.ip.sysName.+ '{"match": "my-other.node", "value": "192.168.1.20"}' + ``` This allows extending the configuration further by providing a completely flexible model for custom flags and settings, for example, @@ -202,18 +200,18 @@ below shows the ability to add an ssh_proxy host within Oxidized simply by adding the below to your configuration: !!! setting "external/oxidized" -```bash -lnms config:set oxidized.maps.ssh_proxy.sysName.+ '{"regex": "/^my.node/", "value": "my-ssh-gateway.node"}' -``` + ```bash + lnms config:set oxidized.maps.ssh_proxy.sysName.+ '{"regex": "/^my.node/", "value": "my-ssh-gateway.node"}' + ``` Or of course, any custom value that could be needed or wanted can be applied, for example, setting a "myAttribute" to "Super cool value" for any configured and enabled "routeros" device. !!! setting "external/oxidized" -```bash -lnms config:set oxidized.maps.myAttribute.os.+ '{"match": "routeros", "value": "Super cool value"}' -``` + ```bash + lnms config:set oxidized.maps.myAttribute.os.+ '{"match": "routeros", "value": "Super cool value"}' + ``` Verify the return of groups by querying the API: @@ -241,17 +239,17 @@ It's also possible to exclude certain device types and OS' from being output via the API. !!! setting "external/oxidized" -```bash -lnms config:set oxidized.ignore_types '["server", "power"]' -lnms config:set oxidized.ignore_os '["linux", "windows"]' -``` + ```bash + lnms config:set oxidized.ignore_types '["server", "power"]' + lnms config:set oxidized.ignore_os '["linux", "windows"]' + ``` You can also ignore whole groups of devices !!! setting "external/oxidized" -```bash -lnms config:set oxidized.ignore_groups '["london-switches", "default"]' -``` + ```bash + lnms config:set oxidized.ignore_groups '["london-switches", "default"]' + ``` ## Trigger configuration backups diff --git a/doc/js/docs-settings-links.js b/doc/js/docs-settings-links.js index 7dfe3b8fad..03ddec2e68 100644 --- a/doc/js/docs-settings-links.js +++ b/doc/js/docs-settings-links.js @@ -1,3 +1,27 @@ +/* + * docs-settings-links.js + * + * -Description- + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + function findGetParameter(parameterName) { let result = null, tmp = []; location.search @@ -24,7 +48,7 @@ function isValidHttpUrl(string) { function promptSettingUrl(e) { e.preventDefault(); - let librenmsUrl = prompt("Enter your LibreNMS URL to get direct settings link.\nNote: This URL is only stored in your browser."); + let librenmsUrl = prompt("Enter your LibreNMS URL to get direct settings link.\nNote: This URL is only stored in your browser.", localStorage.getItem('librenms_url')); if (! isValidHttpUrl(librenmsUrl)) { alert("Invalid url, must start with http:// or https://")