mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add Avtech switch support
This commit is contained in:
@ -770,6 +770,30 @@ function avtech_add_sensor($device, $sensor) {
|
||||
$type = $sensor['type'] ? $sensor['type'] : 'temperature';
|
||||
d_echo('Sensor type: ' . $type . "\n");
|
||||
|
||||
if ($type == 'switch') {
|
||||
// set up state sensor
|
||||
$type = 'state';
|
||||
$state_name = 'avtachSwitchState';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id) {
|
||||
$states = array(
|
||||
array($state_index_id,'off',0,0,-1),
|
||||
array($state_index_id,'on',0,1,0),
|
||||
);
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the description
|
||||
if ($sensor['descr_oid']) {
|
||||
@ -814,6 +838,11 @@ function avtech_add_sensor($device, $sensor) {
|
||||
|
||||
// add the sensor
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $id, $device['os'], $descr, $divisor, '1', $min, null, null, $max, $value/$divisor);
|
||||
|
||||
if ($type == 'state') {
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
18
includes/discovery/sensors/states/avtech.inc.php
Normal file
18
includes/discovery/sensors/states/avtech.inc.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
// AVTECH TEMPPAGER/ROOMALERT
|
||||
if ($device['os'] == 'avtech') {
|
||||
echo 'AVTECH: ';
|
||||
if (strpos($device['sysObjectID'], '.20916.1.9') !== false) {
|
||||
// RoomAlert 3E
|
||||
$device_oid = '.1.3.6.1.4.1.20916.1.9.';
|
||||
|
||||
$switch = array(
|
||||
'id' => 2,
|
||||
'type' => 'switch',
|
||||
'oid' => $device_oid.'1.2.1.0',
|
||||
'descr_oid' => $device_oid.'1.2.2.0',
|
||||
);
|
||||
avtech_add_sensor($device, $switch);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// AVTECH TEMPPAGER
|
||||
// AVTECH TEMPPAGER/ROOMALERT
|
||||
if ($device['os'] == 'avtech') {
|
||||
echo 'AVTECH: ';
|
||||
if (strpos($device['sysObjectID'], '.20916.1.7') !== false) {
|
||||
@ -45,14 +45,6 @@ if ($device['os'] == 'avtech') {
|
||||
'descr_oid' => $device_oid.'1.1.2.6.0',
|
||||
);
|
||||
avtech_add_sensor($device, $sen1);
|
||||
|
||||
// $switch = array(
|
||||
// 'id' => 2,
|
||||
// 'type' => 'state',
|
||||
// 'oid' => $device_oid.'1.2.1.0',
|
||||
// 'descr_oid' => $device_oid.'1.2.2.0',
|
||||
// );
|
||||
// avtech_add_sensor($device, $switch);
|
||||
}
|
||||
elseif (strpos($device['sysObjectID'], '.20916.1.1') !== false) {
|
||||
// TemPageR 4E
|
||||
|
Reference in New Issue
Block a user