newdevice: Added support for FortiSwitch #4852 (#4858)

This commit is contained in:
Neil Lathwood
2016-11-07 17:25:25 +00:00
committed by Daniel Preussker
parent 95626de6ce
commit ce6720edd9
10 changed files with 398 additions and 1 deletions

View File

@@ -933,6 +933,17 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'fortiswitch';
$config['os'][$os]['text'] = 'Fortinet FortiSwitch';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['icon'] = 'fortinet';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
$os = 'routeros';
$config['os'][$os]['text'] = 'Mikrotik RouterOS';
$config['os'][$os]['type'] = 'network';

View File

@@ -0,0 +1,29 @@
<?php
/**
* fortiswitch.inc.php
*
* LibreNMS mempools discovery module for FortiSwitch
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'fortiswitch') {
echo 'Fortiswitch Mempool: ';
discover_mempool($valid_mempool, $device, 0, 'fortiswitch', 'Main Memory', '1024', null, null);
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* fortiswitch.inc.php
*
* LibreNMS os discovery module for FortiSwitch
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
$version = snmp_get($device, 'fsSysVersion.0', '-Oqn', 'FORTINET-FORTISWITCH-MIB');
if (str_contains($version, 'FortiSwitch')) {
$os = 'fortiswitch';
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* fortiswitch.inc.php
*
* LibreNMS processor discovery module for FortiSwitch
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'fortiswitch') {
echo 'Fortiswitch : ';
$descr = 'Processor';
$usage = snmp_get($device, 'fsSysCpuUsage.0', '-Ovq', 'FORTINET-FORTISWITCH-MIB');
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.12356.106.4.1.2.0', '1', 'fortiswitch', $descr, '1', $usage, null, null);
}
}
unset($usage);

View File

@@ -0,0 +1,33 @@
<?php
/**
* fortiswitch.inc.php
*
* LibreNMS mempools poller module for FortiSwitch
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'Fortigate MemPool';
$mempool['used'] = snmp_get($device, 'fsSysMemUsage.0', '-OvQ', 'FORTINET-FORTISWITCH-MIB');
$mempool['total'] = snmp_get($device, 'fsSysMemCapacity.0', '-OvQ', 'FORTINET-FORTISWITCH-MIB');
$mempool['free'] = ($mempool['total'] - $mempool['used']);
$mempool['perc'] = $mempool['total'] / $mempool['used'];
echo '(U: '.$mempool['used'].' T: '.$mempool['total'].' F: '.$mempool['free'].') ';

View File

@@ -0,0 +1,29 @@
<?php
/**
* fortiswitch.inc.php
*
* LibreNMS os polling module for FortiSwitch
*
* 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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
$temp_data = explode(' ', snmp_get($device, 'fsSysVersion.0', '-Onvq', 'FORTINET-FORTISWITCH-MIB'));
$hardware = $temp_data[0];
$version = $temp_data[1];
$serial = preg_replace('/"/', '', snmp_get($device, 'fnSysSerial.0', '-Onvq', 'FORTINET-CORE-MIB'));

View File

@@ -0,0 +1,223 @@
--
-- MODULE-IDENTITY
-- OrgName
-- Fortinet Technologies, Inc.
-- ContactInfo
-- Technical Support
-- e-mail: support@fortinet.com
-- http://www.fortinet.com
--
FORTINET-FORTISWITCH-MIB DEFINITIONS ::= BEGIN
IMPORTS
fnSysSerial, fortinet
FROM FORTINET-CORE-MIB
sysName
FROM SNMPv2-MIB
MODULE-COMPLIANCE, NOTIFICATION-GROUP, OBJECT-GROUP
FROM SNMPv2-CONF
Gauge32, MODULE-IDENTITY,
NOTIFICATION-TYPE, OBJECT-TYPE
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
fnFortiSwitchMib MODULE-IDENTITY
LAST-UPDATED "201109280000Z"
ORGANIZATION
"Fortinet Technologies, Inc."
CONTACT-INFO
"
Technical Support
email: support@fortinet.com
http://www.fortinet.com"
DESCRIPTION
"MIB module for Fortinet FortiSwitch devices."
REVISION "201109280000Z"
DESCRIPTION
"Initial version of FORTINET-FORTISWITCH-MIB."
::= { fortinet 106 }
--
-- fortinet.fnFortiSwitchMib.fsModel
--
fsModel OBJECT IDENTIFIER
::= { fnFortiSwitchMib 1 }
--
-- fortinet.fnFortiSwitchMib.fsTraps
--
fsTraps OBJECT IDENTIFIER
::= { fnFortiSwitchMib 2 }
fsTrapPrefix OBJECT IDENTIFIER
::= { fsTraps 0 }
--
-- fortinet.fnFortiSwitchMib.fsTrunkMemPrefix
--
fsTrunkMemPrefix OBJECT IDENTIFIER
::= { fnFortiSwitchMib 3 }
fsTrunkMember OBJECT-TYPE
SYNTAX DisplayString (SIZE(0..82))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Trunk members of the device, including this trunk member's corresponding blade's serial number and its slot name"
::= { fsTrunkMemPrefix 1 }
fsTrapHBFail NOTIFICATION-TYPE
OBJECTS { fnSysSerial, sysName, fsTrunkMember}
STATUS current
DESCRIPTION
"Indicates no heart beat packets received."
::= { fsTrapPrefix 701 }
fsTrapHBReceived NOTIFICATION-TYPE
OBJECTS { fnSysSerial,sysName, fsTrunkMember}
STATUS current
DESCRIPTION
"Indicates heart beat pacekts have been received."
::= { fsTrapPrefix 702 }
fsTrapMemberDown NOTIFICATION-TYPE
OBJECTS { fnSysSerial,sysName,fsTrunkMember }
STATUS current
DESCRIPTION
"A trunk member has left this trunk."
::= { fsTrapPrefix 703 }
fsTrapMemberUp NOTIFICATION-TYPE
OBJECTS { fnSysSerial,sysName, fsTrunkMember}
STATUS current
DESCRIPTION
"A trunk member has joined this trunk"
::= { fsTrapPrefix 704 }
--
-- fortinet.fnFortiSwitchMib.fsSystem
--
fsSystem OBJECT IDENTIFIER
::= { fnFortiSwitchMib 4 }
fsSystemInfo OBJECT IDENTIFIER
::= { fsSystem 1 }
fsSysVersion OBJECT-TYPE
SYNTAX DisplayString (SIZE(0..128))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Firmware version of the device"
::= { fsSystemInfo 1 }
fsSysCpuUsage OBJECT-TYPE
SYNTAX Gauge32 (0..100)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current CPU usage (percentage)"
::= { fsSystemInfo 2 }
fsSysMemUsage OBJECT-TYPE
SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current system memory usage (KB)"
::= { fsSystemInfo 3 }
fsSysMemCapacity OBJECT-TYPE
SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Total physical memory (RAM) installed (KB)"
::= { fsSystemInfo 4 }
fsSysDiskUsage OBJECT-TYPE
SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current hard disk usage (KB), if disk is present"
::= { fsSystemInfo 5 }
fsSysDiskCapacity OBJECT-TYPE
SYNTAX Gauge32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Total hard disk capacity (KB), if disk is present"
::= { fsSystemInfo 6 }
fsSoftware OBJECT IDENTIFIER
::= { fsSystem 2 }
fsDirverVersion OBJECT-TYPE
SYNTAX DisplayString (SIZE(0..128))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current driver version of this device"
::= { fsSoftware 1 }
--
-- fortinet.fnFortiSwitchMib.fsMibConformance
--
fsMibConformance OBJECT IDENTIFIER
::= { fnFortiSwitchMib 100 }
fsNotificationGroup NOTIFICATION-GROUP
NOTIFICATIONS { fsTrapHBFail, fsTrapHBReceived, fsTrapMemberDown, fsTrapMemberUp }
STATUS current
DESCRIPTION
"Notifications that can be generated from a FortiSwitch device."
::= { fsMibConformance 1 }
fsSystemObjectGroup OBJECT-GROUP
OBJECTS { fsSysVersion, fsSysCpuUsage,
fsSysMemUsage, fsSysMemCapacity,
fsSysDiskUsage, fsSysDiskCapacity,
fsDirverVersion }
STATUS current
DESCRIPTION
"Objects pertaining to the system status of the device."
::= { fsMibConformance 2 }
fsTrunkObjectGroup OBJECT-GROUP
OBJECTS { fsTrunkMember }
STATUS current
DESCRIPTION
"Objects pertaining to the information of the trunk."
::= { fsMibConformance 3 }
fsMIBCompliance MODULE-COMPLIANCE
STATUS current
DESCRIPTION
"The compliance statement for the application MIB."
MODULE -- this module
GROUP fsNotificationGroup
DESCRIPTION
"Notifications are feature dependant. See manual for feature information."
GROUP fsSystemObjectGroup
DESCRIPTION
"Model and feature specific."
GROUP fsTrunkObjectGroup
DESCRIPTION
"Model and feature specific."
::= { fsMibConformance 100 }
END -- end of module FORTINET-FORTISWITCH-MIB.

View File

@@ -553,6 +553,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('fortios');
}
public function testFortiswitch()
{
$this->checkOS('fortiswitch');
}
public function testFoundryos()
{
$this->checkOS('foundryos');

View File

@@ -1,2 +1,2 @@
1.3.6.1.2.1.1.1.0|4|Acano
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10

View File

@@ -0,0 +1,2 @@
1.3.6.1.4.1.12356.106.4.1.1.0|4|FortiSwitch-248D-FPOE v3.3.3,build4047,160219 (GA)
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.12356.106.1.2482