Files
librenms-librenms/includes/polling/storage/cisco-flash.inc.php
Félix Bouynot b643a5033f Add Cisco Flash storage support (#14219)
* Add Cisco flash storage discovery

* Add Cisco flash storage polling

* LibreNMS indentation

* Move file to storage module

* move file to storage module

* Rename and check

Rename the file and add a check only against Cisco devices

* Rename file

* Change parameter from mib name to file name

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Add a first test file for review - Nexus C9340 NXOS ver 10.2.2

* Add first device test files for review - Nexus 9340 ver 10.2.2

* Add Cisco IOS 15.2.7 on C2960X snmprec file

* Add Cisco IOS 15.2.7 on C2960X test data file

* Create nxos_n5548-7.3.3.snmprec

* Create nxos_n5548-7.3.3.json

* Update nxos_n5548-7.3.3.snmprec

* Update nxos_n9340-10.2.2.snmprec

* Update ios_c2960x-15.2.7.snmprec

* Update nxos_n5548-7.3.3.json

* Update nxos_n9340-10.2.2.json

* Update ios_c2960x-15.2.7.json

* Update cisco-flash.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-08-23 11:31:47 +02:00

36 lines
1.7 KiB
PHP

<?php
/**
* cisco-flash.inc.php
*
* LibreNMS storage polling module for Cisco Flash
*
* 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/>.
*
* @package LibreNMS
* @link https://www.librenms.org
* @copyright 2022 Félix Bouynot
* @author Félix Bouynot <felix.bouynot@setenforce.one>
*/
use LibreNMS\Util\Number;
$oids = array('ciscoFlashPartitionSize.' . $storage['storage_index'], 'ciscoFlashPartitionFreeSpace.' . $storage['storage_index'], 'ciscoFlashPartitionSizeExtended.' . $storage['storage_index'], 'ciscoFlashPartitionFreeSpaceExtended.' . $storage['storage_index']);
$entry = array_shift(snmp_get_multi($device, $oids, '-OQUs', 'CISCO-FLASH-MIB'));
$storage['size'] = (Number::cast($entry['ciscoFlashPartitionSize']) === 4294967295 ? $entry['ciscoFlashPartitionSizeExtended'] : $entry['ciscoFlashPartitionSize']);
$storage['free'] = (Number::cast($entry['ciscoFlashPartitionFreeSpace']) === 4294967295 ? $entry['ciscoFlashPartitionFreeSpaceExtended'] : $entry['ciscoFlashPartitionFreeSpace']);
$storage['used'] = $storage['size'] - $storage['free'];
$storage['units'] = 1;
unset ($oids, $entry);