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$processors_array = snmpwalk_cache_oid($device, 'cpmCPU', array(), $mib);
15
16foreach ($processors_array as $index => $entry)
17{
18  if (is_numeric($entry['cpmCPUTotal5minRev']) || is_numeric($entry['cpmCPUTotal5min']))
19  {
20    $entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex'];
21
22    if (isset($entry['cpmCPUTotal5minRev']))
23    {
24      $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8.$index";
25      $usage = $entry['cpmCPUTotal5minRev'];
26    } elseif (isset($entry['cpmCPUTotal5min'])) {
27      $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5.$index";
28      $usage = $entry['cpmCPUTotal5min'];
29    }
30
31    if ($entPhysicalIndex)
32    {
33      $descr_oid = 'entPhysicalName.' . $entPhysicalIndex;
34      $descr = snmp_get($device, $descr_oid, '-Oqv', 'ENTITY-MIB');
35    }
36    if (!$descr) { $descr = "Processor $index"; }
37
38    if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '')
39    {
40      discover_processor($valid['processor'], $device, $usage_oid, $index, 'cpm', $descr, 1, $usage, $entPhysicalIndex);
41    }
42  }
43}
44
45if (!is_array($valid['processor']['cpm']))
46{
47  // OLD-CISCO-CPU-MIB::avgBusy5
48  $avgBusy5 = snmp_get($device, '.1.3.6.1.4.1.9.2.1.58.0', '-Oqv');
49  if (is_numeric($avgBusy5))
50  {
51    discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.9.2.1.58.0', 0, 'ios', 'Processor', 1, $avgBusy5);
52  }
53}
54
55unset($processors_array);
56
57// EOF
58