mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
API: allow add device to set location (#15469)
This commit is contained in:
@@ -1189,6 +1189,7 @@ Input (JSON):
|
||||
- port_association_mode: method to identify ports: ifIndex (default), ifName, ifDescr, ifAlias
|
||||
- poller_group: This is the poller_group id used for distributed
|
||||
poller setup. Defaults to 0.
|
||||
- location or location_id: set the location by text or location id
|
||||
- force_add: Set to true to force the device to be added regardless of it being able
|
||||
to respond to snmp or icmp.
|
||||
|
||||
|
@@ -413,6 +413,7 @@ function add_device(Illuminate\Http\Request $request)
|
||||
'hostname',
|
||||
'display',
|
||||
'overwrite_ip',
|
||||
'location_id',
|
||||
'port',
|
||||
'transport',
|
||||
'poller_group',
|
||||
@@ -427,6 +428,10 @@ function add_device(Illuminate\Http\Request $request)
|
||||
'cryptoalgo',
|
||||
]));
|
||||
|
||||
if (! empty($data['location'])) {
|
||||
$device->location_id = \App\Models\Location::firstOrCreate(['location' => $data['location']])->id;
|
||||
}
|
||||
|
||||
// uses different name in legacy call
|
||||
if (! empty($data['version'])) {
|
||||
$device->snmpver = $data['version'];
|
||||
|
Reference in New Issue
Block a user