mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Coriant Network Hardware Page. (#6187)
* Fix the definition. Should be mef instead of mef-evc * Added Coriant TNMS Hardware page. * Polling and discovery modules for TNMS Network Equipements. * SQL in one line. * Only show when OS is coriant * Fix conflict file * Conflict file * Added missing COLLATE * Refactor poller code for more data to be inserted into DB in the future. Removed the discovery module and merged it into poller code. * Removed tnms-nbi discovery also in the yaml * Removing debug * Code updates and fixes + schema rename * bootstrapify the code. Renamed the sql file * Bloody tabs ! * Add db_schema.yaml update.
This commit is contained in:
committed by
Neil Lathwood
parent
069020cb80
commit
4b0972628f
26
includes/polling/os/coriant.inc.php
Normal file
26
includes/polling/os/coriant.inc.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* coriant.inc.php
|
||||
*
|
||||
* LibreNMS os poller module for Coriant
|
||||
*
|
||||
* 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 2017 Neil Lathwood
|
||||
* @author Neil Lathwood <neil@lathwood.co.uk>
|
||||
*/
|
||||
|
||||
require 'includes/polling/os/misc/tnms-nbi.inc.php';
|
48
includes/polling/os/misc/tnms-nbi.inc.php
Normal file
48
includes/polling/os/misc/tnms-nbi.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
echo 'TNMS-NBI-MIB: ';
|
||||
|
||||
/*
|
||||
* Coriant have done some SQL over SNMP, since we have to populate and update all the tables
|
||||
* before using it, we have to do ugly stuff
|
||||
*/
|
||||
function SqlSNMP($table, $cmib, $device)
|
||||
{
|
||||
|
||||
echo " $cmib ";
|
||||
$c_oids = snmpwalk_cache_multi_oid($device, $cmib, array(), 'TNMS-NBI-MIB');
|
||||
$c_list = array();
|
||||
|
||||
foreach ($c_oids as $index => $entry) {
|
||||
$neType = $entry['enmsNeType'];
|
||||
$neName = $entry['enmsNeName'];
|
||||
$neLocation = $entry['enmsNeLocation'];
|
||||
$neAlarm = $entry['enmsNeAlarmSeverity'];
|
||||
$neOpMode = $entry['enmsNeOperatingMode'];
|
||||
$neOpState = $entry['enmsNeOpState'];
|
||||
|
||||
if (dbFetchCell("SELECT COUNT(id) FROM $table WHERE `device_id` = ? AND `neID` = ?", array($device['device_id'], $index)) == 0) {
|
||||
dbInsert(array('device_id' => $device['device_id'], 'neID' => $index, 'neType' => mres($neType), 'neName' => mres($neName), 'neLocation' => mres($neLocation), 'neAlarm' => mres($neAlarm), 'neOpMode' => mres($neOpMode), 'neOpState' => mres($neOpState)), $table);
|
||||
log_event("Coriant $cmib Hardware ". mres($neType) . " : " . mres($neName) . " ($index) at " . mres($neLocation) . " Discovered", $device, 'system', 2);
|
||||
echo '+';
|
||||
} else {
|
||||
echo '.';
|
||||
}
|
||||
$c_list[] = $index;
|
||||
}
|
||||
|
||||
$sql = "SELECT id, neID, neName FROM $table WHERE device_id = ?";
|
||||
$params = array($device['device_id']);
|
||||
foreach (dbFetchRows($sql, $params) as $db_ne) {
|
||||
d_echo($db_ne);
|
||||
if (!in_array($db_ne['neID'], $c_list)) {
|
||||
dbDelete($table, '`id` = ?', array($db_ne['id']));
|
||||
log_event("Coriant $cmib Hardware ".mres($db_ne['neName']).' at ' . mres($db_ne['neLocation']) . ' Removed', $device, 'system', $db_ne['neID']);
|
||||
echo '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SqlSNMP('tnmsneinfo', 'enmsNETable', $device);
|
||||
|
||||
echo PHP_EOL;
|
Reference in New Issue
Block a user