mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Added detection for Hirschmann Railswitch * Update AUTHORS.md I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. * Fixes for PR 6207 requested changes * Fixes for PR 6207 requested changes * Fixes for PR 6207 requested changes * Fix for PR 6207 requested changes * Fix for PR 6207 requested changes * Fix for PR 6207 requested changes (old states and temperatures directories removal) * fix for PR 6207 : state fileupdated
This commit is contained in:
@@ -190,7 +190,6 @@ LibreNMS contributors:
|
||||
- Ryan Medlyn <ryan.medlyn@gmail.com> (rmedlyn)
|
||||
- Mark Hughes <m@rkhugh.es> (markehme)
|
||||
- Mark Abrahams <mark@abrahams.co.nz> (markabrahams)
|
||||
- Klaas Tammling <klaas@tammling.hamburg> (KlaasT)
|
||||
- Simon Mott <me@simonmott.co.uk> (tsumaru720)
|
||||
|
||||
Observium was written by:
|
||||
|
1
html/images/logos/hirschmann.svg
Normal file
1
html/images/logos/hirschmann.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.7 KiB |
4
html/images/os/hirschmann.svg
Normal file
4
html/images/os/hirschmann.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32.136692">
|
||||
<path d="M19.263 3.12c-.782.8-2.076 2.496-3.13 1.57.216-.83.898-2.86-.275-1.32-.717.58-1.237 1.767-2.305 1.544-1.6.514.44-2.348-.366-2.067l-2.91 2.922c-.275 1.29-2.593.302-3.703.602-1.545.04 1.17.968 1.655 1.416 1 .17.776 1.054.783 1.803v16.87c-.914.493-2.584 1.402-.726 1.162h3.737c.076-3.12-.104-6.26.145-9.37.448-2.47 3.194-4.02 5.57-3.368 2.108.478 3.773 2.552 3.505 4.748-.02 2.25-.002 4.5-.008 6.75-.893.527-2.537 1.495-.684 1.24h3.697c-.058-3.283.123-6.58-.104-9.855-.566-3.59-4.472-6.032-7.963-5.21-1.713.3-3.13 1.446-4.144 2.788-.08-2.48-.014-5.03-.036-7.538.366-.5 2.216-1.754.45-1.452-1.022-.348 1.43-.168 1.832-.212 2.636-.004 5.272.003 7.908 0l.93-3.662c-.93.73-1.596 2.03-2.705 2.387-1.543.392-.993-.83-.638-1.9.246-.92-.303.056-.52.154z" fill="#004990"/>
|
||||
<path d="M1.13 16.072C1.04 9.718 5.484 3.632 11.584 1.816 17.2-.014 23.786 1.952 27.47 6.58c4.006 4.722 4.514 11.98 1.243 17.228-3.01 5.136-9.3 8.047-15.158 6.99-6.267-.96-11.484-6.36-12.28-12.64-.097-.69-.145-1.39-.145-2.086zm-1.13 0C-.085 22.445 4.044 28.59 9.96 30.948c5.68 2.41 12.678 1.073 17.074-3.253 4.518-4.22 6.17-11.148 4.06-16.955C29.054 4.734 23.173.274 16.82.03 10.65-.37 4.5 3.24 1.754 8.766.6 11.016-.002 13.543 0 16.072z" fill="#004990"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
11
includes/definitions/hirschmann.yaml
Normal file
11
includes/definitions/hirschmann.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
os: hirschmann
|
||||
text: 'Hirschmann Railswitch'
|
||||
type: network
|
||||
icon: hirschmann
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
- { graph: device_processor, text: 'CPU Usage' }
|
||||
- { graph: device_mempool, text: 'Memory Usage' }
|
||||
discovery:
|
||||
- sysObjectId:
|
||||
- .1.3.6.1.4.1.248.14.10.41
|
10
includes/discovery/mempools/hirschmann.inc.php
Normal file
10
includes/discovery/mempools/hirschmann.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
$mem_allocated = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmMemoryAllocated.0', '-OvQ');
|
||||
$mem_free = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmMemoryFree.0', '-OvQ');
|
||||
$usage = $mem_allocated / ($mem_allocated + $mem_free);
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_mempool($valid_mempool, $device, 0, 'hirschmann-mem', 'Main Memory', '100', null, null);
|
||||
}
|
||||
}
|
12
includes/discovery/processors/hirschmann.inc.php
Normal file
12
includes/discovery/processors/hirschmann.inc.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
echo 'Hirschmann : ';
|
||||
$descr = 'Processor';
|
||||
$usage = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmCpuUtilization.0', '-OvqU');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, 'HMPRIV-MGMT-SNMP-MIB::hmCpuUtilization.0', '0', 'hirschmann', $descr, '1', $usage, null, null);
|
||||
}
|
||||
}
|
||||
unset($processors_array);
|
203
includes/discovery/sensors/state/hirschmann.inc.php
Normal file
203
includes/discovery/sensors/state/hirschmann.inc.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
///////////////////////////
|
||||
/// Power Supply Status ///
|
||||
///////////////////////////
|
||||
$oid = snmpwalk_cache_multi_oid($device, 'hmPSTable', array(), 'HMPRIV-MGMT-SNMP-MIB');
|
||||
$cur_oid = '.1.3.6.1.4.1.248.14.1.2.1.3.';
|
||||
|
||||
if (is_array($oid)) {
|
||||
//Create State Index
|
||||
$state_name = 'hmPowerSupplyStatus';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'ok',0,1,0) ,
|
||||
array($state_index_id,'failed',0,2,2) ,
|
||||
array($state_index_id,'notInstalled',0,3,1) ,
|
||||
array($state_index_id,'unknown',0,4,3)
|
||||
);
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($oid as $index => $entry) {
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, 'hmPowerSupplyStatus'.$index, $state_name, 'Power Supply '.$oid[$index]['hmPSID'], '1', '1', null, null, null, null, $oid[$index]['hmPowerSupplyStatus'], 'snmp', 'hmPowerSupplyStatus'.$index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, 'hmPowerSupplyStatus'.$index);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
/// LED Status Power Supply ///
|
||||
///////////////////////////////
|
||||
$temp = snmp_get($device, "hmLEDRSPowerSupply.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.1.0';
|
||||
$index = '0';
|
||||
|
||||
if (is_numeric($temp)) {
|
||||
//Create State Index
|
||||
$state_name = 'hmLEDRSPowerSupply';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'off',0,1,0) ,
|
||||
array($state_index_id,'green',0,2,0) ,
|
||||
array($state_index_id,'yellow',0,3,1) ,
|
||||
array($state_index_id,'red',0,4,2)
|
||||
);
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = 'LED Status Power Supply';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSPowerSupply.'.$index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', 'hmLEDRSPowerSupply.'.$index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, 'hmLEDRSPowerSupply.'.$index);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
/// LED Status Standby ///
|
||||
//////////////////////////
|
||||
$temp = snmp_get($device, "hmLEDRStandby.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.2.0';
|
||||
$index = '0';
|
||||
|
||||
if (is_numeric($temp)) {
|
||||
//Create State Index
|
||||
$state_name = 'hmLEDRStandby';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'off',0,1,0) ,
|
||||
array($state_index_id,'green',0,2,0) ,
|
||||
array($state_index_id,'yellow',0,3,1) ,
|
||||
array($state_index_id,'red',0,4,2)
|
||||
);
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = 'LED Status Standby';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRStandby.'.$index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', 'hmLEDRStandby.'.$index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, 'hmLEDRStandby.'.$index);
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// LED Status Redundancy Manager ///
|
||||
/////////////////////////////////////
|
||||
$temp = snmp_get($device, "hmLEDRSRedundancyManager.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.3.0';
|
||||
$index = '0';
|
||||
|
||||
if (is_numeric($temp)) {
|
||||
//Create State Index
|
||||
$state_name = 'hmLEDRSRedundancyManager';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'off',0,1,0) ,
|
||||
array($state_index_id,'green',0,2,0) ,
|
||||
array($state_index_id,'yellow',0,3,1) ,
|
||||
array($state_index_id,'red',0,4,2)
|
||||
);
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = 'LED Status Redundancy Manager';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSRedundancyManager.'.$index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', 'hmLEDRSRedundancyManager.'.$index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, 'hmLEDRSRedundancyManager.'.$index);
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
/// LED Status Fault ///
|
||||
////////////////////////
|
||||
$temp = snmp_get($device, "hmLEDRSFault.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.4.0';
|
||||
$index = '0';
|
||||
|
||||
if (is_numeric($temp)) {
|
||||
//Create State Index
|
||||
$state_name = 'hmLEDRSFault';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'off',0,1,0) ,
|
||||
array($state_index_id,'green',0,2,0) ,
|
||||
array($state_index_id,'yellow',0,3,1) ,
|
||||
array($state_index_id,'red',0,4,2)
|
||||
);
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = 'LED Status Fault';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSFault.'.$index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', 'hmLEDRSFault.'.$index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, 'hmLEDRSFault.'.$index);
|
||||
}
|
||||
}
|
31
includes/discovery/sensors/temperature/hirschmann.inc.php
Normal file
31
includes/discovery/sensors/temperature/hirschmann.inc.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
echo 'Hirschmann Device: ';
|
||||
|
||||
$descr = 'Temperature';
|
||||
$temperature = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0', '-Oqv');
|
||||
$temperature_high = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTempUprLimit.0', '-Oqv');
|
||||
$temperature_low = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTempLwrLimit.0', '-Oqv');
|
||||
$temperature_low_warn = $temperature_low + 10;
|
||||
$temperature_high_warn = $temperature_high - 10;
|
||||
|
||||
if ($descr != '' && is_numeric($temperature)) {
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'temperature',
|
||||
$device,
|
||||
'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0',
|
||||
'1',
|
||||
'hirschmann',
|
||||
$descr,
|
||||
'1',
|
||||
'1',
|
||||
$temperature_low,
|
||||
$temperature_low_warn,
|
||||
$temperature_high_warn,
|
||||
$temperature_high,
|
||||
$temperature
|
||||
);
|
||||
}
|
||||
}
|
14
includes/polling/mempools/hirschmann.inc.php
Normal file
14
includes/polling/mempools/hirschmann.inc.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
$mem_allocated = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmMemoryAllocated.0', '-OvQU');
|
||||
$mem_free = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmMemoryFree.0', '-OvQU');
|
||||
$perc = $mem_allocated / ($mem_allocated + $mem_free) * 100;
|
||||
|
||||
$mempool['perc'] = $perc;
|
||||
$mempool['total'] = ($mem_allocated + $mem_free);
|
||||
$mempool['used'] = $mem_allocated;
|
||||
$mempool['free'] = $mem_free;
|
||||
|
||||
echo '(U: '.$mempool['used'].' T: '.$mempool['total'].' F: '.$mempool['free'].') ';
|
||||
}
|
7
includes/polling/os/hirschmann.inc.php
Normal file
7
includes/polling/os/hirschmann.inc.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$hardware = snmp_get($device, "hmPNIOOrderID.0", "-OQv", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$version = snmp_get($device, "hmPNIOSoftwareRelease.0", "-OQv", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$serial = snmp_get($device, "hmSysGroupSerialNum.1", "-OQv", "HMPRIV-MGMT-SNMP-MIB");
|
||||
$hostname = snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB");
|
||||
$cpu_usage = snmp_get($device, "hmCpuUtilization.0", "-OQv", "HMPRIV-MGMT-SNMP-MIB");
|
3
includes/polling/processors/hirschmann.inc.php
Normal file
3
includes/polling/processors/hirschmann.inc.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$proc = snmp_get($device, "HMPRIV-MGMT-SNMP-MIB::hmCpuUtilization.0", "-OvqU");
|
7
includes/polling/sensors/temperature/hirschmann.inc.php
Normal file
7
includes/polling/sensors/temperature/hirschmann.inc.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'hirschmann') {
|
||||
echo 'Hirschmann Device: ';
|
||||
|
||||
$sensor_value = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0', '-Oqv');
|
||||
}
|
10069
mibs/hirschmann/hmpriv.mib
Normal file
10069
mibs/hirschmann/hmpriv.mib
Normal file
File diff suppressed because it is too large
Load Diff
@@ -809,6 +809,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->checkOS('hikvision');
|
||||
}
|
||||
|
||||
public function testHirschmann()
|
||||
{
|
||||
$this->checkOS('hirschmann');
|
||||
}
|
||||
|
||||
public function testHp3par()
|
||||
{
|
||||
$this->checkOS('informos');
|
||||
|
2
tests/snmpsim/hirschmann.snmprec
Normal file
2
tests/snmpsim/hirschmann.snmprec
Normal file
@@ -0,0 +1,2 @@
|
||||
1.3.6.1.2.1.1.1.0|4|Hirschmann Railswitch
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.248.14.10.41
|
Reference in New Issue
Block a user