{$uptime}s", $device, 'reboot', 4, $device['uptime']); } $tags = array( 'rrd_def' => RrdDefinition::make()->addDataset('uptime', 'GAUGE', 0), ); data_update($device, 'uptime', $tags, $uptime); $graphs['uptime'] = true; echo 'Uptime: ' . Time::formatInterval($uptime) . PHP_EOL; $update_array['uptime'] = $uptime; $device['uptime'] = $uptime; }//end if $poll_device['sysLocation'] = str_replace('"', '', $poll_device['sysLocation']); // Rewrite sysLocation if there is a mapping array (database too?) if (!empty($poll_device['sysLocation']) && (is_array(Config::get('location_map')) || is_array(Config::get('location_map_regex')) || is_array(Config::get('location_map_regex_sub')))) { $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); } $poll_device['sysContact'] = str_replace('"', '', $poll_device['sysContact']); foreach (array('sysLocation', 'sysContact') as $elem) { if ($poll_device[$elem] == 'not set') { $poll_device[$elem] = ''; } } // Save results of various polled values to the database foreach (array('sysContact', 'sysObjectID', 'sysName', 'sysDescr') as $elem) { if ($poll_device[$elem] != $device[$elem]) { $update_array[$elem] = $poll_device[$elem]; $device[$elem] = $poll_device[$elem]; log_event("$elem -> " . $poll_device[$elem], $device, 'system', 3); } } if ($device['override_sysLocation'] == 0 && $poll_device['sysLocation']) { /** @var Location $location */ $location = Location::firstOrCreate(['location' => $poll_device['sysLocation']]); if ($device['location_id'] != $location->id) { $device['location_id'] = $location->id; $update_array['location_id'] = $location->id; log_event('Location -> ' . $location->location, $device, 'system', 3); } } // make sure the location has coordinates if (Config::get('geoloc.latlng', true) && ($location || $location = Location::find($device['location_id']))) { if (!$location->hasCoordinates()) { $location->lookupCoordinates(); $location->save(); } } unset($snmpdata, $uptime_data, $uptime, $tags, $poll_device);