Skip to content

Commit

Permalink
add support for sagemcom (#9835)
Browse files Browse the repository at this point in the history
* adds support for sagemcom

* requested changes

* delete unused variable

* logos

* modules fine tuning

* code style

* Update sagemcom.svg

* Update sagemcom.svg
  • Loading branch information
vitalisator authored and murrant committed Mar 1, 2019
1 parent e82f1fc commit 49f0197
Show file tree
Hide file tree
Showing 25 changed files with 12,244 additions and 0 deletions.
67 changes: 67 additions & 0 deletions LibreNMS/Snmptrap/Handlers/EquipStatusTrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* equipStatusTrap.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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Vitali Kari
* @author Vitali Kari <vitali.kari@gmail.com>
*/

namespace LibreNMS\Snmptrap\Handlers;

use App\Models\Device;
use LibreNMS\Interfaces\SnmptrapHandler;
use LibreNMS\Snmptrap\Trap;

class EquipStatusTrap implements SnmptrapHandler
{

/**
* Handle snmptrap.
* Data is pre-parsed and delivered as a Trap.
*
* @param Device $device
* @param Trap $trap
* @return void
*/
public function handle(Device $device, Trap $trap)
{
$state = $trap->getOidData('EQUIPMENT-MIB::equipStatus.0');

$severity = $this->getSeverity($state);
log_event('SNMP Trap: Equipment Status ' . $state, $device->toArray(), 'state', $severity);
}

private function getSeverity($state)
{
$severity_map = [
'warning' => 4,
'major' => 4,
'5' => 4,
'3' => 4,
'critical' => 5,
'4' => 5,
'minor' => 3,
'2' => 3,
'nonAlarmed' => 1,
'1' => 1,
];
return $severity_map[$state] ?? 0;
}
}
74 changes: 74 additions & 0 deletions LibreNMS/Snmptrap/Handlers/LogTrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
* logTrap.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 <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Vitali Kari
* @author Vitali Kari <vitali.kari@gmail.com>
*/

namespace LibreNMS\Snmptrap\Handlers;

use App\Models\Device;
use LibreNMS\Interfaces\SnmptrapHandler;
use LibreNMS\Snmptrap\Trap;

class LogTrap implements SnmptrapHandler
{

/**
* Handle snmptrap.
* Data is pre-parsed and delivered as a Trap.
*
* @param Device $device
* @param Trap $trap
* @return void
*/
public function handle(Device $device, Trap $trap)
{
$index = $trap->findOid('LOG-MIB::logIndex');
$index = $trap->getOidData($index);

$logName = $trap->getOidData('LOG-MIB::logName.'.$index);
$logEvent = $trap->getOidData('LOG-MIB::logEvent.'.$index);
$logPC = $trap->getOidData('LOG-MIB::logPC.'.$index);
$logAI = $trap->getOidData('LOG-MIB::logAI.'.$index);
$state = $trap->getOidData('LOG-MIB::logEquipStatusV2.'.$index);

$severity = $this->getSeverity($state);
log_event('SNMP Trap: Log '.$logName.' '.$logEvent.' '.$logPC.' '.$logAI.' '.$state, $device->toArray(), 'log', $severity);
}

private function getSeverity($state)
{
$severity_map = [
'warning' => 4,
'major' => 4,
'5' => 4,
'3' => 4,
'critical' => 5,
'4' => 5,
'minor' => 3,
'2' => 3,
'nonAlarmed' => 1,
'1' => 1,
];
return $severity_map[$state] ?? 0;
}
}
2 changes: 2 additions & 0 deletions config/snmptraps.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
'IF-MIB::linkDown' => \LibreNMS\Snmptrap\Handlers\LinkDown::class,
'MG-SNMP-UPS-MIB::upsmgUtilityFailure' => \LibreNMS\Snmptrap\Handlers\UpsmgUtilityFailure::class,
'MG-SNMP-UPS-MIB::upsmgUtilityRestored' => \LibreNMS\Snmptrap\Handlers\UpsmgUtilityRestored::class,
'EQUIPMENT-MIB::equipStatusTrap' => \LibreNMS\Snmptrap\Handlers\EquipStatusTrap::class,
'LOG-MIB::logTrap' => \LibreNMS\Snmptrap\Handlers\LogTrap::class,
]
];
1 change: 1 addition & 0 deletions html/images/logos/sagemcom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions html/images/os/sagemcom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions includes/definitions/discovery/ionos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mib: EQUIPMENT-MIB
modules:
sensors:
state:
data:
-
oid: equipStatusV2
num_oid: '.1.3.6.1.4.1.1038.107.11.{{ $index }}'
descr: Status of all equipment objects
state_name: Severity
states:
- { value: 1, generic: 0, graph: 0, descr: nonAlarmed }
- { value: 2, generic: 0, graph: 0, descr: minor }
- { value: 3, generic: 1, graph: 0, descr: major }
- { value: 4, generic: 2, graph: 0, descr: critical }
- { value: 5, generic: 1, graph: 0, descr: warning }
- { value: 6, generic: 0, graph: 0, descr: invNonAlarmed }
- { value: 7, generic: 0, graph: 0, descr: invMinor }
- { value: 8, generic: 1, graph: 0, descr: invMajor }
- { value: 9, generic: 2, graph: 0, descr: invCritical }
- { value: 10, generic: 1, graph: 0, descr: invWarning }
28 changes: 28 additions & 0 deletions includes/definitions/ionos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
os: ionos
text: 'Sagem ADR IONOS'
type: network
icon: sagemcom
group: sagemcom
over:
- { graph: device_bits, text: 'Device Traffic' }
discovery:
- sysObjectID:
- .1.3.6.1.4.1.1038
poller_modules:
hr-mib: false
ucd-mib: false
stp: false
ospf: false
discovery_modules:
processors: false
mempools: false
entity-physical: false
storage: false
hr-device: false
discovery-protocols: false
bgp-peers: false
ports-stack: false
vlans: false
ucd-diskio: false
stp: false
fdb-table: false
57 changes: 57 additions & 0 deletions mibs/sagemcom/ADR155C-MIB
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--*******************************************************************
--* SAGEM, IONOS *
--*******************************************************************
--*******************************************************************
--
-- Filename: adr155c
--
-- File type: .mib
--
-- Description: SNMP source Mib file.
--
-- Version: 19 11 2002
--
-- Date(DD MM YYYY): 15 11 02 last update for IONOS NMS
--
-- Contact: D. Mobuchon, F. Bonnevialle
--
-- History:
-- Version: MIB-P0-301199 Date: 30 11 1999
--
-- Name: F.Bonnevialle
-- Date: 15 11 2002
-- Desc: Modification for SilverCreek Compiler
--*******************************************************************
--*******************************************************************
--* Copyright (c) 2002, SAGEM , All rights reserved. *
--*******************************************************************




--*******************************************************************
-- MIB: ADR155C-MIB
--*******************************************************************
ADR155C-MIB DEFINITIONS ::= BEGIN

IMPORTS
sagemDr FROM SAGEM-DR-MIB
MODULE-IDENTITY FROM SNMPv2-SMI ;

-- SRU :


adr155c MODULE-IDENTITY
LAST-UPDATED "0211150000Z"
ORGANIZATION "SAGEM-Tolbiac drd/ddp/tmhd"
CONTACT-INFO
" "
DESCRIPTION
"The MIB module specific for ARD155c equipment"
::= { sagemDr 12 }




END

54 changes: 54 additions & 0 deletions mibs/sagemcom/ADR2500C-MIB
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--*******************************************************************
--* SAGEM, IONOS *
--*******************************************************************
--*******************************************************************
--
-- Filename: adr2500c
--
-- File type: .mib
--
-- Description: SNMP source Mib file.
--
-- Version: 19 11 2002
--
-- Date(DD MM YYYY): 15 11 02 last update for IONOS NMS
--
-- Contact: D. Mobuchon, F. Bonnevialle
--
-- History:
-- Version: MIB-P0-301199 Date: 30 11 1999
--
-- Name: F.Bonnevialle
-- Date: 15 11 2002
-- Desc: Modification for SilverCreek Compiler
--*******************************************************************
--*******************************************************************
--* Copyright (c) 2002, SAGEM , All rights reserved. *
--*******************************************************************




--*******************************************************************
-- MIB: ADR2500C-MIB
--*******************************************************************
ADR2500C-MIB DEFINITIONS ::= BEGIN

IMPORTS
sagemDr FROM SAGEM-DR-MIB
MODULE-IDENTITY FROM SNMPv2-SMI ;

adr2500c MODULE-IDENTITY
LAST-UPDATED "0211150000Z"
ORGANIZATION "SAGEM-Tolbiac drd/ddp/tmhd"
CONTACT-INFO
" "
DESCRIPTION
"The MIB module specific for ARD2500c equipment"
::= { sagemDr 17 }




END

Loading

0 comments on commit 49f0197

Please sign in to comment.