mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
hrsystem write fix (#13314)
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
// HOST-RESOURCES-MIB
|
||||
// Generic System Statistics
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\HrSystem;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$oid_list = ['hrSystemMaxProcesses.0', 'hrSystemProcesses.0', 'hrSystemNumUsers.0'];
|
||||
$hrSystem = snmp_get_multi($device, $oid_list, '-OUQs', 'HOST-RESOURCES-MIB');
|
||||
|
||||
$current_device = Device::find($device['device_id']);
|
||||
|
||||
if (is_numeric($hrSystem[0]['hrSystemProcesses'])) {
|
||||
$tags = [
|
||||
'rrd_def' => RrdDefinition::make()->addDataset('procs', 'GAUGE', 0),
|
||||
@@ -35,10 +33,11 @@ if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) {
|
||||
|
||||
data_update($device, 'hr_users', $tags, $fields);
|
||||
|
||||
$current_device->hostResourceValues()->updateOrCreate(['device_id' => $current_device->id, 'key' => 'num_users'],
|
||||
['hrSystemNumUsers' => $hrSystem[0]['hrSystemNumUsers'],
|
||||
'hrSystemProcesses' => $hrSystem[0]['hrSystemProcesses'],
|
||||
'hrSystemMaxProcesses' => $hrSystem[0]['hrSystemMaxProcesses'], ]);
|
||||
HrSystem::updateOrCreate(['device_id' => $device['device_id']],
|
||||
['hrSystemNumUsers' => $hrSystem[0]['hrSystemNumUsers'],
|
||||
'hrSystemProcesses' => $hrSystem[0]['hrSystemProcesses'],
|
||||
'hrSystemMaxProcesses' => $hrSystem[0]['hrSystemMaxProcesses'], ]);
|
||||
|
||||
$os->enableGraph('hr_users');
|
||||
echo ' Users';
|
||||
}
|
||||
|
Reference in New Issue
Block a user