Files
librenms-librenms/app/Http/Controllers/AboutController.php

110 lines
4.0 KiB
PHP
Raw Normal View History

<?php
/**
* AboutController.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
* @copyright 2018 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace App\Http\Controllers;
use App;
use App\Models\Application;
use App\Models\Callback;
use App\Models\Device;
use App\Models\DiskIo;
use App\Models\EntPhysical;
use App\Models\Eventlog;
use App\Models\HrDevice;
use App\Models\Ipv4Address;
use App\Models\Ipv4Network;
use App\Models\Ipv6Address;
use App\Models\Ipv6Network;
use App\Models\Mempool;
use App\Models\Port;
use App\Models\PrinterSupply;
use App\Models\Processor;
use App\Models\Pseudowire;
use App\Models\Sensor;
use App\Models\Service;
New module add juniper rpm support + reimplementation of cisco-sla module (#12799) * Definition of a new SLA module to migrate from old cisco-sla and support other devices : Juniper RPM and Huawei * Change wrong description name of module SLA * Re implementing Juniper RPM support in a new module Slas (Cisco SLA to be added) * Added Graphs for Juniper RPM types * Tried to make discover and poller generic : to handle Cisco SLA and Juniper RPM and others * Reimplementing Cisco SLA in the new Sla module and adding condition to manage both SLA and RPM * Definition of a new SLA module to migrate from old cisco-sla and support other devices : Juniper RPM and Huawei * Change wrong description name of module SLA * Re implementing Juniper RPM support in a new module Slas (Cisco SLA to be added) * Added Graphs for Juniper RPM types * Tried to make discover and poller generic : to handle Cisco SLA and Juniper RPM and others * Reimplementing Cisco SLA in the new Sla module and adding condition to manage both SLA and RPM * Fix some error due to Elequent object replacing SQL request * Fixing indentation * Fixed continuous integrations errors * Fixed continuous integrations errors part 2 * Fixed continuous integrations errors part 3 : missing last new lines * Fixed PHP Static Analysis checks * Fixed continuous integrations errors part 4 * Fixed PHP Static Analysis checks part 2 * Trying to convert existing cisco-sla to new slas one * Trying to add slas to fix test failure (I am pretty sure this is not enough but I don't know how to do it) * Switching old cisco-sla module declaration to new slas module in concerned OS files * Fixing wrong sla module name instead of slas in concerned OS files * Fixing wrong module name sla changed to slas (as is it in power-supplies reimplementation) * Fixing some warnings shown in the Inspection CI but skipping some that are already present * Adding tests files from virtual Juniper VMX and adding slas modules in /tests/module_tables * Adding missing SNMP data files * Module Slas modifications to use inheritance * Fix CI errors * Fix CI errors part 2 * Fix CI errors part 3 * Fixing no value on RTT graphs * Fixing only last SLA to be polled : problem with loops * Fix CI errors part 4 * Optimizing a little the Juniper RPM poller part I wanted to query only the required values but it is complicated to query a specific OID as Cisco-SLA does because the owner and tag are hardcoded in ASCII decimal with strange values. So I use the function snmp_walk which gets the whole OID values in text. And I index the Juniper MIB (because we want multiple values). But I changed the DISMAN MIB requests to get only what we want. * Fix CI errors * Fix CI errors part 2 * Fix CI errors part 3 * Fixing PHP Static Analysis error 2/4 * Fix CI errors * Implementing Interfaces to fix some errors that occurs with inheritance * Adding missing Interfaces files * Moving generic Sla discovery code into Junos Class * Fix CI errors * Fix CI errors part 2 * Fixing missing definition of SlaDiscovery in Cisco shared Class * Fixing missing import for Illuminate\Database\Eloquent\Collection * Fix CI errors part 3 * Fix PHP Static Analysis error * change type strings to use translations instead of config * IOSXR test data * remove test data garbage * simplify discovery * Fix style * Updating test files to adapt mock sla_nr ID starting from 0 and not 1 : CI tests should pass * clean up polling add rtt field in the db cisco icmpjitter seems to have confused a lot of values * rtt on discovery * use crc32 for consistent sla_nr values * revert snmprec * Fix style * correct schema Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-06-11 20:48:33 +02:00
use App\Models\Sla;
use App\Models\Storage;
use App\Models\Syslog;
use App\Models\Vlan;
use App\Models\Vrf;
use App\Models\WirelessSensor;
use Illuminate\Http\Request;
use LibreNMS\Config;
use LibreNMS\DB\Eloquent;
use LibreNMS\Util\Version;
class AboutController extends Controller
{
public function index(Request $request)
{
$callback_status = Callback::get('enabled') === '1';
$version = Version::get();
return view('about.index', [
'callback_status' => $callback_status,
'callback_uuid' => $callback_status ? Callback::get('uuid') : null,
'db_schema' => vsprintf('%s (%s)', $version->database()),
'git_log' => $version->gitChangelog(),
'git_date' => $version->gitDate(),
'project_name' => Config::get('project_name'),
'version_local' => $version->local(),
'version_mysql' => Eloquent::version(),
'version_php' => phpversion(),
'version_laravel' => App::VERSION(),
'version_python' => Version::python(),
'version_webserver' => $request->server('SERVER_SOFTWARE'),
'version_rrdtool' => str_replace('1.7.01.7.0', '1.7.0', implode(' ', array_slice(explode(' ', shell_exec(
Config::get('rrdtool', 'rrdtool') . ' --version | head -n1'
)), 1, 1))),
'version_netsnmp' => str_replace('version: ', '', rtrim(shell_exec(Config::get('snmpget', 'snmpget') . ' -V 2>&1'))),
'stat_apps' => Application::count(),
'stat_devices' => Device::count(),
'stat_diskio' => DiskIo::count(),
'stat_entphys' => EntPhysical::count(),
'stat_events' => Eventlog::count(),
'stat_hrdev' => HrDevice::count(),
'stat_ipv4_addy' => Ipv4Address::count(),
'stat_ipv4_nets' => Ipv4Network::count(),
'stat_ipv6_addy' => Ipv6Address::count(),
'stat_ipv6_nets' => Ipv6Network::count(),
'stat_memory' => Mempool::count(),
'stat_ports' => Port::count(),
'stat_processors' => Processor::count(),
'stat_pw' => Pseudowire::count(),
'stat_sensors' => Sensor::count(),
'stat_services' => Service::count(),
New module add juniper rpm support + reimplementation of cisco-sla module (#12799) * Definition of a new SLA module to migrate from old cisco-sla and support other devices : Juniper RPM and Huawei * Change wrong description name of module SLA * Re implementing Juniper RPM support in a new module Slas (Cisco SLA to be added) * Added Graphs for Juniper RPM types * Tried to make discover and poller generic : to handle Cisco SLA and Juniper RPM and others * Reimplementing Cisco SLA in the new Sla module and adding condition to manage both SLA and RPM * Definition of a new SLA module to migrate from old cisco-sla and support other devices : Juniper RPM and Huawei * Change wrong description name of module SLA * Re implementing Juniper RPM support in a new module Slas (Cisco SLA to be added) * Added Graphs for Juniper RPM types * Tried to make discover and poller generic : to handle Cisco SLA and Juniper RPM and others * Reimplementing Cisco SLA in the new Sla module and adding condition to manage both SLA and RPM * Fix some error due to Elequent object replacing SQL request * Fixing indentation * Fixed continuous integrations errors * Fixed continuous integrations errors part 2 * Fixed continuous integrations errors part 3 : missing last new lines * Fixed PHP Static Analysis checks * Fixed continuous integrations errors part 4 * Fixed PHP Static Analysis checks part 2 * Trying to convert existing cisco-sla to new slas one * Trying to add slas to fix test failure (I am pretty sure this is not enough but I don't know how to do it) * Switching old cisco-sla module declaration to new slas module in concerned OS files * Fixing wrong sla module name instead of slas in concerned OS files * Fixing wrong module name sla changed to slas (as is it in power-supplies reimplementation) * Fixing some warnings shown in the Inspection CI but skipping some that are already present * Adding tests files from virtual Juniper VMX and adding slas modules in /tests/module_tables * Adding missing SNMP data files * Module Slas modifications to use inheritance * Fix CI errors * Fix CI errors part 2 * Fix CI errors part 3 * Fixing no value on RTT graphs * Fixing only last SLA to be polled : problem with loops * Fix CI errors part 4 * Optimizing a little the Juniper RPM poller part I wanted to query only the required values but it is complicated to query a specific OID as Cisco-SLA does because the owner and tag are hardcoded in ASCII decimal with strange values. So I use the function snmp_walk which gets the whole OID values in text. And I index the Juniper MIB (because we want multiple values). But I changed the DISMAN MIB requests to get only what we want. * Fix CI errors * Fix CI errors part 2 * Fix CI errors part 3 * Fixing PHP Static Analysis error 2/4 * Fix CI errors * Implementing Interfaces to fix some errors that occurs with inheritance * Adding missing Interfaces files * Moving generic Sla discovery code into Junos Class * Fix CI errors * Fix CI errors part 2 * Fixing missing definition of SlaDiscovery in Cisco shared Class * Fixing missing import for Illuminate\Database\Eloquent\Collection * Fix CI errors part 3 * Fix PHP Static Analysis error * change type strings to use translations instead of config * IOSXR test data * remove test data garbage * simplify discovery * Fix style * Updating test files to adapt mock sla_nr ID starting from 0 and not 1 : CI tests should pass * clean up polling add rtt field in the db cisco icmpjitter seems to have confused a lot of values * rtt on discovery * use crc32 for consistent sla_nr values * revert snmprec * Fix style * correct schema Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-06-11 20:48:33 +02:00
'stat_slas' => Sla::count(),
'stat_storage' => Storage::count(),
'stat_syslog' => Syslog::count(),
'stat_toner' => PrinterSupply::count(),
'stat_vlans' => Vlan::count(),
'stat_vrf' => Vrf::count(),
'stat_wireless' => WirelessSensor::count(),
]);
}
}