1<?php
2
3/**
4 * Observium
5 *
6 *   This file is part of Observium.
7 *
8 * @package    observium
9 * @subpackage discovery
10 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
11 *
12 */
13
14// enterprises.eltek.eltekDistributedPlantV7.acDistribution.acVoltage1.0 = INTEGER: 227
15// enterprises.eltek.eltekDistributedPlantV7.acDistribution.acVoltage2.0 = INTEGER: 227
16// enterprises.eltek.eltekDistributedPlantV7.acDistribution.acVoltage3.0 = INTEGER: 0
17// .1.3.6.1.4.1.12148.9.6.1.0 = 235
18// .1.3.6.1.4.1.12148.9.6.2.0 = 235
19// .1.3.6.1.4.1.12148.9.6.3.0 = 237
20
21$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.1.0', 'descr' => 'AC Voltage 1', 'index' => '1', 'type' => 'acVoltage');
22$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.2.0', 'descr' => 'AC Voltage 2', 'index' => '2', 'type' => 'acVoltage');
23$list[] = array('oid' => '.1.3.6.1.4.1.12148.9.6.3.0', 'descr' => 'AC Voltage 3', 'index' => '3', 'type' => 'acVoltage');
24
25foreach ($list as $entry)
26{
27
28  $value = snmp_get_oid($device, $entry['oid'], 'ELTEK-DISTRIBUTED-MIB');
29
30  if (is_numeric($value))
31  {
32    discover_sensor('voltage', $device, $entry['oid'], $entry['index'], 'eltek-distributed-mib_acVoltage', $entry['descr'], 1, $value);
33  }
34
35}
36
37//    [rectifierStatusID] => 2
38//    [rectifierStatusStatus] => normal
39//    [rectifierStatusOutputCurrent] => 42
40//    [rectifierStatusOutputVoltage] => 5430
41//    [rectifierStatusTemp] => 32
42//    [rectifierStatusType] => FLATPACK2 48/2000 HE
43//    [rectifierStatusSKU] => 241115.105
44//    [rectifierStatusSerialNo] => 1051711xxxx
45//    [rectifierStatusRevisionLevel] => 2.1
46
47//.1.3.6.1.4.1.12148.9.5.5.2.1.1.1 = 2
48//.1.3.6.1.4.1.12148.9.5.5.2.1.2.1 = normal
49//.1.3.6.1.4.1.12148.9.5.5.2.1.3.1 = 42
50//.1.3.6.1.4.1.12148.9.5.5.2.1.4.1 = 5429
51//.1.3.6.1.4.1.12148.9.5.5.2.1.5.1 = 32
52//.1.3.6.1.4.1.12148.9.5.5.2.1.6.1 = FLATPACK2 48/2000 HE
53//.1.3.6.1.4.1.12148.9.5.5.2.1.7.1 = 241115.105
54//.1.3.6.1.4.1.12148.9.5.5.2.1.8.1 = 1051711xxxx
55//.1.3.6.1.4.1.12148.9.5.5.2.1.9.1 = 2.1
56
57$oids = snmpwalk_cache_oid($device, 'rectifierStatusTable', array(), 'ELTEK-DISTRIBUTED-MIB');
58foreach ($oids as $index => $entry)
59{
60  if ($entry['rectifierStatusStatus'] != 'notPresent')
61  {
62    $descr = 'Rectifier '.$entry['rectifierStatusID']. ' ('.$entry['rectifierStatusType'].')';
63    discover_sensor('voltage', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.4.'.$index, $index, 'eltek-distributed-mib_rectifierStatusOutputVoltage', $descr, 0.01, $entry['rectifierStatusOutputVoltage']);
64    discover_sensor('current', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.3.'.$index, $index, 'eltek-distributed-mib_rectifierStatusOutputCurrent', $descr, 0.1, $entry['rectifierStatusOutputCurrent']);
65    discover_sensor('temperature', $device, '.1.3.6.1.4.1.12148.9.5.5.2.1.5.'.$index, $index, 'eltek-distributed-mib_rectifierStatusTemp', $descr, 1, $entry['rectifierStatusTemp']);
66
67    discover_status($device, '.1.3.6.1.4.1.12148.9.5.5.2.1.2.'.$index, 'rectifierStatusStatus.'.$index, 'eltek-distributed-mib_rectifierStatusStatus', $descr, $entry['rectifierStatusStatus']);
68  }
69}
70
71// Note that the units measured may be in Amperes or in Deciamperes depending on global system settings,
72// but snmp output not have attribute for detect scale
73
74// ELTEK-DISTRIBUTED-MIB::batteryCurrent.0 = INTEGER: 1 Amperes or DeciAmperes
75// ELTEK-DISTRIBUTED-MIB::batteryChargeCurrentLimitValue.0 = INTEGER: 20 Amperes or DeciAmperes
76// or
77// ELTEK-DISTRIBUTED-MIB::batteryCurrent.0 = INTEGER: 5 Amperes or DeciAmperes
78// ELTEK-DISTRIBUTED-MIB::batteryChargeCurrentLimitValue.0 = INTEGER: 350 Amperes or DeciAmperes
79
80$limit = snmp_get_oid($device, 'batteryChargeCurrentLimitValue.0', 'ELTEK-DISTRIBUTED-MIB');
81$value = snmp_get_oid($device, 'batteryCurrent.0',                 'ELTEK-DISTRIBUTED-MIB');
82
83$oid      = '.1.3.6.1.4.1.12148.9.3.3.0';
84$oid_name = 'batteryCurrent';
85$descr    = 'Battery Current';
86if ($limit > 100)
87{
88  // Hack for detect scale, not sure if always correct
89  $scale = 0.1;
90  $limit *= $scale;
91} else {
92  $scale = 1;
93}
94
95$options = ['limit_high' => $limit];
96
97discover_sensor_ng($device, 'current', $mib, $oid_name, $oid, '0', NULL, $descr, $scale, $value, $options);
98
99// EOF
100