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//AXIS-VIDEO-MIB::tempSensorStatus.common.1 = INTEGER: ok(1)
15//AXIS-VIDEO-MIB::tempSensorStatus.common.2 = INTEGER: ok(1)
16//AXIS-VIDEO-MIB::tempSensorValue.common.1 = INTEGER: 26
17//AXIS-VIDEO-MIB::tempSensorValue.common.2 = INTEGER: 32
18//AXIS-VIDEO-MIB::storageName.1 = STRING: SD_DISK
19//AXIS-VIDEO-MIB::storageName.2 = STRING: NetworkShare
20//AXIS-VIDEO-MIB::storageDisruptionDetected.1 = INTEGER: no(1)
21//AXIS-VIDEO-MIB::storageDisruptionDetected.2 = INTEGER: yes(2)
22
23$mib = 'AXIS-VIDEO-MIB';
24
25// Temperature Sensor
26$oids = snmpwalk_cache_oid($device, 'tempSensorEntry', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
27print_debug_vars($oids);
28
29foreach ($oids as $index => $entry)
30{
31  //if ($entry['tempSensorStatus'] == 'failure') { continue; } // ok(1), failure(2), outOfBoundary(3)
32
33  // common(1), housing(2), rack(3), cpu(4)
34  list($tempSensorType, $tempSensorId) = explode('.', $index);
35  switch ($tempSensorType)
36  {
37    case '1':
38      $descr = 'System temperature';
39      break;
40    case '2':
41      $descr = 'Housing temperature';
42      break;
43    case '3':
44      $descr = 'Rack temperature';
45      break;
46    case '4':
47      $descr = 'CPU temperature';
48      break;
49    default:
50      $descr = 'Temperature';
51  }
52  if (count($oids) > 1)
53  {
54    $descr .= ' ' . $tempSensorId;
55  }
56
57  $scale      = 1;
58  $oid_name   = 'tempSensorValue';
59  $oid_num    = '.1.3.6.1.4.1.368.4.1.3.1.4.'.$index;
60  $value      = $entry[$oid_name];
61
62  if ($value <= 0) { continue; }
63
64
65  discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
66
67  $oid_name = 'tempSensorStatus';
68  $oid_num  = '.1.3.6.1.4.1.368.4.1.3.1.3.'.$index;
69  $type     = 'axisStatus';
70  $value    = $entry[$oid_name];
71
72  discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
73}
74
75// Fan Sensor
76$oids = snmpwalk_cache_oid($device, 'fanEntry', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
77print_debug_vars($oids);
78
79foreach ($oids as $index => $entry)
80{
81  // common(1), housing(2), rack(3), cpu(4)
82  list($SensorType, $SensorId) = explode('.', $index);
83  switch ($SensorType)
84  {
85    case '1':
86      $descr = 'System fan';
87      break;
88    case '2':
89      $descr = 'Housing fan';
90      break;
91    case '3':
92      $descr = 'Rack fan';
93      break;
94    case '4':
95      $descr = 'CPU fan';
96      break;
97    default:
98      $descr = 'Fan';
99  }
100  if (count($oids) > 1)
101  {
102    $descr .= ' ' . $SensorId;
103  }
104
105  $oid_name = 'fanStatus';
106  $oid_num  = '.1.3.6.1.4.1.368.4.1.2.1.3.'.$index;
107  $type     = 'axisStatus';
108  $value    = $entry[$oid_name];
109
110  discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'fan'));
111}
112
113// EOF
114