Files

52 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2009-09-07 11:07:59 +00:00
<?php
2007-04-08 18:09:08 +00:00
use LibreNMS\RRD\RrdDefinition;
list($hardware, $version, ) = explode(',', str_replace(', ', ',', $device['sysDescr']));
2012-04-13 23:10:32 +00:00
2015-07-13 20:10:26 +02:00
// Clean up hardware
$hardware = str_replace('PROCURVE', 'ProCurve', $hardware);
if (substr($hardware, 0, 3) == 'HP ') {
$hardware = substr($hardware, 3);
}
if (substr($hardware, 0, 24) == 'Hewlett-Packard Company ') {
$hardware = substr($hardware, 24);
}
2012-04-13 23:10:32 +00:00
2015-07-13 20:10:26 +02:00
$altversion = trim(snmp_get($device, 'hpSwitchOsVersion.0', '-Oqv', 'NETSWITCH-MIB'), '"');
if ($altversion) {
$version = $altversion;
}
2012-04-13 23:10:32 +00:00
2015-07-13 20:10:26 +02:00
$altversion = trim(snmp_get($device, '.1.3.6.1.4.1.11.2.3.7.11.12.1.2.1.11.0', '-Oqv'), '"');
if ($altversion) {
$version = $altversion;
}
2007-04-08 18:09:08 +00:00
if (preg_match('/^PROCURVE (.*) - (.*)/', $device['sysDescr'], $regexp_result)) {
2015-07-13 20:10:26 +02:00
$hardware = 'ProCurve '.$regexp_result[1];
$version = $regexp_result[2];
}
2015-07-13 20:10:26 +02:00
$serial = snmp_get($device, '.1.3.6.1.4.1.11.2.36.1.1.2.9.0', '-Oqv', 'SEMI-MIB');
$serial = trim(str_replace('"', '', $serial));
2012-04-07 22:28:53 +00:00
2012-05-25 12:24:34 +00:00
// FIXME maybe genericise? or do away with it if we ever walk the full dot1qTpFdbTable as we can count ourselves then ;)
2015-07-13 20:10:26 +02:00
$FdbAddressCount = snmp_get($device, 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB');
2010-07-30 13:35:58 +00:00
2015-07-13 20:10:26 +02:00
if (is_numeric($FdbAddressCount)) {
$rrd_def = RrdDefinition::make()->addDataset('value', 'GAUGE', -1, 100000);
2010-07-30 13:54:00 +00:00
$fields = array(
'value' => $FdbAddressCount,
);
$tags = compact('rrd_def');
data_update($device, 'fdb_count', $tags, $fields);
2015-08-19 20:58:02 +00:00
2015-07-13 20:10:26 +02:00
$graphs['fdb_count'] = true;
2007-04-08 18:09:08 +00:00
2015-07-13 20:10:26 +02:00
echo 'FDB Count ';
2010-07-30 13:54:00 +00:00
}