2009-09-07 11:07:59 +00:00
|
|
|
<?php
|
2007-06-24 15:46:47 +00:00
|
|
|
|
2018-11-19 15:58:59 +00:00
|
|
|
use App\Models\DevicePerf;
|
2017-08-08 16:23:03 -05:00
|
|
|
use LibreNMS\Exceptions\InvalidIpException;
|
|
|
|
use LibreNMS\Util\IP;
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '<div class="container-fluid">';
|
|
|
|
echo "<div class='row'>
|
2014-02-26 22:33:45 +00:00
|
|
|
<div class='col-md-12'>
|
|
|
|
<div class='panel panel-default panel-condensed'>
|
2015-07-13 20:10:26 +02:00
|
|
|
<div class='panel-heading'>";
|
2012-04-22 17:13:27 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($config['overview_show_sysDescr']) {
|
2017-01-21 13:24:05 +02:00
|
|
|
echo '<i class="fa fa-id-card fa-lg icon-theme" aria-hidden="true"></i> <strong>'.$device['sysDescr'].'</strong>';
|
2011-03-17 11:29:23 +00:00
|
|
|
}
|
2010-06-10 19:49:23 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '</div>
|
|
|
|
<table class="table table-hover table-condensed table-striped">';
|
2014-02-26 22:33:45 +00:00
|
|
|
|
2017-09-29 21:05:51 +01:00
|
|
|
$uptime = formatUptime($device['uptime']);
|
|
|
|
$uptime_text = 'Uptime';
|
|
|
|
if ($device['status'] == 0) {
|
|
|
|
// Rewrite $uptime to be downtime if device is down
|
|
|
|
$uptime = formatUptime(time() - strtotime($device['last_polled']));
|
|
|
|
$uptime_text = 'Downtime';
|
|
|
|
}
|
2011-03-17 11:29:23 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($device['os'] == 'ios') {
|
|
|
|
formatCiscoHardware($device);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($device['features']) {
|
|
|
|
$device['features'] = '('.$device['features'].')';
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:29:23 +00:00
|
|
|
$device['os_text'] = $config['os'][$device['os']]['text'];
|
|
|
|
|
2015-07-22 17:22:06 +02:00
|
|
|
echo '<tr>
|
|
|
|
<td>System Name</td>
|
|
|
|
<td>'.$device['sysName'].' </td>
|
|
|
|
</tr>';
|
|
|
|
|
2016-02-07 15:39:17 +00:00
|
|
|
if (!empty($device['ip'])) {
|
2017-02-08 04:22:06 +00:00
|
|
|
echo "<tr><td>Resolved IP</td><td>{$device['ip']}</td></tr>";
|
2017-08-08 16:23:03 -05:00
|
|
|
} elseif ($config['force_ip_to_sysname'] === true) {
|
|
|
|
try {
|
|
|
|
$ip = IP::parse($device['hostname']);
|
|
|
|
echo "<tr><td>IP Address</td><td>$ip</td></tr>";
|
|
|
|
} catch (InvalidIpException $e) {
|
|
|
|
// don't add an ip line
|
|
|
|
}
|
2016-01-17 23:59:51 +00:00
|
|
|
}
|
|
|
|
|
2017-09-14 01:46:16 +01:00
|
|
|
if ($device['purpose']) {
|
|
|
|
echo '<tr>
|
|
|
|
<td>Description</td>
|
|
|
|
<td>'.display($device['purpose']).'</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($device['hardware']) {
|
|
|
|
echo '<tr>
|
2014-02-26 22:33:45 +00:00
|
|
|
<td>Hardware</td>
|
2015-07-13 20:10:26 +02:00
|
|
|
<td>'.$device['hardware'].'</td>
|
|
|
|
</tr>';
|
2011-03-17 11:29:23 +00:00
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '<tr>
|
2014-02-26 22:33:45 +00:00
|
|
|
<td>Operating System</td>
|
2015-07-13 20:10:26 +02:00
|
|
|
<td>'.$device['os_text'].' '.$device['version'].' '.$device['features'].' </td>
|
|
|
|
</tr>';
|
2011-04-21 13:30:09 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($device['serial']) {
|
|
|
|
echo '<tr>
|
2014-02-26 22:33:45 +00:00
|
|
|
<td>Serial</td>
|
2015-07-13 20:10:26 +02:00
|
|
|
<td>'.$device['serial'].'</td>
|
|
|
|
</tr>';
|
2011-03-17 11:29:23 +00:00
|
|
|
}
|
|
|
|
|
2015-11-12 08:42:26 +10:00
|
|
|
if ($device['sysObjectID']) {
|
|
|
|
echo '<tr>
|
|
|
|
<td>Object ID</td>
|
|
|
|
<td>'.$device['sysObjectID'].'</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($device['sysContact']) {
|
|
|
|
echo '<tr>
|
|
|
|
<td>Contact</td>';
|
|
|
|
if (get_dev_attrib($device, 'override_sysContact_bool')) {
|
|
|
|
echo '
|
2016-02-17 13:59:58 +00:00
|
|
|
<td>'.htmlspecialchars(get_dev_attrib($device, 'override_sysContact_string')).'</td>
|
2011-04-01 15:20:06 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-07-13 20:10:26 +02:00
|
|
|
<td>SNMP Contact</td>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
2016-02-17 13:59:58 +00:00
|
|
|
<td>'.htmlspecialchars($device['sysContact']).'</td>
|
2015-07-13 20:10:26 +02:00
|
|
|
</tr>';
|
2011-03-17 11:29:23 +00:00
|
|
|
}
|
|
|
|
|
Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location
This blocks #8868
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
|
|
|
if ($device['location_id']) {
|
|
|
|
$location = \App\Models\Location::find($device['location_id']);
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '<tr>
|
Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location
This blocks #8868
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
|
|
|
<td>Location</td>
|
|
|
|
<td>' . $location->location . '</td>
|
2015-07-13 20:10:26 +02:00
|
|
|
</tr>';
|
2011-03-17 11:29:23 +00:00
|
|
|
|
Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location
This blocks #8868
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
|
|
|
if ($location->coordinatesValid()) {
|
|
|
|
echo '<tr>
|
2015-07-20 15:59:44 +01:00
|
|
|
<td>Lat / Lng</td>
|
Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location
This blocks #8868
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
|
|
|
<td>[' . $location->lat . ',' . $location->lng . '] <div class="pull-right"><a href="https://maps.google.com/?q=' . $location->lat . '+' . $location->lng . '" target="_blank" class="btn btn-success btn-xs" role="button"><i class="fa fa-map-marker" style="color:white" aria-hidden="true"></i> Map</button></div></a></td>
|
2015-07-20 15:59:44 +01:00
|
|
|
</tr>';
|
Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location
This blocks #8868
DO NOT DELETE THIS TEXT
#### Please note
> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.
- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
#### Testers
If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
|
|
|
}
|
2015-07-20 15:59:44 +01:00
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($uptime) {
|
2017-09-29 21:05:51 +01:00
|
|
|
echo "<tr>
|
|
|
|
<td>$uptime_text</td>
|
2018-11-19 15:58:59 +00:00
|
|
|
<td>$uptime</td>
|
2017-09-29 21:05:51 +01:00
|
|
|
</tr>";
|
2011-03-17 11:29:23 +00:00
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '</table>
|
2014-02-26 22:33:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-07-13 20:10:26 +02:00
|
|
|
</div>';
|
2018-11-19 15:58:59 +00:00
|
|
|
|
|
|
|
$perf_info = DevicePerf::where('device_id', $device['device_id'])->latest('timestamp')->first();
|
|
|
|
$perf_debug = json_decode($perf_info['debug'], true);
|
|
|
|
if ($perf_debug['traceroute']) {
|
|
|
|
echo "<div class='row'>
|
|
|
|
<div class='col-md-12'>
|
|
|
|
<div class='panel panel-default'>
|
|
|
|
<div class='panel-heading'>
|
|
|
|
<h3 class='panel-title'>Traceroute ({$perf_info['timestamp']})</h3>
|
|
|
|
</div>
|
|
|
|
<div class='panel-body'>
|
|
|
|
<pre>{$perf_debug['traceroute']}</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</div>';
|