Fix coding style part 2

This commit is contained in:
Job Snijders
2015-07-13 20:10:26 +02:00
parent ad9590df9b
commit d8693f05ae
733 changed files with 37359 additions and 33947 deletions
+2 -4
View File
@@ -1,6 +1,4 @@
<?php
# Version is the last word in the sysDescr's first line
list($version) = explode("\r", substr($poll_device['sysDescr'], strpos($poll_device['sysDescr'], "Release")+8));
?>
// Version is the last word in the sysDescr's first line
list($version) = explode("\r", substr($poll_device['sysDescr'], (strpos($poll_device['sysDescr'], 'Release') + 8)));
+3 -3
View File
@@ -1,8 +1,8 @@
<?php
$hardware = "Ubiquiti AF ".trim(snmp_get($device, "dot11manufacturerProductName.5", "-Ovq", "IEEE802dot11-MIB", "/opt/librenms/mibs:/opt/librenms/mibs/rfc:/opt/librenms/mibs/net-snmp:/opt/librenms/mibs/ubiquiti"));
$hardware = 'Ubiquiti AF '.trim(snmp_get($device, 'dot11manufacturerProductName.5', '-Ovq', 'IEEE802dot11-MIB', '/opt/librenms/mibs:/opt/librenms/mibs/rfc:/opt/librenms/mibs/net-snmp:/opt/librenms/mibs/ubiquiti'));
$version = trim(snmp_get($device, "dot11manufacturerProductVersion.5", "-Ovq", "IEEE802dot11-MIB", "/opt/librenms/mibs:/opt/librenms/mibs/rfc:/opt/librenms/mibs/net-snmp:/opt/librenms/mibs/ubiquiti"));
list(, $version) = preg_split('/\.v/',$version);
$version = trim(snmp_get($device, 'dot11manufacturerProductVersion.5', '-Ovq', 'IEEE802dot11-MIB', '/opt/librenms/mibs:/opt/librenms/mibs/rfc:/opt/librenms/mibs/net-snmp:/opt/librenms/mibs/ubiquiti'));
list(, $version) = preg_split('/\.v/', $version);
// EOF
+3 -3
View File
@@ -1,8 +1,8 @@
<?php
$hardware = "Ubiquiti ".trim(snmp_get($device, "dot11manufacturerProductName.5", "-Ovq", "IEEE802dot11-MIB"));
$hardware = 'Ubiquiti '.trim(snmp_get($device, 'dot11manufacturerProductName.5', '-Ovq', 'IEEE802dot11-MIB'));
$version = trim(snmp_get($device, "dot11manufacturerProductVersion.5", "-Ovq", "IEEE802dot11-MIB"));
list(, $version) = preg_split('/\.v/',$version);
$version = trim(snmp_get($device, 'dot11manufacturerProductVersion.5', '-Ovq', 'IEEE802dot11-MIB'));
list(, $version) = preg_split('/\.v/', $version);
// EOF
+1 -3
View File
@@ -1,5 +1,3 @@
<?php
list(,$hardware,$version) = explode(' ',$poll_device['sysDescr']);
?>
list(,$hardware,$version) = explode(' ', $poll_device['sysDescr']);
+65 -86
View File
@@ -1,116 +1,95 @@
<?php
# PDU
$serial = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentSerialNumber.0", "-OQv", "", ""),'"');
// PDU
$serial = trim(snmp_get($device, 'PowerNet-MIB::rPDUIdentSerialNumber.0', '-OQv', '', ''), '"');
if ($serial == "")
{
# ATS
$serial = trim(snmp_get($device, "PowerNet-MIB::atsIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == '') {
// ATS
$serial = trim(snmp_get($device, 'PowerNet-MIB::atsIdentSerialNumber.0', '-OQv', '', ''), '"');
}
if ($serial == "")
{
# UPS
$serial = trim(snmp_get($device, "PowerNet-MIB::upsAdvIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == '') {
// UPS
$serial = trim(snmp_get($device, 'PowerNet-MIB::upsAdvIdentSerialNumber.0', '-OQv', '', ''), '"');
}
if ($serial == "")
{
# Masterswitch/AP9606
$serial = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == '') {
// Masterswitch/AP9606
$serial = trim(snmp_get($device, 'PowerNet-MIB::sPDUIdentSerialNumber.0', '-OQv', '', ''), '"');
}
if ($serial == "")
{
# InRow chiller
$serial = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == '') {
// InRow chiller
$serial = trim(snmp_get($device, 'PowerNet-MIB::airIRRCUnitIdentSerialNumber.0', '-OQv', '', ''), '"');
}
if ($serial == "")
{
# InfraStruxure
$serial = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == '') {
// InfraStruxure
$serial = trim(snmp_get($device, 'PowerNet-MIB::isxModularPduIdentSerialNumber.0', '-OQv', '', ''), '"');
}
/////////////////////
//
// PDU
$hardware = trim(snmp_get($device, 'PowerNet-MIB::rPDUIdentModelNumber.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::rPDUIdentHardwareRev.0', '-OQv', '', ''), '"');
# PDU
$hardware = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::rPDUIdentHardwareRev.0", "-OQv", "", ""),'"');
if ($hardware == " ")
{
# ATS
$hardware = trim(snmp_get($device, "PowerNet-MIB::atsIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::atsIdentHardwareRev.0", "-OQv", "", ""),'"');
if ($hardware == ' ') {
// ATS
$hardware = trim(snmp_get($device, 'PowerNet-MIB::atsIdentModelNumber.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::atsIdentHardwareRev.0', '-OQv', '', ''), '"');
}
if ($hardware == " ")
{
# UPS
$hardware = trim(snmp_get($device, "PowerNet-MIB::upsBasicIdentModel.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::upsAdvIdentFirmwareRevision.0", "-OQv", "", ""),'"');
if ($hardware == ' ') {
// UPS
$hardware = trim(snmp_get($device, 'PowerNet-MIB::upsBasicIdentModel.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::upsAdvIdentFirmwareRevision.0', '-OQv', '', ''), '"');
}
if ($hardware == " ")
{
# Masterswitch/AP9606
$hardware = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::sPDUIdentHardwareRev.0", "-OQv", "", ""),'"');
if ($hardware == ' ') {
// Masterswitch/AP9606
$hardware = trim(snmp_get($device, 'PowerNet-MIB::sPDUIdentModelNumber.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::sPDUIdentHardwareRev.0', '-OQv', '', ''), '"');
}
if ($hardware == " ")
{
# InRow chiller
$hardware = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentHardwareRevision.0", "-OQv", "", ""),'"');
if ($hardware == ' ') {
// InRow chiller
$hardware = trim(snmp_get($device, 'PowerNet-MIB::airIRRCUnitIdentModelNumber.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::airIRRCUnitIdentHardwareRevision.0', '-OQv', '', ''), '"');
}
if ($hardware == " ")
{
# InfraStruxure
$hardware = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentMonitorCardHardwareRev.0", "-OQv", "", ""),'"');
if ($hardware == ' ') {
// InfraStruxure
$hardware = trim(snmp_get($device, 'PowerNet-MIB::isxModularPduIdentModelNumber.0', '-OQv', '', ''), '"');
$hardware .= ' '.trim(snmp_get($device, 'PowerNet-MIB::isxModularPduIdentMonitorCardHardwareRev.0', '-OQv', '', ''), '"');
}
/////////////////////
$AOSrev = trim(snmp_get($device, '1.3.6.1.4.1.318.1.4.2.4.1.4.1', '-OQv', '', ''), '"');
$APPrev = trim(snmp_get($device, '1.3.6.1.4.1.318.1.4.2.4.1.4.2', '-OQv', '', ''), '"');
$AOSrev = trim(snmp_get($device, "1.3.6.1.4.1.318.1.4.2.4.1.4.1", "-OQv", "", ""),'"');
$APPrev = trim(snmp_get($device, "1.3.6.1.4.1.318.1.4.2.4.1.4.2", "-OQv", "", ""),'"');
if ($AOSrev == '') {
// PDU
$version = trim(snmp_get($device, 'PowerNet-MIB::rPDUIdentFirmwareRev.0', '-OQv', '', ''), '"');
if ($AOSrev == '')
{
# PDU
$version = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentFirmwareRev.0", "-OQv", "", ""),'"');
if ($version == '') {
// ATS
$version = trim(snmp_get($device, 'PowerNet-MIB::atsIdentFirmwareRev.0', '-OQv', '', ''), '"');
}
if ($version == "")
{
# ATS
$version = trim(snmp_get($device, "PowerNet-MIB::atsIdentFirmwareRev.0", "-OQv", "", ""),'"');
}
if ($version == '') {
// Masterswitch/AP9606
$version = trim(snmp_get($device, 'PowerNet-MIB::sPDUIdentFirmwareRev.0', '-OQv', '', ''), '"');
}
if ($version == "")
{
# Masterswitch/AP9606
$version = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentFirmwareRev.0", "-OQv", "", ""),'"');
}
if ($version == '') {
// InRow chiller
$version = trim(snmp_get($device, 'PowerNet-MIB::airIRRCUnitIdentFirmwareRevision.0', '-OQv', '', ''), '"');
}
if ($version == "")
{
# InRow chiller
$version = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentFirmwareRevision.0", "-OQv", "", ""),'"');
}
if ($version == "")
{
# InfraStruxure
$version = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentMonitorCardFirmwareAppRev.0", "-OQv", "", ""),'"');
}
if ($version == '') {
// InfraStruxure
$version = trim(snmp_get($device, 'PowerNet-MIB::isxModularPduIdentMonitorCardFirmwareAppRev.0', '-OQv', '', ''), '"');
}
}
else
{
$version = "AOS $AOSrev / App $APPrev";
}
?>
else {
$version = "AOS $AOSrev / App $APPrev";
}//end if
+2 -4
View File
@@ -1,6 +1,4 @@
<?php
$version = preg_replace("/.+ version (.+) running on .+ (\S+)$/", "\\1||\\2", $poll_device['sysDescr']);
list($version,$hardware) = explode("||", $version);
?>
$version = preg_replace('/.+ version (.+) running on .+ (\S+)$/', '\\1||\\2', $poll_device['sysDescr']);
list($version,$hardware) = explode('||', $version);
+10 -8
View File
@@ -9,24 +9,26 @@
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
*/
$oids = "entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1 entPhysicalModelName.4 entPhysicalSoftwareRev.4";
$oids = 'entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1 entPhysicalModelName.4 entPhysicalSoftwareRev.4';
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB");
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB');
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != "") {
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') {
$version = $data[1]['entPhysicalSoftwareRev'];
} elseif (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != "") {
}
else if (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != '') {
$version = $data[4]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != "") {
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
$hardware = $data[1]['entPhysicalModelName'];
} elseif (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != "") {
}
else if (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != '') {
$hardware = $data[4]['entPhysicalModelName'];
}
if (isset($data[1]['entPhysicalSerialNum']) && $data[1]['entPhysicalSerialNum'] != "") {
if (isset($data[1]['entPhysicalSerialNum']) && $data[1]['entPhysicalSerialNum'] != '') {
$serial = $data[1]['entPhysicalSerialNum'];
}
+6 -4
View File
@@ -1,11 +1,13 @@
<?php
$canopy_type = snmp_get($device,"boxDeviceType.0", "-Oqv", "WHISP-BOX-MIBV2-MIB");
$canopy_type = snmp_get($device, 'boxDeviceType.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
if (stristr($canopy_type,"MIMO OFDM")) {
if (stristr($canopy_type, 'MIMO OFDM')) {
$hardware = 'PMP 450';
} elseif (stristr($canopy_type,"OFDM")) {
}
else if (stristr($canopy_type, 'OFDM')) {
$hardware = 'PMP 430';
} else {
}
else {
$hardware = 'PMP 100';
}
+2 -4
View File
@@ -1,6 +1,4 @@
<?php
list(,$version) = explode(',',$poll_device['sysDescr'],2);
$hardware = "1900";
?>
list(,$version) = explode(',', $poll_device['sysDescr'], 2);
$hardware = '1900';
+17 -18
View File
@@ -1,24 +1,23 @@
<?php
#Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 4.5(9) Copyright (c) 1995-2000 by Cisco Systems, Inc.
#Cisco Systems WS-C5509 Cisco Catalyst Operating System Software, Version 5.5(19) Copyright (c) 1995-2003 by Cisco Systems
#Cisco Systems WS-C5500 Cisco Catalyst Operating System Software, Version 5.5(18) Copyright (c) 1995-2002 by Cisco Systems
#Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 8.4(11)GLX Copyright (c) 1995-2006 by Cisco Systems, Inc.
#Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 5.5(11) Copyright (c) 1995-2001 by Cisco Systems, Inc.
#Cisco Systems, Inc. WS-C4003 Cisco Catalyst Operating System Software, Version 6.4(13) Copyright (c) 1995-2004 by Cisco Systems, Inc.
#Cisco Systems, Inc. WS-C4006 Cisco Catalyst Operating System Software, Version 6.3(9) Copyright (c) 1995-2002 by Cisco Systems, Inc.
if (strstr($ciscomodel, "OID")) { unset($ciscomodel); }
if (!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3')
{
$hardware = $ciscomodel;
// Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 4.5(9) Copyright (c) 1995-2000 by Cisco Systems, Inc.
// Cisco Systems WS-C5509 Cisco Catalyst Operating System Software, Version 5.5(19) Copyright (c) 1995-2003 by Cisco Systems
// Cisco Systems WS-C5500 Cisco Catalyst Operating System Software, Version 5.5(18) Copyright (c) 1995-2002 by Cisco Systems
// Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 8.4(11)GLX Copyright (c) 1995-2006 by Cisco Systems, Inc.
// Cisco Systems, Inc. WS-C2948 Cisco Catalyst Operating System Software, Version 5.5(11) Copyright (c) 1995-2001 by Cisco Systems, Inc.
// Cisco Systems, Inc. WS-C4003 Cisco Catalyst Operating System Software, Version 6.4(13) Copyright (c) 1995-2004 by Cisco Systems, Inc.
// Cisco Systems, Inc. WS-C4006 Cisco Catalyst Operating System Software, Version 6.3(9) Copyright (c) 1995-2002 by Cisco Systems, Inc.
if (strstr($ciscomodel, 'OID')) {
unset($ciscomodel);
}
$poll_device['sysDescr'] = str_replace(", Inc.", "", $poll_device['sysDescr']); // Make the two formats the same
$poll_device['sysDescr'] = str_replace("\n", " ", $poll_device['sysDescr']);
if (!strstr($ciscomodel, ' ') && strlen($ciscomodel) >= '3') {
$hardware = $ciscomodel;
}
list(,,$hardware,,,,,,,$version,,,$features) = explode(" ", $poll_device['sysDescr']);
list(,$features) = explode("-", $features);
$poll_device['sysDescr'] = str_replace(', Inc.', '', $poll_device['sysDescr']);
// Make the two formats the same
$poll_device['sysDescr'] = str_replace("\n", ' ', $poll_device['sysDescr']);
?>
list(,,$hardware,,,,,,,$version,,,$features) = explode(' ', $poll_device['sysDescr']);
list(,$features) = explode('-', $features);
+30 -35
View File
@@ -1,48 +1,43 @@
<?php
if (preg_match('/^Cisco IOS Software, .+? Software(\, )?([\s\w\d]+)? \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[3];
$version = $regexp_result[4];
$hardware = $regexp_result[2];
$tmp = preg_split("/\\r\\n|\\r|\\n/",$version);
if (!empty($tmp[0])) {
$version = $tmp[0];
}
if (preg_match('/^Cisco IOS Software, .+? Software(\, )?([\s\w\d]+)? \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result)) {
$features = $regexp_result[3];
$version = $regexp_result[4];
$hardware = $regexp_result[2];
$tmp = preg_split("/\\r\\n|\\r|\\n/", $version);
if (!empty($tmp[0])) {
$version = $tmp[0];
}
}
echo("\n".$poll_device['sysDescr']."\n");
echo "\n".$poll_device['sysDescr']."\n";
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$oids = 'entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1';
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
if ($data[1]['entPhysicalContainedIn'] == "0")
{
if (!empty($data[1]['entPhysicalSoftwareRev']))
{
$version = $data[1]['entPhysicalSoftwareRev'];
}
if ($data[1]['entPhysicalContainedIn'] == '0') {
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != 'Switch System')
{
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != 'Switch System') {
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName']))
{
$hardware = $data[1]['entPhysicalModelName'];
}
if (!empty($data[1]['entPhysicalModelName'])) {
$hardware = $data[1]['entPhysicalModelName'];
}
}
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
# $ciscomodel = str_replace("\"","",$ciscomodel);
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
// if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
// if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
// if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
// $ciscomodel = str_replace("\"","",$ciscomodel);
// if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if (empty($hardware)) {
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
if(empty($hardware)) { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
// if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
$serial = get_main_serial($device);
+13 -14
View File
@@ -1,16 +1,15 @@
<?php
/*
* LibreNMS Cisco Small Business OS information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$version = snmp_get($device, "CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamSoftwareVersion.1", "-Ovq");
$hardware = str_replace(' ', '', snmp_get($device, "CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamModelName.1", "-Ovq"));
$serial = snmp_get($device, "CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamSerialNum.1", "-Ovq");
$features = snmp_get($device, "CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamServiceTag.1", "-Ovq");
?>
* LibreNMS Cisco Small Business OS information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$version = snmp_get($device, 'CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamSoftwareVersion.1', '-Ovq');
$hardware = str_replace(' ', '', snmp_get($device, 'CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamModelName.1', '-Ovq'));
$serial = snmp_get($device, 'CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamSerialNum.1', '-Ovq');
$features = snmp_get($device, 'CISCOSB-Physicaldescription-MIB::rlPhdUnitGenParamServiceTag.1', '-Ovq');
+11 -13
View File
@@ -8,26 +8,24 @@
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
*/
$oids = "entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1";
$oids = 'entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1';
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB");
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB');
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != "") {
$version = $data[1]['entPhysicalSoftwareRev'];
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') {
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != "") {
$hardware = $data[1]['entPhysicalName'];
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') {
$hardware = $data[1]['entPhysicalName'];
}
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != "") {
$hardware = $data[1]['entPhysicalModelName'];
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
$hardware = $data[1]['entPhysicalModelName'];
}
if(empty($hardware)) {
$hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB");
if (empty($hardware)) {
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
?>
+7 -10
View File
@@ -1,15 +1,12 @@
<?php
# SNMPv2-MIB::sysDescr.0 = STRING: Hangzhou H3C Comware Platform Software, Software Version 3.10, Release 2211P06
# H3C S3100-8TP-EI
# Copyright(c) 2004-2010 Hangzhou H3C Tech. Co.,Ltd. All rights reserved.
# SNMPv2-MIB::sysObjectID.0 = OID: HH3C-PRODUCT-ID-MIB::hh3c-S3100-8TP-EI
// SNMPv2-MIB::sysDescr.0 = STRING: Hangzhou H3C Comware Platform Software, Software Version 3.10, Release 2211P06
// H3C S3100-8TP-EI
// Copyright(c) 2004-2010 Hangzhou H3C Tech. Co.,Ltd. All rights reserved.
// SNMPv2-MIB::sysObjectID.0 = OID: HH3C-PRODUCT-ID-MIB::hh3c-S3100-8TP-EI
echo 'Comware OS...';
echo("Comware OS...");
$hardware = snmp_get($device, 'sysObjectID.0', '-OQsv', 'SNMPv2-MIB:HH3C-PRODUCT-ID-MIB', '+'.$config['install_dir'].'/mibs/h3c');
$hardware = snmp_get($device, "sysObjectID.0", "-OQsv", "SNMPv2-MIB:HH3C-PRODUCT-ID-MIB", "+".$config['install_dir']."/mibs/h3c");
preg_match('/Software Version (.+), Release ([a-zA-Z0-9]+)/',$poll_device['sysDescr'],$match);
preg_match('/Software Version (.+), Release ([a-zA-Z0-9]+)/', $poll_device['sysDescr'], $match);
list(,$version,$features) = $match;
?>
+4 -5
View File
@@ -1,6 +1,5 @@
<?php
$hardware = "Datacom ".str_replace("dmSwitch","DM",snmp_get($device, "swChassisModel.0", "-Ovq", "DMswitch-MIB"));
$version = snmp_get($device, "swFirmwareVer.1", "-Ovq", "DMswitch-MIB");
$features = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
$serial = snmp_get($device, "DMswitch-MIB::swSerialNumber.1", "-Ovq","DMswitch-MIB");
?>
$hardware = 'Datacom '.str_replace('dmSwitch', 'DM', snmp_get($device, 'swChassisModel.0', '-Ovq', 'DMswitch-MIB'));
$version = snmp_get($device, 'swFirmwareVer.1', '-Ovq', 'DMswitch-MIB');
$features = snmp_get($device, 'sysDescr.0', '-Oqv', 'SNMPv2-MIB');
$serial = snmp_get($device, 'DMswitch-MIB::swSerialNumber.1', '-Ovq', 'DMswitch-MIB');
+4 -6
View File
@@ -1,9 +1,7 @@
<?php
$Descr_string = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
$Descr_chopper = preg_split("/[ ]+/", "$Descr_string");
$Descr_string = snmp_get($device, 'sysDescr.0', '-Oqv', 'SNMPv2-MIB');
$Descr_chopper = preg_split('/[ ]+/', "$Descr_string");
$version = "Firmware " . $Descr_chopper[1];
$hardware = $Descr_chopper[0] . " Rev. " . str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.171.10.76.10.1.2.0", "-Oqv"));
?>
$version = 'Firmware '.$Descr_chopper[1];
$hardware = $Descr_chopper[0].' Rev. '.str_replace('"', '', snmp_get($device, '1.3.6.1.4.1.171.10.76.10.1.2.0', '-Oqv'));
+3 -5
View File
@@ -1,8 +1,6 @@
<?php
# Version is second word in sysDescr
list(,$version) = explode(" ", $device['sysDescr']);
// Version is second word in sysDescr
list(,$version) = explode(' ', $device['sysDescr']);
$features = "";
?>
$features = '';
+30 -36
View File
@@ -1,50 +1,44 @@
<?php
# Sorry about the OIDs but there doesn't seem to be a matching MIB available... :-/
if(!empty(snmp_get($device, "1.3.6.1.4.1.14125.100.1.8.0", "-OQv")))
{
$version = "Kernel " . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.8.0", "-OQv"),'" ');
$version .= " / Apps " . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.9.0", "-OQv"),'" ');
if(!empty(snmp_get($device, "1.3.6.1.4.1.14125.100.1.8.0", "-OQv"))) {
$version = "Kernel " . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.8.0", "-OQv"),'" ');
$version .= " / Apps " . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.9.0", "-OQv"),'" ');
}
else
{
$version = "Firmware " . trim(snmp_get($device, "1.3.6.1.4.1.14125.2.1.1.5.0", "-OQv"),'" ');
else {
$version = "Firmware " . trim(snmp_get($device, "1.3.6.1.4.1.14125.2.1.1.5.0", "-OQv"),'" ');
}
$serial = trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.7.0", "-OQv"),'" ');
# There doesn't seem to be a real hardware identification.. sysName will have to do?
if(!empty(snmp_get($device, "1.3.6.1.4.1.14125.100.1.6.0", "-OQv")))
{
$hardware = str_replace("EnGenius ","",snmp_get($device,"sysName.0", "-OQv")) . " v" . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.6.0", "-OQv"),'" .');
if(!empty(snmp_get($device, "1.3.6.1.4.1.14125.100.1.6.0", "-OQv"))) {
$hardware = str_replace("EnGenius ","",snmp_get($device,"sysName.0", "-OQv")) . " v" . trim(snmp_get($device, "1.3.6.1.4.1.14125.100.1.6.0", "-OQv"),'" .');
}
else
{
$hardware = snmp_get($device,"sysName.0", "-OQv") . trim(snmp_get($device, "1.3.6.1.4.1.14125.3.1.1.5.0", "-OQv"),'" .');
else {
$hardware = snmp_get($device,"sysName.0", "-OQv") . trim(snmp_get($device, "1.3.6.1.4.1.14125.3.1.1.5.0", "-OQv"),'" .');
}
$mode = snmp_get($device, "1.3.6.1.4.1.14125.100.1.4.0", "-OQv");
if(is_numeric($mode))
{
switch ($mode)
{
case 0:
$features = "Router mode";
break;
case 1:
$features = "Universal repeater mode";
break;
case 2:
$features = "Access Point mode";
break;
case 3:
$features = "Client Bridge mode";
break;
case 4:
$features = "Client router mode";
break;
case 5:
$features = "WDS Bridge mode";
break;
}
if(is_numeric($mode)) {
switch ($mode) {
case 0:
$features = "Router mode";
break;
case 1:
$features = "Universal repeater mode";
break;
case 2:
$features = "Access Point mode";
break;
case 3:
$features = "Client Bridge mode";
break;
case 4:
$features = "Client router mode";
break;
case 5:
$features = "WDS Bridge mode";
break;
}
}
?>
+2 -6
View File
@@ -1,8 +1,4 @@
<?php
# Enterasys Networks, Inc. G3G124-24P Rev 06.03.08.0012
list(,,,$hardware,,$version) = explode(" ", $device['sysDescr']);
?>
// Enterasys Networks, Inc. G3G124-24P Rev 06.03.08.0012
list(,,,$hardware,,$version) = explode(' ', $device['sysDescr']);
+1 -2
View File
@@ -1,3 +1,2 @@
<?php
$version = trim(snmp_get($device, ".1.3.6.1.4.1.3375.2.1.4.2.0", "-OQv", "", ""),'"');
?>
$version = trim(snmp_get($device, '.1.3.6.1.4.1.3375.2.1.4.2.0', '-OQv', '', ''), '"');
+3 -4
View File
@@ -1,5 +1,4 @@
<?php
$hardware = "Fiberhome ".snmp_get($device, "sysDescr.0", "-Oqv", "GEPON-OLT-COMMON-MIB");
$version = str_replace('"','',snmp_get($device, "sysHardVersion.0", "-Ovq", "GEPON-OLT-COMMON-MIB"))." - ".str_replace('"','',snmp_get($device, "sysSoftVersion.0", "-Ovq", "GEPON-OLT-COMMON-MIB"));
$features = "Olt ".snmp_get($device, "sysDescr.0", "-Oqv", "GEPON-OLT-COMMON-MIB");
?>
$hardware = 'Fiberhome '.snmp_get($device, 'sysDescr.0', '-Oqv', 'GEPON-OLT-COMMON-MIB');
$version = str_replace('"', '', snmp_get($device, 'sysHardVersion.0', '-Ovq', 'GEPON-OLT-COMMON-MIB')).' - '.str_replace('"', '', snmp_get($device, 'sysSoftVersion.0', '-Ovq', 'GEPON-OLT-COMMON-MIB'));
$features = 'Olt '.snmp_get($device, 'sysDescr.0', '-Oqv', 'GEPON-OLT-COMMON-MIB');
+27 -30
View File
@@ -1,44 +1,41 @@
<?php
$fnSysVersion = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysVersion.0", "-Ovq");
$serial = snmp_get($device, "ENTITY-MIB::entPhysicalSerialNum.1", "-Ovq");
$fnSysVersion = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysVersion.0', '-Ovq');
$serial = snmp_get($device, 'ENTITY-MIB::entPhysicalSerialNum.1', '-Ovq');
$version = preg_replace("/(.+),(.+),(.+)/", "\\1||\\2||\\3", $fnSysVersion);
list($version,$features) = explode("||", $version);
$version = preg_replace('/(.+),(.+),(.+)/', '\\1||\\2||\\3', $fnSysVersion);
list($version,$features) = explode('||', $version);
if (isset($rewrite_fortinet_hardware[$poll_device['sysObjectID']]))
{
$hardware = $rewrite_fortinet_hardware[$poll_device['sysObjectID']];
if (isset($rewrite_fortinet_hardware[$poll_device['sysObjectID']])) {
$hardware = $rewrite_fortinet_hardware[$poll_device['sysObjectID']];
}
if (empty($hardware)) {
$hardware = snmp_get($device, "ENTITY-MIB::entPhysicalModelName.1", "-Ovq");
$hardware = snmp_get($device, 'ENTITY-MIB::entPhysicalModelName.1', '-Ovq');
}
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_sessions.rrd";
$sessions = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysSesCount.0", "-Ovq");
$sessrrd = $config['rrd_dir'].'/'.$device['hostname'].'/fortigate_sessions.rrd';
$sessions = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
if (is_numeric($sessions))
{
if (!is_file($sessrrd))
{
rrdtool_create($sessrrd," --step 300 DS:sessions:GAUGE:600:0:3000000 ".$config['rrd_rra']);
}
print "Sessions: $sessions\n";
rrdtool_update($sessrrd,"N:".$sessions);
$graphs['fortigate_sessions'] = TRUE;
if (is_numeric($sessions)) {
if (!is_file($sessrrd)) {
rrdtool_create($sessrrd, ' --step 300 DS:sessions:GAUGE:600:0:3000000 '.$config['rrd_rra']);
}
print "Sessions: $sessions\n";
rrdtool_update($sessrrd, 'N:'.$sessions);
$graphs['fortigate_sessions'] = true;
}
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_cpu.rrd";
$cpu_usage=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0", "-Ovq");
$cpurrd = $config['rrd_dir'].'/'.$device['hostname'].'/fortigate_cpu.rrd';
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
if (is_numeric($cpu_usage))
{
if (!is_file($cpurrd))
{
rrdtool_create($cpurrd," --step 300 DS:LOAD:GAUGE:600:-1:100 ".$config['rrd_rra']);
}
echo("CPU: $cpu_usage%\n");
rrdtool_update($cpurrd, " N:$cpu_usage");
$graphs['fortigate_cpu'] = TRUE;
if (is_numeric($cpu_usage)) {
if (!is_file($cpurrd)) {
rrdtool_create($cpurrd, ' --step 300 DS:LOAD:GAUGE:600:-1:100 '.$config['rrd_rra']);
}
echo "CPU: $cpu_usage%\n";
rrdtool_update($cpurrd, " N:$cpu_usage");
$graphs['fortigate_cpu'] = true;
}
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
$version = trim(snmp_get($device, ".1.3.6.1.4.1.39165.1.3.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, ".1.3.6.1.4.1.39165.1.1.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, '.1.3.6.1.4.1.39165.1.3.0', '-OQv', '', ''), '"');
$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.39165.1.1.0', '-OQv', '', ''), '"');
+31 -25
View File
@@ -1,41 +1,47 @@
<?php
/*
* LibreNMS IBM NOS information module
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$sysdescr_value = snmp_get($device, "sysDescr.0", "-Ovq");
* LibreNMS IBM NOS information module
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$sysdescr_value = snmp_get($device, 'sysDescr.0', '-Ovq');
if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) {
$hardware = str_replace("IBM Networking Operating System", "", $sysdescr_value);
$hardware = str_replace('IBM Networking Operating System', '', $sysdescr_value);
if (strpos($sysdescr_value, 'G8052') !== false) {
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.4.1.26543.100.100.14.9.0", "-Ovq") , '" ');
$version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.4.1.26543.100.100.14.9.0', '-Ovq'), '" ');
}
if (strpos($sysdescr_value, 'G8316') !== false) {
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.4.1.20301.100.100.14.9.0", "-Ovq") , '" ');
$version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
}
if (strpos($sysdescr_value, 'G8264CS') !== false) {
$version = trim(snmp_get($device, ".1.3.6.1.4.1.20301.2.7.15.1.1.1.10.0", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.4.1.20301.100.100.14.9.0", "-Ovq") , '" ');
$version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.15.1.1.1.10.0', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
}
if (strpos($sysdescr_value, 'G8264-T') !== false) {
$version = trim(snmp_get($device, ".1.3.6.1.4.1.20301.2.7.13.1.1.1.10.0", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.4.1.20301.100.100.14.9.0", "-Ovq") , '" ');
$version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.13.1.1.1.10.0', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
}
if (empty($version)) {
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
$version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
}
if (empty($serial)) {
$serial = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq") , '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" ');
}
} elseif (strpos($sysdescr_value, 'IBM Flex System Fabric') !== false) {
$hardware = str_replace("IBM Flex System Fabric", "", $sysdescr_value);
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq") , '" ');
}
else if (strpos($sysdescr_value, 'IBM Flex System Fabric') !== false) {
$hardware = str_replace('IBM Flex System Fabric', '', $sysdescr_value);
$version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" ');
}//end if
+36 -45
View File
@@ -1,52 +1,43 @@
<?php
# 7200 and IOS-XE (ASR1k)
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
// 7200 and IOS-XE (ASR1k)
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result)) {
$features = $regexp_result[1];
$version = $regexp_result[2];
}
else if (preg_match('/Cisco Internetwork Operating System Software\s+IOS \(tm\) [^ ]+ Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result)) {
$features = $regexp_result[1];
$version = $regexp_result[2];
} // If we have not managed to match any IOS string yet (and that would be surprising)
// we can try to poll the Entity Mib to see what's inside
else {
$oids = 'entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1';
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
if ($data[1]['entPhysicalContainedIn'] == '0') {
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName'])) {
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName'])) {
$hardware = $data[1]['entPhysicalModelName'];
}
}
}
# 7600
elseif (preg_match('/Cisco Internetwork Operating System Software\s+IOS \(tm\) [^ ]+ Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
// if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
// if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
// if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
// $ciscomodel = str_replace("\"","",$ciscomodel);
// if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if (empty($hardware)) {
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB');
}
# If we have not managed to match any IOS string yet (and that would be surprising)
# we can try to poll the Entity Mib to see what's inside
else
{
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0")
{
if (!empty($data[1]['entPhysicalSoftwareRev']))
{
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName']))
{
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName']))
{
$hardware = $data[1]['entPhysicalModelName'];
}
}
}
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
# $ciscomodel = str_replace("\"","",$ciscomodel);
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if(empty($hardware)) { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
// if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
$serial = get_main_serial($device);
+7 -10
View File
@@ -1,17 +1,14 @@
<?php
if (preg_match('/^Cisco IOS XR Software \(Cisco ([^\)]+)\),\s+Version ([^\[]+)\[([^\]]+)\]/', $poll_device['sysDescr'], $regexp_result))
{
$hardware = $regexp_result[1];
$features = $regexp_result[3];
$version = $regexp_result[2];
if (preg_match('/^Cisco IOS XR Software \(Cisco ([^\)]+)\),\s+Version ([^\[]+)\[([^\]]+)\]/', $poll_device['sysDescr'], $regexp_result)) {
$hardware = $regexp_result[1];
$features = $regexp_result[3];
$version = $regexp_result[2];
}
else
{
# It is not an IOS-XR ... What should we do ?
else {
// It is not an IOS-XR ... What should we do ?
}
$serial = get_main_serial($device);
echo("\n".$poll_device['sysDescr']."\n");
echo "\n".$poll_device['sysDescr']."\n";
+2 -2
View File
@@ -8,8 +8,8 @@
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
*/
if (empty($hardware)) {
$hardware = snmp_get($device, "sysDescr.0", "-Osqv", "SNMPv2-MIB");
$hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB');
}
+2 -2
View File
@@ -8,8 +8,8 @@
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
*/
if (empty($hardware)) {
$hardware = snmp_get($device, "sysDescr.0", "-Osqv", "SNMPv2-MIB");
$hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB');
}
+2 -2
View File
@@ -8,8 +8,8 @@
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
*/
if (empty($hardware)) {
$hardware = snmp_get($device, "sysDescr.0", "-Osqv", "SNMPv2-MIB");
$hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB');
}
+2 -2
View File
@@ -1,5 +1,5 @@
<?php
$hardware = snmp_get($device, "upsIdentModel.0", "-OQv", "UPS-MIB");
$version = snmp_get($device, "upsIdentAgentSoftwareVersion.0", "-OQv", "UPS-MIB");
$hardware = snmp_get($device, 'upsIdentModel.0', '-OQv', 'UPS-MIB');
$version = snmp_get($device, 'upsIdentAgentSoftwareVersion.0', '-OQv', 'UPS-MIB');
+4 -4
View File
@@ -1,6 +1,6 @@
<?php
$serial = snmp_get($device, "productSerialNum.0", "-Ovq", "NETAPP-MIB");
$hardware = snmp_get($device, "productModel.0", "-Ovq", "NETAPP-MIB");
list($version,) = split(":", snmp_get($device, "productVersion.0", "-Ovq", "NETAPP-MIB"));
$version = str_replace("NetApp Release ", "", $version);
$serial = snmp_get($device, 'productSerialNum.0', '-Ovq', 'NETAPP-MIB');
$hardware = snmp_get($device, 'productModel.0', '-Ovq', 'NETAPP-MIB');
list($version,) = split(':', snmp_get($device, 'productVersion.0', '-Ovq', 'NETAPP-MIB'));
$version = str_replace('NetApp Release ', '', $version);
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
// sysDescr.0 = XS712T ProSafe 12-Port 10 Gigabit Ethernet (10GbE) Smart Switch, 6.1.0.12, B6.1.0.1
list($hardware, ) = explode(" ", $poll_device['sysDescr']);
list(,$version, ) = explode(",", $poll_device['sysDescr']);
list($hardware, ) = explode(' ', $poll_device['sysDescr']);
list(,$version, ) = explode(',', $poll_device['sysDescr']);
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
//SNMPv2-MIB::sysDescr.0 Brocade VDX Switch.
if (preg_match("/Brocade ([\s\d\w]+)/", $poll_device['sysDescr'], $hardware)) {
// SNMPv2-MIB::sysDescr.0 Brocade VDX Switch.
if (preg_match('/Brocade ([\s\d\w]+)/', $poll_device['sysDescr'], $hardware)) {
$hardware = $hardware[1];
}
+4 -6
View File
@@ -13,20 +13,18 @@
*/
$oids = "entPhysicalSoftwareRev.22 entPhysicalName.149 entPhysicalSerialNum.10";
$oids = 'entPhysicalSoftwareRev.22 entPhysicalName.149 entPhysicalSerialNum.10';
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB");
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB');
if (isset($data[22]['entPhysicalSoftwareRev']) && !empty($data[1]['entPhysicalSoftwareRev'])) {
$version = $data[22]['entPhysicalSoftwareRev'];
$version = $data[22]['entPhysicalSoftwareRev'];
}
if (isset($data[149]['entPhysicalName']) && !empty($data[149]['entPhysicalName'])) {
$hardware = str_replace(" Chassis", "", $data[149]['entPhysicalName']);
$hardware = str_replace(' Chassis', '', $data[149]['entPhysicalName']);
}
if (isset($data[10]) && !empty($data[10]['entPhysicalSerialNum'])) {
$serial = $data[10]['entPhysicalSerialNum'];
}
?>
+10 -11
View File
@@ -1,15 +1,14 @@
<?php
if (preg_match('/^Pacific Broadband Networks .+\n.+ Version ([^,]+), .+\n.+\n.+\nSerial num:([^,]+), .+/', $poll_device['sysDescr'], $regexp_result)) {
$version = $regexp_result[1];
$serial = $regexp_result[2];
# for PBN CPE 120/121
} elseif (strstr(snmp_get($device, "SNMPv2-MIB::sysObjectID.0", "-Ovqn"), ".1.3.6.1.4.1.11606.24.1.1.10")) {
$version = snmp_get($device, "1.3.6.1.4.1.11606.24.1.1.6.0", "-Ovq");
$hardware = snmp_get($device, "1.3.6.1.4.1.11606.24.1.1.7.0", "-Ovq");
$features = snmp_get($device, "1.3.6.1.4.1.11606.24.1.1.10.0", "-Ovq");
$serial = snmp_get($device, "1.3.6.1.4.1.11606.24.1.1.4.0", "-Ovq");
}
$version = $regexp_result[1];
$serial = $regexp_result[2];
?>
// for PBN CPE 120/121
}
else if (strstr(snmp_get($device, 'SNMPv2-MIB::sysObjectID.0', '-Ovqn'), '.1.3.6.1.4.1.11606.24.1.1.10')) {
$version = snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.6.0', '-Ovq');
$hardware = snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.7.0', '-Ovq');
$features = snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.10.0', '-Ovq');
$serial = snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.4.0', '-Ovq');
}
+2 -2
View File
@@ -12,5 +12,5 @@
* the source code distribution for details.
*/
$version = "Powercode";
$hardware = "BMU";
$version = 'Powercode';
$hardware = 'BMU';
+3 -3
View File
@@ -12,7 +12,7 @@
* the source code distribution for details.
*/
if (stristr($poll_device['sysObjectID'], "packetlogic") || strstr($poll_device['sysObjectID'], "enterprises.15397.2") || strstr($poll_device['sysObjectID'], ".1.3.6.1.4.1.15397.2")) {
$version = "PacketLogic";
$hardware = "PacketLogic";
if (stristr($poll_device['sysObjectID'], 'packetlogic') || strstr($poll_device['sysObjectID'], 'enterprises.15397.2') || strstr($poll_device['sysObjectID'], '.1.3.6.1.4.1.15397.2')) {
$version = 'PacketLogic';
$hardware = 'PacketLogic';
}
+39 -31
View File
@@ -1,44 +1,52 @@
<?php
list($hardware, $version, ) = explode(",", str_replace(", ", ",", $poll_device['sysDescr']));
list($hardware, $version, ) = explode(',', str_replace(', ', ',', $poll_device['sysDescr']));
# 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); }
$altversion = trim(snmp_get($device,"hpSwitchOsVersion.0", "-Oqv", "NETSWITCH-MIB"),'"');
if ($altversion) { $version = $altversion; }
$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; }
if (preg_match('/^PROCURVE (.*) - (.*)/', $poll_device['sysDescr'], $regexp_result))
{
$hardware = "ProCurve " . $regexp_result[1];
$version = $regexp_result[2];
// Clean up hardware
$hardware = str_replace('PROCURVE', 'ProCurve', $hardware);
if (substr($hardware, 0, 3) == 'HP ') {
$hardware = substr($hardware, 3);
}
$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));
if (substr($hardware, 0, 24) == 'Hewlett-Packard Company ') {
$hardware = substr($hardware, 24);
}
$altversion = trim(snmp_get($device, 'hpSwitchOsVersion.0', '-Oqv', 'NETSWITCH-MIB'), '"');
if ($altversion) {
$version = $altversion;
}
$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;
}
if (preg_match('/^PROCURVE (.*) - (.*)/', $poll_device['sysDescr'], $regexp_result)) {
$hardware = 'ProCurve '.$regexp_result[1];
$version = $regexp_result[2];
}
$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));
// FIXME maybe genericise? or do away with it if we ever walk the full dot1qTpFdbTable as we can count ourselves then ;)
$fdb_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/fdb_count.rrd";
$fdb_rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/fdb_count.rrd';
$FdbAddressCount = snmp_get ($device, "hpSwitchFdbAddressCount.0", "-Ovqn", "STATISTICS-MIB");
$FdbAddressCount = snmp_get($device, 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB');
if (is_numeric($FdbAddressCount))
{
if (!is_file($fdb_rrd_file))
{
rrdtool_create($fdb_rrd_file, " --step 300 \
DS:value:GAUGE:600:-1:100000 ".$config['rrd_rra']); }
if (is_numeric($FdbAddressCount)) {
if (!is_file($fdb_rrd_file)) {
rrdtool_create(
$fdb_rrd_file,
' --step 300 \
DS:value:GAUGE:600:-1:100000 '.$config['rrd_rra']
);
}
rrdtool_update($fdb_rrd_file, "N:$FdbAddressCount");
rrdtool_update($fdb_rrd_file, "N:$FdbAddressCount");
$graphs['fdb_count'] = TRUE;
$graphs['fdb_count'] = true;
echo("FDB Count ");
echo 'FDB Count ';
}
?>
+5 -4
View File
@@ -1,7 +1,8 @@
<?php
$version = trim(snmp_get($device, "1.3.6.1.4.1.14988.1.1.4.4.0", "-OQv", "", ""),'"');
if( strstr($poll_device['sysDescr'], "RouterOS")) { $hardware = substr($poll_device['sysDescr'], 9); }
$features = "Level " . trim(snmp_get($device, "1.3.6.1.4.1.14988.1.1.4.3.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, '1.3.6.1.4.1.14988.1.1.4.4.0', '-OQv', '', ''), '"');
if (strstr($poll_device['sysDescr'], 'RouterOS')) {
$hardware = substr($poll_device['sysDescr'], 9);
}
?>
$features = 'Level '.trim(snmp_get($device, '1.3.6.1.4.1.14988.1.1.4.3.0', '-OQv', '', ''), '"');
+31 -31
View File
@@ -1,52 +1,52 @@
<?php
/*
* LibreNMS Ruckus Wireless OS information module
*
* Originally by:
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
*
* Updates by Paul Gear:
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
*
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
* LibreNMS Ruckus Wireless OS information module
*
* Originally by:
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
*
* Updates by Paul Gear:
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
*
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$productmib = trim(snmp_get($device, ".1.3.6.1.2.1.1.2.0", "-Oqv"), '" ');
$productmib = trim(snmp_get($device, '.1.3.6.1.2.1.1.2.0', '-Oqv'), '" ');
$ruckusmodels = array(
$ruckusmodels = array(
"$productmib.5.0",
".1.3.6.1.4.1.25053.1.2.1.1.1.1.9.0",
".1.3.6.1.4.1.25053.1.1.2.1.1.1.1.0",
".1.3.6.1.2.1.1.1.0",
'.1.3.6.1.4.1.25053.1.2.1.1.1.1.9.0',
'.1.3.6.1.4.1.25053.1.1.2.1.1.1.1.0',
'.1.3.6.1.2.1.1.1.0',
);
$ruckusversions = array(
$ruckusversions = array(
"$productmib.8.0",
".1.3.6.1.4.1.25053.1.1.3.1.1.1.1.1.3.1",
'.1.3.6.1.4.1.25053.1.1.3.1.1.1.1.1.3.1',
);
$ruckusserials = array(
$ruckusserials = array(
"$productmib.7.0",
".1.3.6.1.4.1.25053.1.1.2.1.1.1.2.0"
'.1.3.6.1.4.1.25053.1.1.2.1.1.1.2.0',
);
$ruckuscountries = array(
"$productmib.9.0",
".1.3.6.1.4.1.25053.1.2.1.1.1.1.20"
'.1.3.6.1.4.1.25053.1.2.1.1.1.1.20',
);
$hardware = first_oid_match($device, $ruckusmodels);
$version = first_oid_match($device, $ruckusversions);
$serial = first_oid_match($device, $ruckusserials);
$hardware = first_oid_match($device, $ruckusmodels);
$version = first_oid_match($device, $ruckusversions);
$serial = first_oid_match($device, $ruckusserials);
$ruckuscountry = first_oid_match($device, $ruckuscountries);
if (isset($ruckuscountry) && $ruckuscountry != "") {
if (isset($ruckuscountry) && $ruckuscountry != '') {
$version .= " ($ruckuscountry)";
}
$ruckus_mibs = array(
"ruckusZDSystemStats" => "RUCKUS-ZD-SYSTEM-MIB",
"ruckusZDWLANTable" => "RUCKUS-ZD-WLAN-MIB",
"ruckusZDWLANAPTable" => "RUCKUS-ZD-WLAN-MIB",
'ruckusZDSystemStats' => 'RUCKUS-ZD-SYSTEM-MIB',
'ruckusZDWLANTable' => 'RUCKUS-ZD-WLAN-MIB',
'ruckusZDWLANAPTable' => 'RUCKUS-ZD-WLAN-MIB',
);
poll_mibs($ruckus_mibs, $device, $graphs);
+14 -14
View File
@@ -1,24 +1,24 @@
<?php
$version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "\\1||\\2||\\3||\\4", $poll_device['sysDescr']);
list($hardware,$version,$serial,$features) = explode("||", $version);
$version = preg_replace('/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/', '\\1||\\2||\\3||\\4', $poll_device['sysDescr']);
list($hardware,$version,$serial,$features) = explode('||', $version);
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos_sessions.rrd";
$sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv " . snmp_gen_auth($device) . " " . $device['hostname'];
$sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0";
$sessrrd = $config['rrd_dir'].'/'.$device['hostname'].'/screenos_sessions.rrd';
$sess_cmd = $config['snmpget'].' -M '.$config['mibdir'].' -O qv '.snmp_gen_auth($device).' '.$device['hostname'];
$sess_cmd .= ' .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0';
$sess_data = shell_exec($sess_cmd);
list ($sessalloc, $sessmax, $sessfailed) = explode("\n", $sess_data);
if (!is_file($sessrrd))
{
rrdtool_create($sessrrd, " --step 300 \
DS:allocate:GAUGE:600:0:3000000 \
DS:max:GAUGE:600:0:3000000 \
DS:failed:GAUGE:600:0:1000 ".$config['rrd_rra']);
if (!is_file($sessrrd)) {
rrdtool_create(
$sessrrd,
' --step 300 \
DS:allocate:GAUGE:600:0:3000000 \
DS:max:GAUGE:600:0:3000000 \
DS:failed:GAUGE:600:0:1000 '.$config['rrd_rra']
);
}
rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed");
$graphs['screenos_sessions'] = TRUE;
?>
$graphs['screenos_sessions'] = true;
+1 -1
View File
@@ -12,5 +12,5 @@
* the source code distribution for details.
*/
$version = snmp_get($device, "rbSwBank1Version.0", "-Osqnv", "+RADIO-BRIDGE-MIB");
$version = snmp_get($device, 'rbSwBank1Version.0', '-Osqnv', '+RADIO-BRIDGE-MIB');
$hardware = $poll_device['sysDescr'];
+25 -28
View File
@@ -1,43 +1,40 @@
<?php
echo("Polling SNOM device...\n");
echo "Polling SNOM device...\n";
// Get SNOM specific version string from silly SNOM location. Silly SNOM!
// FIXME - This needs a good cleanup...
$cmd = "snmpget -O qv " . snmp_gen_auth($device) . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.2.1.7526.2.4";
$poll_device['sysDescr'] = `$cmd`;
$poll_device['sysDescr'] = str_replace("-", " ", $poll_device['sysDescr']);
$poll_device['sysDescr'] = str_replace("\"", "", $poll_device['sysDescr']);
list($hardware, $features, $version) = explode(" ", $poll_device['sysDescr']);
$cmd = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.4';
$poll_device['sysDescr'] = `$cmd`;
$poll_device['sysDescr'] = str_replace('-', ' ', $poll_device['sysDescr']);
$poll_device['sysDescr'] = str_replace('"', '', $poll_device['sysDescr']);
list($hardware, $features, $version) = explode(' ', $poll_device['sysDescr']);
// Get data for calls and network from SNOM specific SNMP OIDs.
$cmda = "snmpget -O qv " . snmp_gen_auth($device) . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2";
$cmdb = "snmpget -O qv " . snmp_gen_auth($device) . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6";
#echo($cmda);
$snmpdata = `$cmda`;
$cmda = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2';
$cmdb = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6';
// echo($cmda);
$snmpdata = `$cmda`;
$snmpdatab = `$cmdb`;
list($rxbytes, $rxpkts, $txbytes, $txpkts) = explode("\n", $snmpdata);
list($calls, $registrations) = explode("\n", $snmpdatab);
$txbytes = 0 - $txbytes * 8;
$rxbytes = 0 - $rxbytes * 8;
echo("$rxbytes, $rxpkts, $txbytes, $txpkts, $calls, $registrations");
list($calls, $registrations) = explode("\n", $snmpdatab);
$txbytes = (0 - $txbytes * 8);
$rxbytes = (0 - $rxbytes * 8);
echo "$rxbytes, $rxpkts, $txbytes, $txpkts, $calls, $registrations";
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/data.rrd";
if (!is_file($rrdfile))
{
rrdtool_create($rrdfile,"DS:INOCTETS:COUNTER:600:U:100000000000 \
DS:OUTOCTETS:COUNTER:600:U:10000000000 \
DS:INPKTS:COUNTER:600:U:10000000000 \
DS:OUTPKTS:COUNTER:600:U:10000000000 \
DS:CALLS:COUNTER:600:U:10000000000 \
DS:REGISTRATIONS:COUNTER:600:U:10000000000 ".$config['rrd_rra']);
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/data.rrd';
if (!is_file($rrdfile)) {
rrdtool_create(
$rrdfile,
'DS:INOCTETS:COUNTER:600:U:100000000000 \
DS:OUTOCTETS:COUNTER:600:U:10000000000 \
DS:INPKTS:COUNTER:600:U:10000000000 \
DS:OUTPKTS:COUNTER:600:U:10000000000 \
DS:CALLS:COUNTER:600:U:10000000000 \
DS:REGISTRATIONS:COUNTER:600:U:10000000000 '.$config['rrd_rra']
);
}
$rrdupdate = "N:$rxbytes:$txbytes:$rxpkts:$rxbytes:$calls:$registrations";
rrdtool_update("$rrdfile", $rrdupdate);
?>
+10 -7
View File
@@ -1,24 +1,27 @@
<?php
$data = snmp_get_multi($device, "dot11manufacturerProductName.2 dot11manufacturerProductVersion.2", "-OQUs", "IEEE802dot11-MIB");
$data = snmp_get_multi($device, 'dot11manufacturerProductName.2 dot11manufacturerProductVersion.2', '-OQUs', 'IEEE802dot11-MIB');
if (empty($data)) {
$data = snmp_get_multi($device, "dot11manufacturerProductName.3 dot11manufacturerProductVersion.3", "-OQUs", "IEEE802dot11-MIB");
$data = snmp_get_multi($device, 'dot11manufacturerProductName.3 dot11manufacturerProductVersion.3', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, "dot11manufacturerProductName.4 dot11manufacturerProductVersion.4", "-OQUs", "IEEE802dot11-MIB");
$data = snmp_get_multi($device, 'dot11manufacturerProductName.4 dot11manufacturerProductVersion.4', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, "dot11manufacturerProductName.5 dot11manufacturerProductVersion.5", "-OQUs", "IEEE802dot11-MIB");
$data = snmp_get_multi($device, 'dot11manufacturerProductName.5 dot11manufacturerProductVersion.5', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, "dot11manufacturerProductName.6 dot11manufacturerProductVersion.6", "-OQUs", "IEEE802dot11-MIB");
$data = snmp_get_multi($device, 'dot11manufacturerProductName.6 dot11manufacturerProductVersion.6', '-OQUs', 'IEEE802dot11-MIB');
}
foreach ($data as $line) {
if (!empty($line['dot11manufacturerProductName'])) {
$hardware = $line['dot11manufacturerProductName'];
}
if (preg_match("/(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $line['dot11manufacturerProductVersion'],$matches)) {
if (preg_match('/(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $line['dot11manufacturerProductVersion'], $matches)) {
$version = $matches[0];
}
}
+110 -97
View File
@@ -1,113 +1,126 @@
<?php
if ($device['os'] == "linux" || $device['os'] == "endian")
{
list(,,$version) = explode (" ", $poll_device['sysDescr']);
if (strstr($poll_device['sysDescr'], "386")|| strstr($poll_device['sysDescr'], "486")||strstr($poll_device['sysDescr'], "586")||strstr($poll_device['sysDescr'], "686")) { $hardware = "Generic x86"; }
else if (strstr($poll_device['sysDescr'], "x86_64")) { $hardware = "Generic x86 64-bit"; }
else if (strstr($poll_device['sysDescr'], "sparc32")) { $hardware = "Generic SPARC 32-bit"; }
else if (strstr($poll_device['sysDescr'], "sparc64")) { $hardware = "Generic SPARC 64-bit"; }
else if (strstr($poll_device['sysDescr'], "mips")) { $hardware = "Generic MIPS"; }
else if (strstr($poll_device['sysDescr'], "armv5")) { $hardware = "Generic ARMv5"; }
else if (strstr($poll_device['sysDescr'], "armv6")) { $hardware = "Generic ARMv6"; }
else if (strstr($poll_device['sysDescr'], "armv7")) { $hardware = "Generic ARMv7"; }
else if (strstr($poll_device['sysDescr'], "armv")) { $hardware = "Generic ARM"; }
if ($device['os'] == "linux" || $device['os'] == "endian") {
list(,,$version) = explode (" ", $poll_device['sysDescr']);
if (strstr($poll_device['sysDescr'], "386")|| strstr($poll_device['sysDescr'], "486")||strstr($poll_device['sysDescr'], "586")||strstr($poll_device['sysDescr'], "686")) {
$hardware = "Generic x86";
}
else if (strstr($poll_device['sysDescr'], "x86_64")) {
$hardware = "Generic x86 64-bit";
}
else if (strstr($poll_device['sysDescr'], "sparc32")) {
$hardware = "Generic SPARC 32-bit";
}
else if (strstr($poll_device['sysDescr'], "sparc64")) {
$hardware = "Generic SPARC 64-bit";
}
else if (strstr($poll_device['sysDescr'], "mips")) {
$hardware = "Generic MIPS";
}
else if (strstr($poll_device['sysDescr'], "armv5")) {
$hardware = "Generic ARMv5";
}
else if (strstr($poll_device['sysDescr'], "armv6")) {
$hardware = "Generic ARMv6";
}
else if (strstr($poll_device['sysDescr'], "armv7")) {
$hardware = "Generic ARMv7";
}
else if (strstr($poll_device['sysDescr'], "armv")) {
$hardware = "Generic ARM";
}
# Distro "extend" support
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111", "-Oqv", "UCD-SNMP-MIB");
$features = str_replace("\"", "", $features);
if (!$features) # No "extend" support, try "exec" support
{
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB");
# Distro "extend" support
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111", "-Oqv", "UCD-SNMP-MIB");
$features = str_replace("\"", "", $features);
}
# Detect Dell hardware via OpenManage SNMP
$hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892");
$hw = trim(str_replace("\"", "", $hw));
if ($hw) { $hardware = "Dell " . $hw; }
$serial = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.11.1", "-Oqv", "MIB-Dell-10892");
$serial = trim(str_replace("\"", "", $serial));
# Use agent DMI data if available
if (isset($agent_data['dmi']))
{
if ($agent_data['dmi']['system-product-name'])
{
$hardware = ($agent_data['dmi']['system-manufacturer'] ? $agent_data['dmi']['system-manufacturer'] . ' ' : '') . $agent_data['dmi']['system-product-name'];
# Clean up "Dell Computer Corporation" and "Intel Corporation"
$hardware = str_replace(" Computer Corporation","",$hardware);
$hardware = str_replace(" Corporation","",$hardware);
if (!$features) { # No "extend" support, try "exec" support
$features = snmp_get($device, ".1.3.6.1.4.1.2021.7890.1.101.1", "-Oqv", "UCD-SNMP-MIB");
$features = str_replace("\"", "", $features);
}
if ($agent_data['dmi']['system-serial-number'])
{
$serial = $agent_data['dmi']['system-serial-number'];
# Detect Dell hardware via OpenManage SNMP
$hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892");
$hw = trim(str_replace("\"", "", $hw));
if ($hw) {
$hardware = "Dell " . $hw;
}
}
}
elseif ($device['os'] == "freebsd")
{
$poll_device['sysDescr'] = str_replace(" 0 ", " ", $poll_device['sysDescr']);
list(,,$version) = explode (" ", $poll_device['sysDescr']);
if (strstr($poll_device['sysDescr'], "i386")) { $hardware = "i386"; }
else if (strstr($poll_device['sysDescr'], "amd64")) { $hardware = "amd64"; }
else { $hardware = "i386"; }
$features = "GENERIC";
}
elseif ($device['os'] == "dragonfly")
{
list(,,$version,,,$features,,$hardware) = explode (" ", $poll_device['sysDescr']);
}
elseif ($device['os'] == "netbsd")
{
list(,,$version,,,$features) = explode (" ", $poll_device['sysDescr']);
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
list(,,$hardware) = explode ("$features", $poll_device['sysDescr']);
}
elseif ($device['os'] == "openbsd" || $device['os'] == "solaris" || $device['os'] == "opensolaris")
{
list(,,$version,$features,$hardware) = explode (" ", $poll_device['sysDescr']);
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
}
elseif ($device['os'] == "monowall" || $device['os'] == "Voswall")
{
list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = explode(" ", $poll_device['sysDescr']);
$features = $freebsda . " " . $freebsdb;
$hardware = "$hardware ($arch)";
$hardware = str_replace("\"", "", $hardware);
}
elseif ($device['os'] == "qnap")
{
$hardware = snmp_get($device, "ENTITY-MIB::entPhysicalName.1", "-Osqnv");
$version = snmp_get($device, "ENTITY-MIB::entPhysicalFirmwareRev.1", "-Osqnv");
$serial = snmp_get($device, "ENTITY-MIB::entPhysicalSerial.1", "-Osqnv");
}
elseif ($device['os'] == "dsm")
{
# This only gets us the build, not the actual version number, so won't use this.. yet.
# list(,,,$version,) = explode(" ",$poll_device['sysDescr'],5);
# $version = "Build " . trim($version,'#');
$serial = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.11.1", "-Oqv", "MIB-Dell-10892");
$serial = trim(str_replace("\"", "", $serial));
$hrSystemInitialLoadParameters = trim(snmp_get($device, "hrSystemInitialLoadParameters.0", "-Osqnv"));
# Use agent DMI data if available
if (isset($agent_data['dmi'])) {
if ($agent_data['dmi']['system-product-name']) {
$hardware = ($agent_data['dmi']['system-manufacturer'] ? $agent_data['dmi']['system-manufacturer'] . ' ' : '') . $agent_data['dmi']['system-product-name'];
$options = explode(" ",$hrSystemInitialLoadParameters);
# Clean up "Dell Computer Corporation" and "Intel Corporation"
$hardware = str_replace(" Computer Corporation","",$hardware);
$hardware = str_replace(" Corporation","",$hardware);
}
foreach ($options as $option)
{
list($key,$value) = explode("=",$option,2);
if ($key == "syno_hw_version")
{
$hardware = $value;
if ($agent_data['dmi']['system-serial-number']) {
$serial = $agent_data['dmi']['system-serial-number'];
}
}
}
} elseif ($device['os'] == "pfsense") {
}
elseif ($device['os'] == "freebsd") {
$poll_device['sysDescr'] = str_replace(" 0 ", " ", $poll_device['sysDescr']);
list(,,$version) = explode (" ", $poll_device['sysDescr']);
if (strstr($poll_device['sysDescr'], "i386")) {
$hardware = "i386";
}
else if (strstr($poll_device['sysDescr'], "amd64")) {
$hardware = "amd64";
}
else {
$hardware = "i386";
}
$features = "GENERIC";
}
elseif ($device['os'] == "dragonfly") {
list(,,$version,,,$features,,$hardware) = explode (" ", $poll_device['sysDescr']);
}
elseif ($device['os'] == "netbsd") {
list(,,$version,,,$features) = explode (" ", $poll_device['sysDescr']);
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
list(,,$hardware) = explode ("$features", $poll_device['sysDescr']);
}
elseif ($device['os'] == "openbsd" || $device['os'] == "solaris" || $device['os'] == "opensolaris") {
list(,,$version,$features,$hardware) = explode (" ", $poll_device['sysDescr']);
$features = str_replace("(", "", $features);
$features = str_replace(")", "", $features);
}
elseif ($device['os'] == "monowall" || $device['os'] == "Voswall") {
list(,,$version,$hardware,$freebsda, $freebsdb, $arch) = explode(" ", $poll_device['sysDescr']);
$features = $freebsda . " " . $freebsdb;
$hardware = "$hardware ($arch)";
$hardware = str_replace("\"", "", $hardware);
}
elseif ($device['os'] == "qnap") {
$hardware = snmp_get($device, "ENTITY-MIB::entPhysicalName.1", "-Osqnv");
$version = snmp_get($device, "ENTITY-MIB::entPhysicalFirmwareRev.1", "-Osqnv");
$serial = snmp_get($device, "ENTITY-MIB::entPhysicalSerial.1", "-Osqnv");
}
elseif ($device['os'] == "dsm") {
# This only gets us the build, not the actual version number, so won't use this.. yet.
# list(,,,$version,) = explode(" ",$poll_device['sysDescr'],5);
# $version = "Build " . trim($version,'#');
$hrSystemInitialLoadParameters = trim(snmp_get($device, "hrSystemInitialLoadParameters.0", "-Osqnv"));
$options = explode(" ",$hrSystemInitialLoadParameters);
foreach ($options as $option) {
list($key,$value) = explode("=",$option,2);
if ($key == "syno_hw_version") {
$hardware = $value;
}
}
}
elseif ($device['os'] == "pfsense") {
$output = preg_split("/ /", $poll_device['sysDescr']);
$version = $output[2];
$hardware = $output[6];
+56 -64
View File
@@ -11,88 +11,80 @@
* features: build-348481
*/
$data = snmp_get_multi($device, "VMWARE-SYSTEM-MIB::vmwProdName.0 VMWARE-SYSTEM-MIB::vmwProdVersion.0 VMWARE-SYSTEM-MIB::vmwProdBuild.0", "-OQUs", "+VMWARE-ROOT-MIB:VMWARE-SYSTEM-MIB:VMWARE-VMINFO-MIB", "+" . $config['install_dir'] . "/mibs/vmware:".$config['mibdir']);
$version = preg_replace("/^VMware /", "", $data[0]["vmwProdName"]) . " " . $data[0]["vmwProdVersion"];
$features = "build-" . $data[0]["vmwProdBuild"];
$hardware = snmp_get($device, "entPhysicalDescr.1", "-OsvQU", "ENTITY-MIB");
$serial = snmp_get($device, "entPhysicalSerialNum.1", "-OsvQU", "ENTITY-MIB");
$data = snmp_get_multi($device, 'VMWARE-SYSTEM-MIB::vmwProdName.0 VMWARE-SYSTEM-MIB::vmwProdVersion.0 VMWARE-SYSTEM-MIB::vmwProdBuild.0', '-OQUs', '+VMWARE-ROOT-MIB:VMWARE-SYSTEM-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
$version = preg_replace('/^VMware /', '', $data[0]['vmwProdName']).' '.$data[0]['vmwProdVersion'];
$features = 'build-'.$data[0]['vmwProdBuild'];
$hardware = snmp_get($device, 'entPhysicalDescr.1', '-OsvQU', 'ENTITY-MIB');
$serial = snmp_get($device, 'entPhysicalSerialNum.1', '-OsvQU', 'ENTITY-MIB');
/*
* CONSOLE: Start the VMware discovery process.
*/
echo("VMware VM: ");
echo 'VMware VM: ';
/*
* Get a list of all the known Virtual Machines for this host.
*/
$db_info_list = dbFetchRows("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vminfo WHERE device_id = ?", array($device["device_id"]));
$db_info_list = dbFetchRows('SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vminfo WHERE device_id = ?', array($device['device_id']));
foreach ($db_info_list as $db_info)
{
/*
* Fetch the Virtual Machine information.
*
* VMWARE-VMINFO-MIB::vmwVmDisplayName.224 = STRING: My First VM
* VMWARE-VMINFO-MIB::vmwVmGuestOS.224 = STRING: windows7Server64Guest
* VMWARE-VMINFO-MIB::vmwVmMemSize.224 = INTEGER: 8192 megabytes
* VMWARE-VMINFO-MIB::vmwVmState.224 = STRING: poweredOn
* VMWARE-VMINFO-MIB::vmwVmVMID.224 = INTEGER: 224
* VMWARE-VMINFO-MIB::vmwVmCpus.224 = INTEGER: 2
*/
$vm_info = array();
$vm_info["vmwVmDisplayName"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmDisplayName." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:".$config['mibdir']);
$vm_info["vmwVmGuestOS"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmGuestOS." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:".$config['mibdir']);
$vm_info["vmwVmMemSize"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmMemSize." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:".$config['mibdir']);
$vm_info["vmwVmState"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmState." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:".$config['mibdir']);
$vm_info["vmwVmCpus"] = snmp_get($device, "VMWARE-VMINFO-MIB::vmwVmCpus." . $db_info["vmwVmVMID"], "-Osqnv", "+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB", "+" . $config["install_dir"] . "/mibs/vmware:".$config['mibdir']);
/*
* VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
* might be resolved by VMware in the future making this code absolete.
*/
if (preg_match("/^([0-9]+) .*$/", $vm_info["vmwVmMemSize"], $matches))
{
$vm_info["vmwVmMemSize"] = $matches[1];
}
/*
* If VMware Tools is not running then don't overwrite the GuesOS with the error
* message, but just leave it as it currently is.
*/
if (stristr($vm_info["vmwVmGuestOS"], 'tools not running') !== FALSE)
{
$vm_info["vmwVmGuestOS"] = $db_info["vmwVmGuestOS"];
}
/*
* Process all the VMware Virtual Machine properties.
*/
foreach ($vm_info as $property => $value)
{
foreach ($db_info_list as $db_info) {
/*
* Check the property for any modifications.
* Fetch the Virtual Machine information.
*
* VMWARE-VMINFO-MIB::vmwVmDisplayName.224 = STRING: My First VM
* VMWARE-VMINFO-MIB::vmwVmGuestOS.224 = STRING: windows7Server64Guest
* VMWARE-VMINFO-MIB::vmwVmMemSize.224 = INTEGER: 8192 megabytes
* VMWARE-VMINFO-MIB::vmwVmState.224 = STRING: poweredOn
* VMWARE-VMINFO-MIB::vmwVmVMID.224 = INTEGER: 224
* VMWARE-VMINFO-MIB::vmwVmCpus.224 = INTEGER: 2
*/
if ($vm_info[$property] != $db_info[$property])
{
$vm_info = array();
// FIXME - this should loop building a query and then run the query after the loop (bad geert!)
dbUpdate(array($property => $vm_info[$property]), 'vminfo', '`id` = ?', array($db_info["id"]));
log_event($db_info["vmwVmDisplayName"] . " (" . preg_replace("/^vmwVm/", "", $property) . ") -> " . $vm_info[$property], $device);
$vm_info['vmwVmDisplayName'] = snmp_get($device, 'VMWARE-VMINFO-MIB::vmwVmDisplayName.'.$db_info['vmwVmVMID'], '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
$vm_info['vmwVmGuestOS'] = snmp_get($device, 'VMWARE-VMINFO-MIB::vmwVmGuestOS.'.$db_info['vmwVmVMID'], '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
$vm_info['vmwVmMemSize'] = snmp_get($device, 'VMWARE-VMINFO-MIB::vmwVmMemSize.'.$db_info['vmwVmVMID'], '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
$vm_info['vmwVmState'] = snmp_get($device, 'VMWARE-VMINFO-MIB::vmwVmState.'.$db_info['vmwVmVMID'], '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
$vm_info['vmwVmCpus'] = snmp_get($device, 'VMWARE-VMINFO-MIB::vmwVmCpus.'.$db_info['vmwVmVMID'], '-Osqnv', '+VMWARE-ROOT-MIB:VMWARE-VMINFO-MIB', '+'.$config['install_dir'].'/mibs/vmware:'.$config['mibdir']);
/*
* VMware does not return an INTEGER but a STRING of the vmwVmMemSize. This bug
* might be resolved by VMware in the future making this code absolete.
*/
if (preg_match('/^([0-9]+) .*$/', $vm_info['vmwVmMemSize'], $matches)) {
$vm_info['vmwVmMemSize'] = $matches[1];
}
}
}
/*
* If VMware Tools is not running then don't overwrite the GuesOS with the error
* message, but just leave it as it currently is.
*/
if (stristr($vm_info['vmwVmGuestOS'], 'tools not running') !== false) {
$vm_info['vmwVmGuestOS'] = $db_info['vmwVmGuestOS'];
}
/*
* Process all the VMware Virtual Machine properties.
*/
foreach ($vm_info as $property => $value) {
/*
* Check the property for any modifications.
*/
if ($vm_info[$property] != $db_info[$property]) {
// FIXME - this should loop building a query and then run the query after the loop (bad geert!)
dbUpdate(array($property => $vm_info[$property]), 'vminfo', '`id` = ?', array($db_info['id']));
log_event($db_info['vmwVmDisplayName'].' ('.preg_replace('/^vmwVm/', '', $property).') -> '.$vm_info[$property], $device);
}
}
}//end foreach
/*
* Finished discovering VMware information.
*/
echo("\n");
?>
echo "\n";
+5 -7
View File
@@ -1,11 +1,9 @@
<?php
# Remove Vyatta prefix
$device['sysDescr'] = str_replace("Vyatta ", "", $device['sysDescr']);
// Remove Vyatta prefix
$device['sysDescr'] = str_replace('Vyatta ', '', $device['sysDescr']);
# Version is second remaining word in sysDescr
list(,$version) = explode(" ", $device['sysDescr']);
// Version is second remaining word in sysDescr
list(,$version) = explode(' ', $device['sysDescr']);
$features = "";
?>
$features = '';
+12 -14
View File
@@ -1,19 +1,17 @@
<?php
/*
* LibreNMS WebPower OS information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
* LibreNMS WebPower OS information module
*
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$data = str_replace('"', '', snmp_get($device, "1.3.6.1.2.1.33.1.1.4.0", "-Ovq"));
$data = str_replace('"', '', snmp_get($device, '1.3.6.1.2.1.33.1.1.4.0', '-Ovq'));
preg_match_all('/^WebPower Pro II Card|v[0-9]+.[0-9]+|(SN [0-9]+)/', $data, $matches);
$hardware = $matches[0][0];
$version = $matches[0][1];
$serial = $matches[0][2];
?>
$version = $matches[0][1];
$serial = $matches[0][2];
+156 -62
View File
@@ -1,70 +1,164 @@
<?php
#sysDescr.0 = STRING: Hardware: x86 Family 6 Model 1 Stepping 9 AT/AT COMPATIBLE - Software: Windows NT Version 4.0 (Build Number: 1381 Multiprocessor Free )
#sysDescr.0 = STRING: Hardware: x86 Family 6 Model 3 Stepping 4 AT/AT COMPATIBLE - Software: Windows NT Version 3.51 (Build Number: 1057 Multiprocessor Free )
#sysDescr.0 = STRING: Hardware: x86 Family 16 Model 4 Stepping 2 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.1 (Build 2600 Multiprocessor Free)
#sysDescr.0 = STRING: Hardware: x86 Family 15 Model 2 Stepping 5 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0 (Build 2195 Multiprocessor Free)
#sysDescr.0 = STRING: Hardware: AMD64 Family 16 Model 2 Stepping 3 AT/AT COMPATIBLE - Software: Windows Version 6.0 (Build 6002 Multiprocessor Free)
#sysDescr.0 = STRING: Hardware: EM64T Family 6 Model 26 Stepping 5 AT/AT COMPATIBLE - Software: Windows Version 5.2 (Build 3790 Multiprocessor Free)
#sysDescr.0 = STRING: Hardware: Intel64 Family 6 Model 23 Stepping 6 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free)
#sysDescr.0 = STRING: Hardware: AMD64 Family 16 Model 8 Stepping 0 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free)
if (strstr($poll_device['sysDescr'], "x86")) { $hardware = "Generic x86"; }
if (strstr($poll_device['sysDescr'], "ia64")) { $hardware = "Intel Itanium IA64"; }
if (strstr($poll_device['sysDescr'], "EM64")) { $hardware = "Intel x64"; }
if (strstr($poll_device['sysDescr'], "AMD64")) { $hardware = "AMD x64"; }
if (strstr($poll_device['sysDescr'], "Intel64")) { $hardware = "Intel x64"; }
if($poll_device['sysObjectID'] == ".1.3.6.1.4.1.311.1.1.3.1.1") { // Workstation
if (strstr($poll_device['sysDescr'], "Build Number: 1057")) { $version = "NT 3.51 Workstation"; }
if (strstr($poll_device['sysDescr'], "Build Number: 1381")) { $version = "NT 4.0 Workstation"; }
if (strstr($poll_device['sysDescr'], "Build 2195")) { $version = "2000 (NT 5.0)"; }
if (strstr($poll_device['sysDescr'], "Build 2600")) { $version = "XP (NT 5.1)"; }
if (strstr($poll_device['sysDescr'], "Build 3790")) { $version = "XP x64 (NT 5.2)"; }
if (strstr($poll_device['sysDescr'], "Build 6000")) { $version = "Vista (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 6001")) { $version = "Vista SP1 (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 6002")) { $version = "Vista SP2 (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 7600")) { $version = "7 (NT 6.1)"; }
if (strstr($poll_device['sysDescr'], "Build 7601")) { $version = "7 SP1 (NT 6.1)"; }
} elseif ($poll_device['sysObjectID'] == ".1.3.6.1.4.1.311.1.1.3.1.2") { // Server
if (strstr($poll_device['sysDescr'], "Build Number: 1057")) { $version = "NT Server 3.51"; }
if (strstr($poll_device['sysDescr'], "Build Number: 1381")) { $version = "NT Server 4.0"; }
if (strstr($poll_device['sysDescr'], "Build 2195")) { $version = "2000 Server (NT 5.0)"; }
if (strstr($poll_device['sysDescr'], "Build 3790")) { $version = "Server 2003 (NT 5.2)"; }
if (strstr($poll_device['sysDescr'], "Build 6001")) { $version = "Server 2008 (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 6002")) { $version = "Server 2008 SP2 (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 7600")) { $version = "Server 2008 R2 (NT 6.1)"; }
if (strstr($poll_device['sysDescr'], "Build 7601")) { $version = "Server 2008 R2 SP1 (NT 6.1)"; }
if (strstr($poll_device['sysDescr'], "Build 9200")) { $version = "Server 2012 (NT 6.2)"; }
} elseif ($poll_device['sysObjectID'] == ".1.3.6.1.4.1.311.1.1.3.1.3") { // Datacentre Server
if (strstr($poll_device['sysDescr'], "Build Number: 1057")) { $version = "NT Datacenter 3.51"; }
if (strstr($poll_device['sysDescr'], "Build Number: 1381")) { $version = "NT Datacenter 4.0"; }
if (strstr($poll_device['sysDescr'], "Build 2195")) { $version = "2000 Datacenter Server (NT 5.0)"; }
if (strstr($poll_device['sysDescr'], "Build 3790")) { $version = "Server 2003 Datacenter (NT 5.2)"; }
if (strstr($poll_device['sysDescr'], "Build 6001")) { $version = "Server 2008 Datacenter (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 6002")) { $version = "Server 2008 Datacenter SP2 (NT 6.0)"; }
if (strstr($poll_device['sysDescr'], "Build 7600")) { $version = "Server 2008 Datacenter R2 (NT 6.1)"; }
if (strstr($poll_device['sysDescr'], "Build 7601")) { $version = "Server 2008 Datacenter R2 SP1 (NT 6.1)"; }
if (strstr($poll_device['sysDescr'], "Build 9200")) { $version = "Server 2012 Datacenter (NT 6.2)"; }
// sysDescr.0 = STRING: Hardware: x86 Family 6 Model 1 Stepping 9 AT/AT COMPATIBLE - Software: Windows NT Version 4.0 (Build Number: 1381 Multiprocessor Free )
// sysDescr.0 = STRING: Hardware: x86 Family 6 Model 3 Stepping 4 AT/AT COMPATIBLE - Software: Windows NT Version 3.51 (Build Number: 1057 Multiprocessor Free )
// sysDescr.0 = STRING: Hardware: x86 Family 16 Model 4 Stepping 2 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.1 (Build 2600 Multiprocessor Free)
// sysDescr.0 = STRING: Hardware: x86 Family 15 Model 2 Stepping 5 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0 (Build 2195 Multiprocessor Free)
// sysDescr.0 = STRING: Hardware: AMD64 Family 16 Model 2 Stepping 3 AT/AT COMPATIBLE - Software: Windows Version 6.0 (Build 6002 Multiprocessor Free)
// sysDescr.0 = STRING: Hardware: EM64T Family 6 Model 26 Stepping 5 AT/AT COMPATIBLE - Software: Windows Version 5.2 (Build 3790 Multiprocessor Free)
// sysDescr.0 = STRING: Hardware: Intel64 Family 6 Model 23 Stepping 6 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free)
// sysDescr.0 = STRING: Hardware: AMD64 Family 16 Model 8 Stepping 0 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free)
if (strstr($poll_device['sysDescr'], 'x86')) {
$hardware = 'Generic x86';
}
if (strstr($poll_device['sysDescr'], "Uniprocessor")) { $features = "Uniprocessor"; }
if (strstr($poll_device['sysDescr'], "Multiprocessor")) { $features = "Multiprocessor"; }
if (strstr($poll_device['sysDescr'], 'ia64')) {
$hardware = 'Intel Itanium IA64';
}
if (strstr($poll_device['sysDescr'], 'EM64')) {
$hardware = 'Intel x64';
}
if (strstr($poll_device['sysDescr'], 'AMD64')) {
$hardware = 'AMD x64';
}
if (strstr($poll_device['sysDescr'], 'Intel64')) {
$hardware = 'Intel x64';
}
if ($poll_device['sysObjectID'] == '.1.3.6.1.4.1.311.1.1.3.1.1') {
if (strstr($poll_device['sysDescr'], 'Build Number: 1057')) {
$version = 'NT 3.51 Workstation';
}
if (strstr($poll_device['sysDescr'], 'Build Number: 1381')) {
$version = 'NT 4.0 Workstation';
}
if (strstr($poll_device['sysDescr'], 'Build 2195')) {
$version = '2000 (NT 5.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 2600')) {
$version = 'XP (NT 5.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 3790')) {
$version = 'XP x64 (NT 5.2)';
}
if (strstr($poll_device['sysDescr'], 'Build 6000')) {
$version = 'Vista (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 6001')) {
$version = 'Vista SP1 (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 6002')) {
$version = 'Vista SP2 (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 7600')) {
$version = '7 (NT 6.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 7601')) {
$version = '7 SP1 (NT 6.1)';
}
}
else if ($poll_device['sysObjectID'] == '.1.3.6.1.4.1.311.1.1.3.1.2') {
if (strstr($poll_device['sysDescr'], 'Build Number: 1057')) {
$version = 'NT Server 3.51';
}
if (strstr($poll_device['sysDescr'], 'Build Number: 1381')) {
$version = 'NT Server 4.0';
}
if (strstr($poll_device['sysDescr'], 'Build 2195')) {
$version = '2000 Server (NT 5.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 3790')) {
$version = 'Server 2003 (NT 5.2)';
}
if (strstr($poll_device['sysDescr'], 'Build 6001')) {
$version = 'Server 2008 (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 6002')) {
$version = 'Server 2008 SP2 (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 7600')) {
$version = 'Server 2008 R2 (NT 6.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 7601')) {
$version = 'Server 2008 R2 SP1 (NT 6.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 9200')) {
$version = 'Server 2012 (NT 6.2)';
}
}
else if ($poll_device['sysObjectID'] == '.1.3.6.1.4.1.311.1.1.3.1.3') {
if (strstr($poll_device['sysDescr'], 'Build Number: 1057')) {
$version = 'NT Datacenter 3.51';
}
if (strstr($poll_device['sysDescr'], 'Build Number: 1381')) {
$version = 'NT Datacenter 4.0';
}
if (strstr($poll_device['sysDescr'], 'Build 2195')) {
$version = '2000 Datacenter Server (NT 5.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 3790')) {
$version = 'Server 2003 Datacenter (NT 5.2)';
}
if (strstr($poll_device['sysDescr'], 'Build 6001')) {
$version = 'Server 2008 Datacenter (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 6002')) {
$version = 'Server 2008 Datacenter SP2 (NT 6.0)';
}
if (strstr($poll_device['sysDescr'], 'Build 7600')) {
$version = 'Server 2008 Datacenter R2 (NT 6.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 7601')) {
$version = 'Server 2008 Datacenter R2 SP1 (NT 6.1)';
}
if (strstr($poll_device['sysDescr'], 'Build 9200')) {
$version = 'Server 2012 Datacenter (NT 6.2)';
}
}//end if
if (strstr($poll_device['sysDescr'], 'Uniprocessor')) {
$features = 'Uniprocessor';
}
if (strstr($poll_device['sysDescr'], 'Multiprocessor')) {
$features = 'Multiprocessor';
}
// Detect processor type? : I.E. x86 Family 15 Model 2 Stepping 7
// Detect Dell hardware via OpenManage SNMP
$hw = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1", "-Oqv", "MIB-Dell-10892");
$hw = trim(str_replace("\"", "", $hw));
if ($hw) { $hardware = "Dell " . $hw; }
$hw = snmp_get($device, '.1.3.6.1.4.1.674.10892.1.300.10.1.9.1', '-Oqv', 'MIB-Dell-10892');
$hw = trim(str_replace('"', '', $hw));
if ($hw) {
$hardware = 'Dell '.$hw;
}
$serial = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.11.1", "-Oqv", "MIB-Dell-10892");
$serial = trim(str_replace("\"", "", $serial));
?>
$serial = snmp_get($device, '.1.3.6.1.4.1.674.10892.1.300.10.1.11.1', '-Oqv', 'MIB-Dell-10892');
$serial = trim(str_replace('"', '', $serial));