Add distributed polling config settings (#10711)

Show error on cli when type or validation is not set
This commit is contained in:
Tony Murray 2019-10-17 18:32:27 +00:00 committed by GitHub
parent b6f26f6e80
commit f9b704cb29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 5 deletions

View File

@ -56,7 +56,10 @@ class SetConfigCommand extends LnmsCommand
$value = $this->juggleType($value);
$configItem = $definition->get($setting);
if (!$configItem->checkValue($value)) {
$this->error($configItem->getValidationMessage($value));
$message = ($configItem->type || $configItem->validate)
? $configItem->getValidationMessage($value)
: __('Cannot set :setting, it is missing validation definition.', ['setting' => $setting]);
$this->error($message);
return 2;
}

View File

@ -6486,6 +6486,7 @@ __webpack_require__.r(__webpack_exports__);
"unix-agent": "Unix-Agent Integration"
},
"poller": {
"distributed": "Distributed Poller",
"ping": "Ping",
"rrdtool": "RRDTool Setup",
"snmp": "SNMP"
@ -6760,6 +6761,18 @@ __webpack_require__.r(__webpack_exports__);
"description": "Device performance entries older than (days)",
"help": "Cleanup done by daily.sh"
},
"distributed_poller": {
"description": "Enable Distributed Polling (requires additional setup)",
"help": "Enable distributed polling system wide. This is intended for load sharing, not remote polling. You must read the documentation for steps to enable: https://docs.librenms.org/Extensions/Distributed-Poller/"
},
"distributed_poller_memcached_host": {
"description": "Memcached host",
"help": "The hostname or ip for the memcached server. This is required for poller_wrapper.py and daily.sh locking."
},
"distributed_poller_memcached_port": {
"description": "Memcached port",
"help": "The port for the memcached server. Default is 11211"
},
"email_auto_tls": {
"description": "Enable / disable Auto TLS support",
"options": {
@ -7557,6 +7570,22 @@ __webpack_require__.r(__webpack_exports__);
"lang": "English"
},
"commands": {
"config{get}": {
"description": "Get configuration value",
"arguments": {
"setting": "setting to get value of in dot notation (example: snmp.community.0)"
},
"options": {
"json": "Output setting or entire config as json"
}
},
"config{set}": {
"description": "Set configuration value (or unset)",
"arguments": {
"setting": "setting to set in dot notation (example: snmp.community.0)",
"value": "value to set, unset setting if this is omitted"
}
},
"user{add}": {
"description": "Add a local user, you can only log in with this user if auth is set to mysql",
"arguments": {

View File

@ -860,16 +860,31 @@
"default": true
},
"distributed_poller": {
"default": false
"default": false,
"group": "poller",
"section": "distributed",
"order": 0,
"type": "boolean"
},
"distributed_poller_group": {
"default": 0
},
"distributed_poller_memcached_host": {
"default": "example.net"
"default": "example.net",
"group": "poller",
"section": "distributed",
"order": 1,
"type": "text",
"validate": {
"value": "ip_or_hostname"
}
},
"distributed_poller_memcached_port": {
"default": 11211
"default": 11211,
"group": "poller",
"section": "distributed",
"order": 2,
"type": "integer"
},
"distributed_poller_name": {
},

View File

@ -31,6 +31,7 @@ return [
'unix-agent' => 'Unix-Agent Integration',
],
'poller' => [
'distributed' => 'Distributed Poller',
'ping' => 'Ping',
'rrdtool' => 'RRDTool Setup',
'snmp' => 'SNMP',
@ -305,6 +306,18 @@ return [
'description' => 'Device performance entries older than (days)',
'help' => 'Cleanup done by daily.sh'
],
'distributed_poller' => [
'description' => 'Enable Distributed Polling (requires additional setup)',
'help' => 'Enable distributed polling system wide. This is intended for load sharing, not remote polling. You must read the documentation for steps to enable: https://docs.librenms.org/Extensions/Distributed-Poller/'
],
'distributed_poller_memcached_host' => [
'description' => 'Memcached host',
'help' => 'The hostname or ip for the memcached server. This is required for poller_wrapper.py and daily.sh locking.'
],
'distributed_poller_memcached_port' => [
'description' => 'Memcached port',
'help' => 'The port for the memcached server. Default is 11211'
],
'email_auto_tls' => [
'description' => 'Enable / disable Auto TLS support',
'options' => [

View File

@ -22,6 +22,6 @@
@routes
<script src="{{ mix('/js/manifest.js') }}?v=10132019"></script>
<script src="{{ mix('/js/vendor.js') }}?v=10132019"></script>
<script src="{{ mix('/js/app.js') }}?v=10132019"></script>
<script src="{{ mix('/js/app.js') }}?v=10172019"></script>
@endpush