mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: finish logic and definition separation (#6883)
Clean up rewrites to only have function definitions Move authentication initialization into a function
This commit is contained in:
@ -5,22 +5,27 @@
|
||||
// disable certificate checking before connect if required
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
if (isset($config['auth_ad_check_certificates']) &&
|
||||
function init_auth()
|
||||
{
|
||||
global $ad_init, $ldap_connection, $config;
|
||||
|
||||
if (isset($config['auth_ad_check_certificates']) &&
|
||||
!$config['auth_ad_check_certificates']) {
|
||||
putenv('LDAPTLS_REQCERT=never');
|
||||
};
|
||||
};
|
||||
|
||||
if (isset($config['auth_ad_debug']) && $config['auth_ad_debug']) {
|
||||
if (isset($config['auth_ad_debug']) && $config['auth_ad_debug']) {
|
||||
ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, 7);
|
||||
}
|
||||
}
|
||||
|
||||
$ad_init = false; // this variable tracks if bind has been called so we don't call it multiple times
|
||||
$ldap_connection = @ldap_connect($config['auth_ad_url']);
|
||||
$ad_init = false; // this variable tracks if bind has been called so we don't call it multiple times
|
||||
$ldap_connection = @ldap_connect($config['auth_ad_url']);
|
||||
|
||||
// disable referrals and force ldap version to 3
|
||||
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
}
|
||||
|
||||
function authenticate($username, $password)
|
||||
{
|
||||
|
@ -2,38 +2,43 @@
|
||||
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
if (! isset($_SESSION['username'])) {
|
||||
function init_auth()
|
||||
{
|
||||
global $ldap_connection, $config;
|
||||
|
||||
if (! isset($_SESSION['username'])) {
|
||||
$_SESSION['username'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Disable certificate checking before connect if required
|
||||
if (isset($config['auth_ad_check_certificates']) &&
|
||||
if (isset($config['auth_ad_check_certificates']) &&
|
||||
$config['auth_ad_check_certificates'] == 0) {
|
||||
putenv('LDAPTLS_REQCERT=never');
|
||||
};
|
||||
};
|
||||
|
||||
// Set up connection to LDAP server
|
||||
$ldap_connection = @ldap_connect($config['auth_ad_url']);
|
||||
if (! $ldap_connection) {
|
||||
$ldap_connection = @ldap_connect($config['auth_ad_url']);
|
||||
if (! $ldap_connection) {
|
||||
echo '<h2>Fatal error while connecting to AD url ' . $config['auth_ad_url'] . ': ' . ldap_error($ldap_connection) . '</h2>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// disable referrals and force ldap version to 3
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
|
||||
// Bind to AD
|
||||
if (isset($config['auth_ad_binduser']) && isset($config['auth_ad_bindpassword'])) {
|
||||
if (isset($config['auth_ad_binduser']) && isset($config['auth_ad_bindpassword'])) {
|
||||
// With specified bind user
|
||||
if (! ldap_bind($ldap_connection, "${config['auth_ad_binduser']}@${config['auth_ad_domain']}", "${config['auth_ad_bindpassword']}")) {
|
||||
echo ldap_error($ldap_connection);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
// Anonymous
|
||||
if (! ldap_bind($ldap_connection)) {
|
||||
echo ldap_error($ldap_connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function authenticate($username, $password)
|
||||
|
@ -3,6 +3,10 @@
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
use Phpass\PasswordHash;
|
||||
|
||||
function init_auth()
|
||||
{
|
||||
}
|
||||
|
||||
function authenticate($username, $password)
|
||||
{
|
||||
if (user_exists($username)) {
|
||||
|
@ -40,28 +40,33 @@
|
||||
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
if (! isset($_SESSION['username'])) {
|
||||
$_SESSION['username'] = '';
|
||||
}
|
||||
function init_auth()
|
||||
{
|
||||
global $ldap_connection, $config;
|
||||
|
||||
/**
|
||||
if (! isset($_SESSION['username'])) {
|
||||
$_SESSION['username'] = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up connection to LDAP server
|
||||
*/
|
||||
$ldap_connection = @ldap_connect($config['auth_ldap_server'], $config['auth_ldap_port']);
|
||||
if (! $ldap_connection) {
|
||||
$ldap_connection = @ldap_connect($config['auth_ldap_server'], $config['auth_ldap_port']);
|
||||
if (! $ldap_connection) {
|
||||
echo '<h2>Fatal error while connecting to LDAP server ' . $config['auth_ldap_server'] . ':' . $config['auth_ldap_port'] . ': ' . ldap_error($ldap_connection) . '</h2>';
|
||||
exit;
|
||||
}
|
||||
if ($config['auth_ldap_version']) {
|
||||
}
|
||||
if ($config['auth_ldap_version']) {
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, $config['auth_ldap_version']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) {
|
||||
if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) {
|
||||
$tls = ldap_start_tls($ldap_connection);
|
||||
if ($config['auth_ldap_starttls'] == 'require' && $tls === false) {
|
||||
echo '<h2>Fatal error: LDAP TLS required but not successfully negotiated:' . ldap_error($ldap_connection) . '</h2>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,14 +2,19 @@
|
||||
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
$ldap_connection = @ldap_connect($config['auth_ldap_server'], $config['auth_ldap_port']);
|
||||
function init_auth()
|
||||
{
|
||||
global $config, $ldap_connection;
|
||||
|
||||
if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) {
|
||||
$ldap_connection = @ldap_connect($config['auth_ldap_server'], $config['auth_ldap_port']);
|
||||
|
||||
if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) {
|
||||
$tls = ldap_start_tls($ldap_connection);
|
||||
if ($config['auth_ldap_starttls'] == 'require' && $tls === false) {
|
||||
echo '<h2>Fatal error: LDAP TLS required but not successfully negotiated:'.ldap_error($ldap_connection).'</h2>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
use Phpass\PasswordHash;
|
||||
|
||||
function init_auth()
|
||||
{
|
||||
}
|
||||
|
||||
function authenticate($username, $password)
|
||||
{
|
||||
$encrypted_old = md5($password);
|
||||
|
@ -4,8 +4,13 @@ use Dapphp\Radius\Radius;
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
use Phpass\PasswordHash;
|
||||
|
||||
/** @var Radius $radius */
|
||||
$radius = new Radius($config['radius']['hostname'], $config['radius']['secret'], $config['radius']['suffix'], $config['radius']['timeout'], $config['radius']['port']);
|
||||
function init_auth()
|
||||
{
|
||||
/** @var Radius $radius */
|
||||
global $radius, $config;
|
||||
|
||||
$radius = new Radius($config['radius']['hostname'], $config['radius']['secret'], $config['radius']['suffix'], $config['radius']['timeout'], $config['radius']['port']);
|
||||
}
|
||||
|
||||
function authenticate($username, $password)
|
||||
{
|
||||
|
@ -1349,19 +1349,6 @@ function get_ports_from_type($given_types)
|
||||
return $ports;
|
||||
}
|
||||
|
||||
function ipmiSensorName($hardwareId, $sensorIpmi, $rewriteArray)
|
||||
{
|
||||
if (count($rewriteArray[$hardwareId]) > 0) {
|
||||
if ($rewriteArray[$hardwareId][$sensorIpmi] != "") {
|
||||
return $rewriteArray[$hardwareId][$sensorIpmi];
|
||||
} else {
|
||||
return $sensorIpmi;
|
||||
}
|
||||
} else {
|
||||
return $sensorIpmi;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filename
|
||||
* @param $content
|
||||
|
@ -15,7 +15,7 @@ $rrd_options .= ' AREA:sensor_max#c5c5c5';
|
||||
$rrd_options .= ' AREA:sensor_min#ffffffff';
|
||||
|
||||
if ($sensor['poller_type'] == "ipmi") {
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 21)."'";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr']), 21)."'";
|
||||
} else {
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ $rrd_options .= ' AREA:sensor_min';
|
||||
$rrd_options .= ' AREA:sensor_diff#c5c5c5::STACK';
|
||||
|
||||
if ($sensor['poller_type'] == "ipmi") {
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 21)."'";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr']), 21)."'";
|
||||
} else {
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi
|
||||
}
|
||||
|
||||
if ($sensor['poller_type'] == "ipmi") {
|
||||
$sensor_descr = ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames);
|
||||
$sensor_descr = ipmiSensorName($device['hardware'], $sensor['sensor_descr']);
|
||||
} else {
|
||||
$sensor_descr = $sensor['sensor_descr'];
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ if (count($sensors)) {
|
||||
$link = generate_url($link_array);
|
||||
|
||||
if ($sensor['poller_type'] == "ipmi") {
|
||||
$sensor['sensor_descr'] = substr(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 0, 48);
|
||||
$sensor['sensor_descr'] = substr(ipmiSensorName($device['hardware'], $sensor['sensor_descr']), 0, 48);
|
||||
} else {
|
||||
$sensor['sensor_descr'] = substr($sensor['sensor_descr'], 0, 48);
|
||||
}
|
||||
|
@ -34,52 +34,59 @@ $config['install_dir'] = $install_dir;
|
||||
chdir($install_dir);
|
||||
|
||||
if (!getenv('TRAVIS')) {
|
||||
require('Net/IPv4.php');
|
||||
require('Net/IPv6.php');
|
||||
require_once 'Net/IPv4.php';
|
||||
require_once 'Net/IPv6.php';
|
||||
}
|
||||
|
||||
# composer autoload
|
||||
require $install_dir . '/vendor/autoload.php';
|
||||
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||
require $install_dir . '/lib/influxdb-php/vendor/autoload.php';
|
||||
require_once $install_dir . '/lib/influxdb-php/vendor/autoload.php';
|
||||
}
|
||||
|
||||
if (!function_exists('module_selected')) {
|
||||
function module_selected($module, $modules)
|
||||
{
|
||||
return in_array($module, (array) $modules);
|
||||
}
|
||||
}
|
||||
|
||||
// function only files
|
||||
require_once $install_dir . '/includes/common.php';
|
||||
require $install_dir . '/includes/dbFacile.php';
|
||||
require $install_dir . '/includes/rrdtool.inc.php';
|
||||
require $install_dir . '/includes/influxdb.inc.php';
|
||||
require $install_dir . '/includes/graphite.inc.php';
|
||||
require $install_dir . '/includes/datastore.inc.php';
|
||||
require $install_dir . '/includes/billing.php';
|
||||
require $install_dir . '/includes/syslog.php';
|
||||
require_once $install_dir . '/includes/dbFacile.php';
|
||||
require_once $install_dir . '/includes/rrdtool.inc.php';
|
||||
require_once $install_dir . '/includes/influxdb.inc.php';
|
||||
require_once $install_dir . '/includes/graphite.inc.php';
|
||||
require_once $install_dir . '/includes/datastore.inc.php';
|
||||
require_once $install_dir . '/includes/billing.php';
|
||||
require_once $install_dir . '/includes/syslog.php';
|
||||
if (module_selected('mocksnmp', $init_modules)) {
|
||||
require $install_dir . '/tests/mocks/mock.snmp.inc.php';
|
||||
require_once $install_dir . '/tests/mocks/mock.snmp.inc.php';
|
||||
} else {
|
||||
require $install_dir . '/includes/snmp.inc.php';
|
||||
require_once $install_dir . '/includes/snmp.inc.php';
|
||||
}
|
||||
require $install_dir . '/includes/services.inc.php';
|
||||
require $install_dir . '/includes/mergecnf.inc.php';
|
||||
require $install_dir . '/includes/functions.php';
|
||||
require $install_dir . '/includes/rewrites.php'; // FIXME both definitions and functions
|
||||
require_once $install_dir . '/includes/services.inc.php';
|
||||
require_once $install_dir . '/includes/mergecnf.inc.php';
|
||||
require_once $install_dir . '/includes/functions.php';
|
||||
require_once $install_dir . '/includes/rewrites.php';
|
||||
|
||||
if (module_selected('web', $init_modules)) {
|
||||
chdir($install_dir . '/html');
|
||||
require $install_dir . '/html/includes/functions.inc.php';
|
||||
require_once $install_dir . '/html/includes/functions.inc.php';
|
||||
}
|
||||
|
||||
if (module_selected('discovery', $init_modules)) {
|
||||
require $install_dir . '/includes/discovery/functions.inc.php';
|
||||
require_once $install_dir . '/includes/discovery/functions.inc.php';
|
||||
}
|
||||
|
||||
if (module_selected('polling', $init_modules)) {
|
||||
require_once $install_dir . '/includes/device-groups.inc.php';
|
||||
require $install_dir . '/includes/polling/functions.inc.php';
|
||||
require_once $install_dir . '/includes/polling/functions.inc.php';
|
||||
}
|
||||
|
||||
if (module_selected('alerts', $init_modules)) {
|
||||
require_once $install_dir . '/includes/device-groups.inc.php';
|
||||
require $install_dir . '/includes/alerts.inc.php';
|
||||
require_once $install_dir . '/includes/alerts.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +147,9 @@ if (!module_selected('nodb', $init_modules)) {
|
||||
}
|
||||
|
||||
if (file_exists($config['install_dir'] . '/html/includes/authentication/'.$config['auth_mechanism'].'.inc.php')) {
|
||||
require $config['install_dir'] . '/html/includes/authentication/'.$config['auth_mechanism'].'.inc.php';
|
||||
require_once $install_dir . '/html/includes/authentication/functions.php';
|
||||
require_once $config['install_dir'] . '/html/includes/authentication/'.$config['auth_mechanism'].'.inc.php';
|
||||
init_auth();
|
||||
} else {
|
||||
print_error('ERROR: no valid auth_mechanism defined!');
|
||||
exit();
|
||||
@ -165,11 +174,5 @@ if (module_selected('auth', $init_modules) ||
|
||||
$config['allow_unauth_graphs'] != true
|
||||
)
|
||||
) {
|
||||
require $install_dir . '/html/includes/authentication/functions.php';
|
||||
require $install_dir . '/html/includes/authenticate.inc.php';
|
||||
}
|
||||
|
||||
function module_selected($module, $modules)
|
||||
{
|
||||
return in_array($module, (array) $modules);
|
||||
}
|
||||
|
@ -125,16 +125,9 @@ function cleanPort($interface, $device = null)
|
||||
return $interface;
|
||||
}
|
||||
|
||||
|
||||
$rewrite_entSensorType = array(
|
||||
'celsius' => 'C',
|
||||
'unknown' => '',
|
||||
'specialEnum' => 'C',
|
||||
'watts' => 'W',
|
||||
'truthvalue' => '',
|
||||
);
|
||||
|
||||
$translate_ifOperStatus = array(
|
||||
function translate_ifOperStatus($ifOperStatus)
|
||||
{
|
||||
$translate_ifOperStatus = array(
|
||||
'1' => 'up',
|
||||
'2' => 'down',
|
||||
'3' => 'testing',
|
||||
@ -142,33 +135,25 @@ $translate_ifOperStatus = array(
|
||||
'5' => 'dormant',
|
||||
'6' => 'notPresent',
|
||||
'7' => 'lowerLayerDown',
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
function translate_ifOperStatus($ifOperStatus)
|
||||
{
|
||||
global $translate_ifOperStatus;
|
||||
|
||||
if ($translate_ifOperStatus['$ifOperStatus']) {
|
||||
$ifOperStatus = $translate_ifOperStatus['$ifOperStatus'];
|
||||
if (isset($translate_ifOperStatus[$ifOperStatus])) {
|
||||
$ifOperStatus = $translate_ifOperStatus[$ifOperStatus];
|
||||
}
|
||||
|
||||
return $ifOperStatus;
|
||||
}
|
||||
|
||||
|
||||
$translate_ifAdminStatus = array(
|
||||
function translate_ifAdminStatus($ifAdminStatus)
|
||||
{
|
||||
$translate_ifAdminStatus = array(
|
||||
'1' => 'up',
|
||||
'2' => 'down',
|
||||
'3' => 'testing',
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
function translate_ifAdminStatus($ifAdminStatus)
|
||||
{
|
||||
global $translate_ifAdminStatus;
|
||||
|
||||
if ($translate_ifAdminStatus[$ifAdminStatus]) {
|
||||
if (isset($translate_ifAdminStatus[$ifAdminStatus])) {
|
||||
$ifAdminStatus = $translate_ifAdminStatus[$ifAdminStatus];
|
||||
}
|
||||
|
||||
@ -176,115 +161,79 @@ function translate_ifAdminStatus($ifAdminStatus)
|
||||
}
|
||||
|
||||
|
||||
$rewrite_junose_hardware = array(
|
||||
'juniErx1400' => 'ERX-1400',
|
||||
'juniErx700' => 'ERX-700',
|
||||
'juniErx1440' => 'ERX-1440',
|
||||
'juniErx705' => 'ERX-705',
|
||||
'juniErx310' => 'ERX-310',
|
||||
'juniE320' => 'E320',
|
||||
'juniE120' => 'E120',
|
||||
'juniSsx1400' => 'SSX-1400',
|
||||
'juniSsx700' => 'SSX-700',
|
||||
'juniSsx1440' => 'SSX-1440',
|
||||
);
|
||||
// Specific rewrite functions
|
||||
|
||||
$rewrite_junos_hardware = array(
|
||||
'jnxProductNameM40' => 'M40',
|
||||
'jnxProductNameM20' => 'M20',
|
||||
'jnxProductNameM160' => 'M160',
|
||||
'jnxProductNameM10' => 'M10',
|
||||
'jnxProductNameM5' => 'M5',
|
||||
'jnxProductNameT640' => 'T640',
|
||||
'jnxProductNameT320' => 'T320',
|
||||
'jnxProductNameM40e' => 'M40e',
|
||||
'jnxProductNameM320' => 'M320',
|
||||
'jnxProductNameM7i' => 'M7i',
|
||||
'jnxProductNameM10i' => 'M10i',
|
||||
'jnxProductNameJ2300' => 'J2300',
|
||||
'jnxProductNameJ4300' => 'J4300',
|
||||
'jnxProductNameJ6300' => 'J6300',
|
||||
'jnxProductNameIRM' => 'IRM',
|
||||
'jnxProductNameTX' => 'TX',
|
||||
'jnxProductNameM120' => 'M120',
|
||||
'jnxProductNameJ4350' => 'J4350',
|
||||
'jnxProductNameJ6350' => 'J6350',
|
||||
'jnxProductNameMX960' => 'MX960',
|
||||
'jnxProductNameJ4320' => 'J4320',
|
||||
'jnxProductNameJ2320' => 'J2320',
|
||||
'jnxProductNameJ2350' => 'J2350',
|
||||
'jnxProductNameMX480' => 'MX480',
|
||||
'jnxProductNameSRX5800' => 'SRX5800',
|
||||
'jnxProductNameT1600' => 'T1600',
|
||||
'jnxProductNameSRX5600' => 'SRX5600',
|
||||
'jnxProductNameMX240' => 'MX240',
|
||||
'jnxProductNameEX3200' => 'EX3200',
|
||||
'jnxProductNameEX3300' => 'EX3300',
|
||||
'jnxProductNameEX4200' => 'EX4200',
|
||||
'jnxProductNameEX8208' => 'EX8208',
|
||||
'jnxProductNameEX8216' => 'EX8216',
|
||||
'jnxProductNameSRX3600' => 'SRX3600',
|
||||
'jnxProductNameSRX3400' => 'SRX3400',
|
||||
'jnxProductNameSRX210' => 'SRX210',
|
||||
'jnxProductNameTXP' => 'TXP',
|
||||
'jnxProductNameJCS' => 'JCS',
|
||||
'jnxProductNameSRX240' => 'SRX240',
|
||||
'jnxProductNameSRX650' => 'SRX650',
|
||||
'jnxProductNameSRX100' => 'SRX100',
|
||||
'jnxProductNameESR1000V' => 'ESR1000V',
|
||||
'jnxProductNameEX2200' => 'EX2200',
|
||||
'jnxProductNameEX4500' => 'EX4500',
|
||||
'jnxProductNameFXSeries' => 'FX Series',
|
||||
'jnxProductNameIBM4274M02J02M' => 'IBM4274M02J02M',
|
||||
// ?
|
||||
'jnxProductNameIBM4274M06J06M' => 'IBM4274M06J06M',
|
||||
// ?
|
||||
'jnxProductNameIBM4274M11J11M' => 'IBM4274M11J11M',
|
||||
// ?
|
||||
'jnxProductNameSRX1400' => 'SRX1400',
|
||||
'jnxProductNameIBM4274S58J58S' => 'IBM4274S58J58S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S56J56S' => 'IBM4274S56J56S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S36J36S' => 'IBM4274S36J36S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S34J34S' => 'IBM4274S34J34S',
|
||||
// ?
|
||||
'jnxProductNameIBM427348EJ48E' => 'IBM427348EJ48E',
|
||||
// ?
|
||||
'jnxProductNameIBM4274E08J08E' => 'IBM4274E08J08E',
|
||||
// ?
|
||||
'jnxProductNameIBM4274E16J16E' => 'IBM4274E16J16E',
|
||||
// ?
|
||||
'jnxProductNameMX80' => 'MX80',
|
||||
'jnxProductName' => '',
|
||||
'jnxProductQFX510048S6Q' => 'QFX5100-48S6Q',
|
||||
);
|
||||
function makeshortif($if)
|
||||
{
|
||||
$rewrite_shortif = array(
|
||||
'tengigabitethernet' => 'Te',
|
||||
'tengige' => 'Te',
|
||||
'gigabitethernet' => 'Gi',
|
||||
'fastethernet' => 'Fa',
|
||||
'ethernet' => 'Et',
|
||||
'serial' => 'Se',
|
||||
'pos' => 'Pos',
|
||||
'port-channel' => 'Po',
|
||||
'atm' => 'Atm',
|
||||
'null' => 'Null',
|
||||
'loopback' => 'Lo',
|
||||
'dialer' => 'Di',
|
||||
'vlan' => 'Vlan',
|
||||
'tunnel' => 'Tunnel',
|
||||
'serviceinstance' => 'SI',
|
||||
'dwdm' => 'DWDM',
|
||||
);
|
||||
|
||||
$rewrite_cisco_hardware = array('.1.3.6.1.4.1.9.1.275' => 'C2948G-L3');
|
||||
$if = fixifName($if);
|
||||
$if = strtolower($if);
|
||||
$if = array_str_replace($rewrite_shortif, $if);
|
||||
return $if;
|
||||
}
|
||||
|
||||
$rewrite_ftos_hardware = array(
|
||||
'.1.3.6.1.4.1.6027.1.1.1' => 'E1200',
|
||||
'.1.3.6.1.4.1.6027.1.1.2' => 'E600',
|
||||
'.1.3.6.1.4.1.6027.1.1.3' => 'E300',
|
||||
'.1.3.6.1.4.1.6027.1.1.4' => 'E610',
|
||||
'.1.3.6.1.4.1.6027.1.1.5' => 'E1200i',
|
||||
'.1.3.6.1.4.1.6027.1.2.1' => 'C300',
|
||||
'.1.3.6.1.4.1.6027.1.2.2' => 'C150',
|
||||
'.1.3.6.1.4.1.6027.1.3.1' => 'S50',
|
||||
'.1.3.6.1.4.1.6027.1.3.2' => 'S50E',
|
||||
'.1.3.6.1.4.1.6027.1.3.3' => 'S50V',
|
||||
'.1.3.6.1.4.1.6027.1.3.4' => 'S25P-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.5' => 'S2410CP',
|
||||
'.1.3.6.1.4.1.6027.1.3.6' => 'S2410P',
|
||||
'.1.3.6.1.4.1.6027.1.3.7' => 'S50N-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.8' => 'S50N-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.9' => 'S25P-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.10' => 'S25V',
|
||||
'.1.3.6.1.4.1.6027.1.3.11' => 'S25N',
|
||||
);
|
||||
|
||||
$rewrite_fortinet_hardware = array(
|
||||
function rewrite_ios_features($features)
|
||||
{
|
||||
$rewrite_ios_features = array(
|
||||
'PK9S' => 'IP w/SSH LAN Only',
|
||||
'LANBASEK9' => 'Lan Base Crypto',
|
||||
'LANBASE' => 'Lan Base',
|
||||
'ADVENTERPRISEK9_IVS' => 'Advanced Enterprise Crypto Voice',
|
||||
'ADVENTERPRISEK9' => 'Advanced Enterprise Crypto',
|
||||
'ADVSECURITYK9' => 'Advanced Security Crypto',
|
||||
'K91P' => 'Provider Crypto',
|
||||
'K4P' => 'Provider Crypto',
|
||||
'ADVIPSERVICESK9' => 'Adv IP Services Crypto',
|
||||
'ADVIPSERVICES' => 'Adv IP Services',
|
||||
'IK9P' => 'IP Plus Crypto',
|
||||
'K9O3SY7' => 'IP ADSL FW IDS Plus IPSEC 3DES',
|
||||
'SPSERVICESK9' => 'SP Services Crypto',
|
||||
'PK9SV' => 'IP MPLS/IPV6 W/SSH + BGP',
|
||||
'IS' => 'IP Plus',
|
||||
'IPSERVICESK9' => 'IP Services Crypto',
|
||||
'BROADBAND' => 'Broadband',
|
||||
'IPBASE' => 'IP Base',
|
||||
'IPSERVICE' => 'IP Services',
|
||||
'P' => 'Service Provider',
|
||||
'P11' => 'Broadband Router',
|
||||
'G4P5' => 'NRP',
|
||||
'JK9S' => 'Enterprise Plus Crypto',
|
||||
'IK9S' => 'IP Plus Crypto',
|
||||
'JK' => 'Enterprise Plus',
|
||||
'I6Q4L2' => 'Layer 2',
|
||||
'I6K2L2Q4' => 'Layer 2 Crypto',
|
||||
'C3H2S' => 'Layer 2 SI/EI',
|
||||
'_WAN' => ' + WAN',
|
||||
);
|
||||
|
||||
$type = array_preg_replace($rewrite_ios_features, $features);
|
||||
|
||||
return ($features);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_fortinet_hardware($hardware)
|
||||
{
|
||||
$rewrite_fortinet_hardware = array(
|
||||
'.1.3.6.1.4.1.12356.102.1.1000' => 'FortiAnalyzer 100',
|
||||
'.1.3.6.1.4.1.12356.102.1.10002' => 'FortiAnalyzer 1000B',
|
||||
'.1.3.6.1.4.1.12356.102.1.1001' => 'FortiAnalyzer 100A',
|
||||
@ -360,9 +309,18 @@ $rewrite_fortinet_hardware = array(
|
||||
'.1.3.6.1.4.1.12356.101.1.611' => 'FortiWiFi 60A',
|
||||
'.1.3.6.1.4.1.12356.101.1.612' => 'FortiWiFi 60AM',
|
||||
'.1.3.6.1.4.1.12356.101.1.613' => 'FortiWiFi 60B',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_extreme_hardware = array(
|
||||
|
||||
$hardware = $rewrite_fortinet_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_extreme_hardware($hardware)
|
||||
{
|
||||
$rewrite_extreme_hardware = array(
|
||||
'.1.3.6.1.4.1.1916.2.26' => 'Alpine 3802',
|
||||
'.1.3.6.1.4.1.1916.2.20' => 'Alpine 3804',
|
||||
'.1.3.6.1.4.1.1916.2.17' => 'Alpine 3808',
|
||||
@ -437,9 +395,47 @@ $rewrite_extreme_hardware = array(
|
||||
'.1.3.6.1.4.1.1916.2.141' => 'Summit x480-48x',
|
||||
'.1.3.6.1.4.1.1916.2.167' => 'Summit x670-48x',
|
||||
'.1.3.6.1.4.1.1916.2.168' => 'Summit x670v-48x',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_ironware_hardware = array(
|
||||
// $hardware = array_str_replace($rewrite_extreme_hardware, $hardware);
|
||||
$hardware = $rewrite_extreme_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ftos_hardware($hardware)
|
||||
{
|
||||
$rewrite_ftos_hardware = array(
|
||||
'.1.3.6.1.4.1.6027.1.1.1' => 'E1200',
|
||||
'.1.3.6.1.4.1.6027.1.1.2' => 'E600',
|
||||
'.1.3.6.1.4.1.6027.1.1.3' => 'E300',
|
||||
'.1.3.6.1.4.1.6027.1.1.4' => 'E610',
|
||||
'.1.3.6.1.4.1.6027.1.1.5' => 'E1200i',
|
||||
'.1.3.6.1.4.1.6027.1.2.1' => 'C300',
|
||||
'.1.3.6.1.4.1.6027.1.2.2' => 'C150',
|
||||
'.1.3.6.1.4.1.6027.1.3.1' => 'S50',
|
||||
'.1.3.6.1.4.1.6027.1.3.2' => 'S50E',
|
||||
'.1.3.6.1.4.1.6027.1.3.3' => 'S50V',
|
||||
'.1.3.6.1.4.1.6027.1.3.4' => 'S25P-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.5' => 'S2410CP',
|
||||
'.1.3.6.1.4.1.6027.1.3.6' => 'S2410P',
|
||||
'.1.3.6.1.4.1.6027.1.3.7' => 'S50N-AC',
|
||||
'.1.3.6.1.4.1.6027.1.3.8' => 'S50N-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.9' => 'S25P-DC',
|
||||
'.1.3.6.1.4.1.6027.1.3.10' => 'S25V',
|
||||
'.1.3.6.1.4.1.6027.1.3.11' => 'S25N',
|
||||
);
|
||||
|
||||
$hardware = $rewrite_ftos_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ironware_hardware($hardware)
|
||||
{
|
||||
$rewrite_ironware_hardware = array(
|
||||
'snFIWGSwitch' => 'Stackable FastIron workgroup',
|
||||
'snFIBBSwitch' => 'Stackable FastIron backbone',
|
||||
'snNIRouter' => 'Stackable NetIron',
|
||||
@ -839,60 +835,129 @@ $rewrite_ironware_hardware = array(
|
||||
'snCer2048FX' => 'NetIron CER 2048F + 2x10G',
|
||||
'snCer2048CX' => 'NetIron CER 2048C + 2x10G',
|
||||
'snTI2X24Router' => 'Stackable TurboIron-X24',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_ios_features = array(
|
||||
'PK9S' => 'IP w/SSH LAN Only',
|
||||
'LANBASEK9' => 'Lan Base Crypto',
|
||||
'LANBASE' => 'Lan Base',
|
||||
'ADVENTERPRISEK9_IVS' => 'Advanced Enterprise Crypto Voice',
|
||||
'ADVENTERPRISEK9' => 'Advanced Enterprise Crypto',
|
||||
'ADVSECURITYK9' => 'Advanced Security Crypto',
|
||||
'K91P' => 'Provider Crypto',
|
||||
'K4P' => 'Provider Crypto',
|
||||
'ADVIPSERVICESK9' => 'Adv IP Services Crypto',
|
||||
'ADVIPSERVICES' => 'Adv IP Services',
|
||||
'IK9P' => 'IP Plus Crypto',
|
||||
'K9O3SY7' => 'IP ADSL FW IDS Plus IPSEC 3DES',
|
||||
'SPSERVICESK9' => 'SP Services Crypto',
|
||||
'PK9SV' => 'IP MPLS/IPV6 W/SSH + BGP',
|
||||
'IS' => 'IP Plus',
|
||||
'IPSERVICESK9' => 'IP Services Crypto',
|
||||
'BROADBAND' => 'Broadband',
|
||||
'IPBASE' => 'IP Base',
|
||||
'IPSERVICE' => 'IP Services',
|
||||
'P' => 'Service Provider',
|
||||
'P11' => 'Broadband Router',
|
||||
'G4P5' => 'NRP',
|
||||
'JK9S' => 'Enterprise Plus Crypto',
|
||||
'IK9S' => 'IP Plus Crypto',
|
||||
'JK' => 'Enterprise Plus',
|
||||
'I6Q4L2' => 'Layer 2',
|
||||
'I6K2L2Q4' => 'Layer 2 Crypto',
|
||||
'C3H2S' => 'Layer 2 SI/EI',
|
||||
'_WAN' => ' + WAN',
|
||||
);
|
||||
$hardware = array_str_replace($rewrite_ironware_hardware, $hardware);
|
||||
|
||||
$rewrite_shortif = array(
|
||||
'tengigabitethernet' => 'Te',
|
||||
'tengige' => 'Te',
|
||||
'gigabitethernet' => 'Gi',
|
||||
'fastethernet' => 'Fa',
|
||||
'ethernet' => 'Et',
|
||||
'serial' => 'Se',
|
||||
'pos' => 'Pos',
|
||||
'port-channel' => 'Po',
|
||||
'atm' => 'Atm',
|
||||
'null' => 'Null',
|
||||
'loopback' => 'Lo',
|
||||
'dialer' => 'Di',
|
||||
'vlan' => 'Vlan',
|
||||
'tunnel' => 'Tunnel',
|
||||
'serviceinstance' => 'SI',
|
||||
'dwdm' => 'DWDM',
|
||||
);
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
$rewrite_iftype = array(
|
||||
|
||||
function rewrite_junose_hardware($hardware)
|
||||
{
|
||||
$rewrite_junose_hardware = array(
|
||||
'juniErx1400' => 'ERX-1400',
|
||||
'juniErx700' => 'ERX-700',
|
||||
'juniErx1440' => 'ERX-1440',
|
||||
'juniErx705' => 'ERX-705',
|
||||
'juniErx310' => 'ERX-310',
|
||||
'juniE320' => 'E320',
|
||||
'juniE120' => 'E120',
|
||||
'juniSsx1400' => 'SSX-1400',
|
||||
'juniSsx700' => 'SSX-700',
|
||||
'juniSsx1440' => 'SSX-1440',
|
||||
);
|
||||
|
||||
|
||||
$hardware = array_str_replace($rewrite_junose_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_junos_hardware($hardware)
|
||||
{
|
||||
$rewrite_junos_hardware = array(
|
||||
'jnxProductNameM40' => 'M40',
|
||||
'jnxProductNameM20' => 'M20',
|
||||
'jnxProductNameM160' => 'M160',
|
||||
'jnxProductNameM10' => 'M10',
|
||||
'jnxProductNameM5' => 'M5',
|
||||
'jnxProductNameT640' => 'T640',
|
||||
'jnxProductNameT320' => 'T320',
|
||||
'jnxProductNameM40e' => 'M40e',
|
||||
'jnxProductNameM320' => 'M320',
|
||||
'jnxProductNameM7i' => 'M7i',
|
||||
'jnxProductNameM10i' => 'M10i',
|
||||
'jnxProductNameJ2300' => 'J2300',
|
||||
'jnxProductNameJ4300' => 'J4300',
|
||||
'jnxProductNameJ6300' => 'J6300',
|
||||
'jnxProductNameIRM' => 'IRM',
|
||||
'jnxProductNameTX' => 'TX',
|
||||
'jnxProductNameM120' => 'M120',
|
||||
'jnxProductNameJ4350' => 'J4350',
|
||||
'jnxProductNameJ6350' => 'J6350',
|
||||
'jnxProductNameMX960' => 'MX960',
|
||||
'jnxProductNameJ4320' => 'J4320',
|
||||
'jnxProductNameJ2320' => 'J2320',
|
||||
'jnxProductNameJ2350' => 'J2350',
|
||||
'jnxProductNameMX480' => 'MX480',
|
||||
'jnxProductNameSRX5800' => 'SRX5800',
|
||||
'jnxProductNameT1600' => 'T1600',
|
||||
'jnxProductNameSRX5600' => 'SRX5600',
|
||||
'jnxProductNameMX240' => 'MX240',
|
||||
'jnxProductNameEX3200' => 'EX3200',
|
||||
'jnxProductNameEX3300' => 'EX3300',
|
||||
'jnxProductNameEX4200' => 'EX4200',
|
||||
'jnxProductNameEX8208' => 'EX8208',
|
||||
'jnxProductNameEX8216' => 'EX8216',
|
||||
'jnxProductNameSRX3600' => 'SRX3600',
|
||||
'jnxProductNameSRX3400' => 'SRX3400',
|
||||
'jnxProductNameSRX210' => 'SRX210',
|
||||
'jnxProductNameTXP' => 'TXP',
|
||||
'jnxProductNameJCS' => 'JCS',
|
||||
'jnxProductNameSRX240' => 'SRX240',
|
||||
'jnxProductNameSRX650' => 'SRX650',
|
||||
'jnxProductNameSRX100' => 'SRX100',
|
||||
'jnxProductNameESR1000V' => 'ESR1000V',
|
||||
'jnxProductNameEX2200' => 'EX2200',
|
||||
'jnxProductNameEX4500' => 'EX4500',
|
||||
'jnxProductNameFXSeries' => 'FX Series',
|
||||
'jnxProductNameIBM4274M02J02M' => 'IBM4274M02J02M',
|
||||
// ?
|
||||
'jnxProductNameIBM4274M06J06M' => 'IBM4274M06J06M',
|
||||
// ?
|
||||
'jnxProductNameIBM4274M11J11M' => 'IBM4274M11J11M',
|
||||
// ?
|
||||
'jnxProductNameSRX1400' => 'SRX1400',
|
||||
'jnxProductNameIBM4274S58J58S' => 'IBM4274S58J58S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S56J56S' => 'IBM4274S56J56S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S36J36S' => 'IBM4274S36J36S',
|
||||
// ?
|
||||
'jnxProductNameIBM4274S34J34S' => 'IBM4274S34J34S',
|
||||
// ?
|
||||
'jnxProductNameIBM427348EJ48E' => 'IBM427348EJ48E',
|
||||
// ?
|
||||
'jnxProductNameIBM4274E08J08E' => 'IBM4274E08J08E',
|
||||
// ?
|
||||
'jnxProductNameIBM4274E16J16E' => 'IBM4274E16J16E',
|
||||
// ?
|
||||
'jnxProductNameMX80' => 'MX80',
|
||||
'jnxProductName' => '',
|
||||
'jnxProductQFX510048S6Q' => 'QFX5100-48S6Q',
|
||||
);
|
||||
|
||||
|
||||
$hardware = array_str_replace($rewrite_junos_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function rewrite_generic_hardware($hardware)
|
||||
{
|
||||
$rewrite_GenericHW = array(
|
||||
' Computer Corporation' => '',
|
||||
' Corporation' => '',
|
||||
' Inc.' => '',
|
||||
);
|
||||
return array_str_replace($rewrite_GenericHW, $hardware);
|
||||
}
|
||||
|
||||
function fixiftype($type)
|
||||
{
|
||||
$rewrite_iftype = array(
|
||||
'/^frameRelay$/' => 'Frame Relay',
|
||||
'/^ethernetCsmacd$/' => 'Ethernet',
|
||||
'/^softwareLoopback$/' => 'Loopback',
|
||||
@ -909,9 +974,17 @@ $rewrite_iftype = array(
|
||||
'/^aal5$/' => 'ATM AAL5',
|
||||
'/^atmSubInterface$/' => 'ATM Subif',
|
||||
'/^propPointToPointSerial$/' => 'PtP Serial',
|
||||
);
|
||||
);
|
||||
|
||||
$rewrite_ifname = array(
|
||||
$type = array_preg_replace($rewrite_iftype, $type);
|
||||
|
||||
return ($type);
|
||||
}
|
||||
|
||||
|
||||
function fixifName($inf)
|
||||
{
|
||||
$rewrite_ifname = array(
|
||||
'ether' => 'Ether',
|
||||
'gig' => 'Gig',
|
||||
'fast' => 'Fast',
|
||||
@ -930,126 +1003,7 @@ $rewrite_ifname = array(
|
||||
'hp procurve switch software loopback interface' => 'Loopback Interface',
|
||||
'control plane interface' => 'Control Plane',
|
||||
'loop' => 'Loop',
|
||||
);
|
||||
|
||||
$rewrite_hrDevice = array(
|
||||
'GenuineIntel:' => '',
|
||||
'AuthenticAMD:' => '',
|
||||
'Intel(R)' => '',
|
||||
'CPU' => '',
|
||||
'(R)' => '',
|
||||
' ' => ' ',
|
||||
);
|
||||
|
||||
$rewrite_GenericHW = array(
|
||||
' Computer Corporation' => '',
|
||||
' Corporation' => '',
|
||||
' Inc.' => '',
|
||||
);
|
||||
|
||||
// Specific rewrite functions
|
||||
|
||||
|
||||
function makeshortif($if)
|
||||
{
|
||||
global $rewrite_shortif;
|
||||
|
||||
$if = fixifName($if);
|
||||
$if = strtolower($if);
|
||||
$if = array_str_replace($rewrite_shortif, $if);
|
||||
return $if;
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ios_features($features)
|
||||
{
|
||||
global $rewrite_ios_features;
|
||||
|
||||
$type = array_preg_replace($rewrite_ios_features, $features);
|
||||
|
||||
return ($features);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_fortinet_hardware($hardware)
|
||||
{
|
||||
global $rewrite_fortinet_hardware;
|
||||
|
||||
$hardware = $rewrite_fortinet_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_extreme_hardware($hardware)
|
||||
{
|
||||
global $rewrite_extreme_hardware;
|
||||
|
||||
// $hardware = array_str_replace($rewrite_extreme_hardware, $hardware);
|
||||
$hardware = $rewrite_extreme_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ftos_hardware($hardware)
|
||||
{
|
||||
global $rewrite_ftos_hardware;
|
||||
|
||||
$hardware = $rewrite_ftos_hardware[$hardware];
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_ironware_hardware($hardware)
|
||||
{
|
||||
global $rewrite_ironware_hardware;
|
||||
|
||||
$hardware = array_str_replace($rewrite_ironware_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_junose_hardware($hardware)
|
||||
{
|
||||
global $rewrite_junose_hardware;
|
||||
|
||||
$hardware = array_str_replace($rewrite_junose_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
|
||||
function rewrite_junos_hardware($hardware)
|
||||
{
|
||||
global $rewrite_junos_hardware;
|
||||
|
||||
$hardware = array_str_replace($rewrite_junos_hardware, $hardware);
|
||||
|
||||
return ($hardware);
|
||||
}
|
||||
|
||||
function rewrite_generic_hardware($hardware)
|
||||
{
|
||||
global $rewrite_GenericHW;
|
||||
return array_str_replace($rewrite_GenericHW, $hardware);
|
||||
}
|
||||
|
||||
function fixiftype($type)
|
||||
{
|
||||
global $rewrite_iftype;
|
||||
|
||||
$type = array_preg_replace($rewrite_iftype, $type);
|
||||
|
||||
return ($type);
|
||||
}
|
||||
|
||||
|
||||
function fixifName($inf)
|
||||
{
|
||||
global $rewrite_ifname;
|
||||
);
|
||||
|
||||
$inf = strtolower($inf);
|
||||
$inf = array_str_replace($rewrite_ifname, $inf);
|
||||
@ -1060,7 +1014,14 @@ function fixifName($inf)
|
||||
|
||||
function short_hrDeviceDescr($dev)
|
||||
{
|
||||
global $rewrite_hrDevice;
|
||||
$rewrite_hrDevice = array(
|
||||
'GenuineIntel:' => '',
|
||||
'AuthenticAMD:' => '',
|
||||
'Intel(R)' => '',
|
||||
'CPU' => '',
|
||||
'(R)' => '',
|
||||
' ' => ' ',
|
||||
);
|
||||
|
||||
$dev = array_str_replace($rewrite_hrDevice, $dev);
|
||||
$dev = preg_replace('/\ +/', ' ', $dev);
|
||||
@ -1336,7 +1297,9 @@ function rewrite_brocade_fc_switches($descr)
|
||||
return $hardware;
|
||||
}
|
||||
|
||||
$ipmiSensorsNames = array(
|
||||
function ipmiSensorName($hardwareId, $sensorIpmi)
|
||||
{
|
||||
$ipmiSensorsNames = array(
|
||||
"HP ProLiant BL460c G6" => array(
|
||||
"Temp 1" => "Ambient zone",
|
||||
"Temp 2" => "CPU 1",
|
||||
@ -1362,7 +1325,13 @@ $ipmiSensorsNames = array(
|
||||
"Temp 9" => "Ambient zone",
|
||||
"Power Meter" => "Power usage",
|
||||
),
|
||||
);
|
||||
);
|
||||
|
||||
if (isset($ipmiSensorsNames[$hardwareId], $ipmiSensorsNames[$hardwareId][$sensorIpmi])) {
|
||||
return $ipmiSensorsNames[$hardwareId][$sensorIpmi];
|
||||
}
|
||||
return $sensorIpmi;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ceragon_type
|
||||
@ -1401,7 +1370,7 @@ function rewrite_ceraos_hardware($ceragon_type, $device)
|
||||
$hardware = snmp_get($device, 'genEquipInventoryCardName', '-Oqv', 'MWRM-UNIT-NAME');
|
||||
}
|
||||
return $hardware;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $descr
|
||||
|
Reference in New Issue
Block a user