merging - update schema

This commit is contained in:
HenocKA
2016-02-10 07:20:34 +01:00
24 changed files with 2528 additions and 19 deletions
+10
View File
@@ -311,6 +311,16 @@ $config['os'][$os]['icon'] = 'barracuda';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Traffic';
// Calix
$os = 'calix';
$config['os'][$os]['text'] = 'Calix E7';
$config['os'][$os]['type'] = 'network';
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['empty_ifdescr'] = 1;
$config['os'][$os]['icon'] = 'calix';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
// Cisco OSes
$os = 'ios';
$config['os'][$os]['group'] = 'cisco';
+6
View File
@@ -0,0 +1,6 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.6321.1.2.2.5.3')) {
$os = 'calix';
}
}
@@ -0,0 +1,17 @@
<?php
// Netonix Fan Speeds
if ($device['os'] == 'netonix') {
echo 'Netonix: ';
$oids = snmpwalk_cache_multi_oid($device, 'fanTable', array(), 'NETONIX-SWITCH-MIB', '+'.$config['mibdir'].'/netonix');
if (is_array($oids)) {
foreach ($oids as $index => $entry) {
if (is_numeric($entry['fanSpeed']) && is_numeric($index)) {
$descr = $index;
$oid = '.1.3.6.1.4.1.46242.2.1.2.'.$index;
$current = $entry['fanSpeed'];
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, $device['os'], $descr, '1', '1', '0', '0', null, null, $current);
}
}
}
}//end if
@@ -0,0 +1,17 @@
<?php
// Netonix Temperatures
if ($device['os'] == 'netonix') {
echo 'Netonix: ';
$oids = snmpwalk_cache_multi_oid($device, 'tempTable', array(), 'NETONIX-SWITCH-MIB', '+'.$config['mibdir'].'/netonix');
if (is_array($oids)) {
foreach ($oids as $index => $entry) {
if (is_numeric($entry['temp']) && is_numeric($index) && $entry['temp'] > '0') {
$descr = $entry['tempDescription'];
$oid = '.1.3.6.1.4.1.46242.3.1.3.'.$index;
$current = $entry['temp'];
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $device['os'], $descr, '1', '1', null, null, null, null, $current);
}
}
}
}//end if
@@ -0,0 +1,18 @@
<?php
// Netonix Voltages
if ($device['os'] == 'netonix') {
echo 'Netonix: ';
$oids = snmpwalk_cache_multi_oid($device, 'voltageTable', array(), 'NETONIX-SWITCH-MIB', '+'.$config['mibdir'].'/netonix');
if (is_array($oids)) {
foreach ($oids as $index => $entry) {
if (is_numeric($entry['voltage']) && is_numeric($index) && $entry['voltage'] > '0') {
$descr = $entry['voltageDescription'];
$oid = '.1.3.6.1.4.1.46242.4.1.3.'.$index;
$current = $entry['voltage'];
$divisor = 100;
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $device['os'], $descr, $divisor, '1', null, null, null, null, $current);
}
}
}
}//end if
+2 -2
View File
@@ -895,7 +895,7 @@ function is_port_valid($port, $device) {
}
}
}
if (empty($port['ifDescr'])) {
if (empty($port['ifDescr']) && !$config['os'][$device['os']]['empty_ifdescr']) {
$valid = 0;
}
if ($device['os'] == "catos" && strstr($if, "vlan")) {
@@ -1324,7 +1324,7 @@ function oxidized_reload_nodes() {
global $config;
if ($config['oxidized']['enabled'] === TRUE && $config['oxidized']['reload_nodes'] === TRUE && isset($config['oxidized']['url'])) {
$oxidized_reload_url = $config['oxidized']['url'] . '/reload';
$oxidized_reload_url = $config['oxidized']['url'] . '/reload?format=json';
$ch = curl_init($oxidized_reload_url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
+1 -1
View File
@@ -85,7 +85,7 @@ $poll_device['sysLocation'] = str_replace('"', '', $poll_device['sysLocation']);
$poll_device['sysLocation'] = trim($poll_device['sysLocation'], '\\');
// Rewrite sysLocation if there is a mapping array (database too?)
if (!empty($poll_device['sysLocation']) && is_array($config['location_map'])) {
if (!empty($poll_device['sysLocation']) && (is_array($config['location_map']) || is_array($config['location_map_regex']))) {
$poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']);
}
+1 -1
View File
@@ -83,7 +83,7 @@ function poll_sensor($device, $class, $unit) {
$sensor_value = 0;
}
if ($sensor['sensor_divisor']) {
if ($sensor['sensor_divisor'] && $sensor_value !== 0) {
$sensor_value = ($sensor_value / $sensor['sensor_divisor']);
}
+6
View File
@@ -0,0 +1,6 @@
<?php
// Device might not have a card 1 (or even card2 if it is an E7-20)
$version = strtok(snmp_walk($device, "e7CardSoftwareVersion.1", "-OQv", "E7-Calix-MIB"), PHP_EOL);
$hardware = "Calix " . $poll_device['sysDescr'];
$features = str_replace(PHP_EOL, ', ', snmp_walk($device, "e7CardProvType", "-OQv", "E7-Calix-MIB"));
$serial = str_replace(PHP_EOL, ', ', snmp_walk($device, "e7CardSerialNumber", "-OQv", "E7-Calix-MIB"));
+3
View File
@@ -0,0 +1,3 @@
<?php
$version = snmp_get($device, 'firmwareVersion.0', '-OQv', 'NETONIX-SWITCH-MIB', $config['mibdir'].':'.$config['mibdir'].'/netonix');
$hardware = $poll_device['sysDescr'];
+5 -1
View File
@@ -28,7 +28,7 @@ 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 ($poll_device['sysObjectID'] == 'enterprises.311.1.1.3.1.1') {
if (strstr($poll_device['sysDescr'], 'Build Number: 1057')) {
$version = 'NT 3.51 Workstation';
}
@@ -81,6 +81,10 @@ if ($poll_device['sysObjectID'] == '.1.3.6.1.4.1.311.1.1.3.1.1') {
$version = '8.1 SP1 (NT 6.2)';
}
if (strstr($poll_device['sysDescr'], 'Version 6.3 (Build 10')) {
$version = '10 (NT 6.3)';
}
}
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')) {
+9
View File
@@ -5,6 +5,15 @@ function rewrite_location($location) {
// FIXME -- also check the database for rewrites?
global $config, $debug;
if (is_array($config['location_map_regex'])) {
foreach ($config['location_map_regex'] as $reg => $val) {
if (preg_match($reg, $location)) {
$location = $val;
break;
}
}
}
if (isset($config['location_map'][$location])) {
$location = $config['location_map'][$location];
}