diff --git a/includes/discovery/processors-hrdevice.inc.php b/includes/discovery/processors-hrdevice.inc.php deleted file mode 100755 index 2cc08c72c3..0000000000 --- a/includes/discovery/processors-hrdevice.inc.php +++ /dev/null @@ -1,48 +0,0 @@ - $entry) - { - if ($entry['hrDeviceType'] == "hrDeviceProcessor") - { - $hrDeviceIndex = $entry['hrDeviceIndex']; - - $usage_oid = ".1.3.6.1.2.1.25.3.3.1.2." . $index; - $usage = $entry['hrProcessorLoad']; - - $descr = $entry['hrDeviceDescr']; - - $descr_array = explode(":",$entry['hrDeviceDescr']); - - if($descr_array['1']) { $descr = $descr_array['1']; } else { $descr = $descr_array['0']; } - - $descr = str_replace("CPU ", "", $descr); - $descr = str_replace("(TM)", "", $descr); - $descr = str_replace("(R)", "", $descr); - - - $old_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("hrProcessor-" . $index . ".rrd"); - $new_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-hr-" . $index . ".rrd"); - - if($debug) { echo("$old_rrd $new_rrd"); } - if (is_file($old_rrd)) { - rename($old_rrd,$new_rrd); - echo("Moved RRD "); - } - if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" && $descr != "An electronic chip that makes the computer work.") - { - discover_processor($valid_processor, $device, $usage_oid, $index, "hr", $descr, "1", $usage, NULL, $hrDeviceIndex); - } - } - } - } - ## End hrDevice Processors - unset ($processors_array); - - -?> diff --git a/includes/discovery/processors-ironware.inc.php b/includes/discovery/processors-ironware.inc.php deleted file mode 100755 index 979a007535..0000000000 --- a/includes/discovery/processors-ironware.inc.php +++ /dev/null @@ -1,45 +0,0 @@ - $entry) - { - if (($entry['snAgentCpuUtilValue'] || $entry['snAgentCpuUtil100thPercent']) && $entry['snAgentCpuUtilInterval'] == "300") - { - #$entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex']; - - if($entry['snAgentCpuUtil100thPercent']) { - $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.6." . $index; - $usage = $entry['snAgentCpuUtil100thPercent']; - $precision = 100; - } elseif($entry['snAgentCpuUtilValue']) { - $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index; - $usage = $entry['snAgentCpuUtilValue']; - $precision = 100; - } - - list($slot, $instance, $interval) = explode(".", $index); - - $descr_oid = "snAgentConfigModuleDescription." . $entry['snAgentCpuUtilSlotNum']; - $descr = snmp_get($device, $descr_oid, "-Oqv", "FOUNDRY-SN-AGENT-MIB"); - $descr = str_replace("\"", "", $descr); - list($descr) = explode(" ", $descr); - - $descr = "Slot " . $entry['snAgentCpuUtilSlotNum'] . " " . $descr; - $descr = $descr . " [".$instance."]"; - - if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) - { - discover_processor($valid_processor, $device, $usage_oid, $index, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL); - } - } - } - } - ## End Ironware Processors - - unset ($processors_array); - -?> diff --git a/includes/discovery/processors-junose.inc.php b/includes/discovery/processors-junose.inc.php deleted file mode 100755 index 153d65303d..0000000000 --- a/includes/discovery/processors-junose.inc.php +++ /dev/null @@ -1,27 +0,0 @@ - $entry) { - if ($entry['juniSystemModuleCpuUtilPct'] && $entry['juniSystemModuleCpuUtilPct'] != "-1") { - $entPhysicalIndex = $entry['juniSystemModulePhysicalIndex']; - $usage_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.3." . $index; - $descr_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.6." . $index; - $descr = $entry['juniSystemModuleDescr']; - $usage = $entry['juniSystemModuleCpuFiveMinAvgPct']; - - if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { - discover_processor($valid_processor, $device, $usage_oid, $index, "junose", $descr, "1", $usage, $entPhysicalIndex, NULL); - } - } - } - } ## End JUNOSe Processors - - unset ($processors_array); - -?> diff --git a/includes/discovery/processors-ucd-old.inc.php b/includes/discovery/processors-ucd-old.inc.php index 62ba3e3b6b..5f0138a611 100644 --- a/includes/discovery/processors-ucd-old.inc.php +++ b/includes/discovery/processors-ucd-old.inc.php @@ -1,8 +1,9 @@ diff --git a/includes/discovery/processors.inc.php b/includes/discovery/processors.inc.php index df90705d18..9bfdac11be 100755 --- a/includes/discovery/processors.inc.php +++ b/includes/discovery/processors.inc.php @@ -2,11 +2,7 @@ echo("Processors : "); -include("processors-ios.inc.php"); -include("processors-junose.inc.php"); -include("processors-junos.inc.php"); -include("processors-hrdevice.inc.php"); -include("processors-ironware.inc.php"); +include_dir("includes/discovery/processors"); ## Last-resort discovery here diff --git a/includes/discovery/processors/processors-hrdevice.inc.php b/includes/discovery/processors/processors-hrdevice.inc.php new file mode 100755 index 0000000000..5654540f8b --- /dev/null +++ b/includes/discovery/processors/processors-hrdevice.inc.php @@ -0,0 +1,47 @@ + $entry) + { + if ($entry['hrDeviceType'] == "hrDeviceProcessor") + { + $hrDeviceIndex = $entry['hrDeviceIndex']; + + $usage_oid = ".1.3.6.1.2.1.25.3.3.1.2." . $index; + $usage = $entry['hrProcessorLoad']; + + $descr = $entry['hrDeviceDescr']; + + $descr_array = explode(":",$entry['hrDeviceDescr']); + + if($descr_array['1']) { $descr = $descr_array['1']; } else { $descr = $descr_array['0']; } + + $descr = str_replace("CPU ", "", $descr); + $descr = str_replace("(TM)", "", $descr); + $descr = str_replace("(R)", "", $descr); + + + $old_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("hrProcessor-" . $index . ".rrd"); + $new_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-hr-" . $index . ".rrd"); + + if($debug) { echo("$old_rrd $new_rrd"); } + if (is_file($old_rrd)) { + rename($old_rrd,$new_rrd); + echo("Moved RRD "); + } + if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" && $descr != "An electronic chip that makes the computer work.") + { + discover_processor($valid_processor, $device, $usage_oid, $index, "hr", $descr, "1", $usage, NULL, $hrDeviceIndex); + } + } + } +} +## End hrDevice Processors + +?> diff --git a/includes/discovery/processors-ios.inc.php b/includes/discovery/processors/processors-ios.inc.php similarity index 85% rename from includes/discovery/processors-ios.inc.php rename to includes/discovery/processors/processors-ios.inc.php index 7820b3d4d1..9c511df610 100755 --- a/includes/discovery/processors-ios.inc.php +++ b/includes/discovery/processors/processors-ios.inc.php @@ -1,11 +1,13 @@ $entry) + foreach ($processors_array[$device['device_id']] as $index => $entry) { if ($entry['cpmCPUTotal5minRev'] || $entry['cpmCPUTotal5min']) { @@ -27,7 +29,8 @@ if($device['os'] == "ios" || $device['os_group'] == "ios") $new_rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-cpm-" . $index . ".rrd"); if($debug) { echo("$old_rrd $new_rrd"); } - if (is_file($old_rrd)) { + if (is_file($old_rrd)) + { shell_exec("mv -f $old_rrd $new_rrd"); echo("Moved RRD "); } @@ -38,9 +41,11 @@ if($device['os'] == "ios" || $device['os_group'] == "ios") } } } - if(!is_array($valid_processor['cpm'])) { + if (!is_array($valid_processor['cpm'])) + { $avgBusy5 = snmp_get($device, ".1.3.6.1.4.1.9.2.1.58.0", "-Oqv"); - if(is_numeric($avgBusy5)) { + if (is_numeric($avgBusy5)) + { discover_processor($valid_processor, $device, ".1.3.6.1.4.1.9.2.1.58.0", "0", "ios", "Processor", "1", $avgBusy5, NULL, NULL); } } diff --git a/includes/discovery/processors/processors-ironware.inc.php b/includes/discovery/processors/processors-ironware.inc.php new file mode 100755 index 0000000000..bdc68426b0 --- /dev/null +++ b/includes/discovery/processors/processors-ironware.inc.php @@ -0,0 +1,47 @@ + $entry) + { + if (($entry['snAgentCpuUtilValue'] || $entry['snAgentCpuUtil100thPercent']) && $entry['snAgentCpuUtilInterval'] == "300") + { + #$entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex']; + + if($entry['snAgentCpuUtil100thPercent']) { + $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.6." . $index; + $usage = $entry['snAgentCpuUtil100thPercent']; + $precision = 100; + } elseif($entry['snAgentCpuUtilValue']) { + $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index; + $usage = $entry['snAgentCpuUtilValue']; + $precision = 100; + } + + list($slot, $instance, $interval) = explode(".", $index); + + $descr_oid = "snAgentConfigModuleDescription." . $entry['snAgentCpuUtilSlotNum']; + $descr = snmp_get($device, $descr_oid, "-Oqv", "FOUNDRY-SN-AGENT-MIB"); + $descr = str_replace("\"", "", $descr); + list($descr) = explode(" ", $descr); + + $descr = "Slot " . $entry['snAgentCpuUtilSlotNum'] . " " . $descr; + $descr = $descr . " [".$instance."]"; + + if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") + { + discover_processor($valid_processor, $device, $usage_oid, $index, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL); + } + } + } +} +## End Ironware Processors + +unset ($processors_array); + +?> diff --git a/includes/discovery/processors-junos.inc.php b/includes/discovery/processors/processors-junos.inc.php similarity index 73% rename from includes/discovery/processors-junos.inc.php rename to includes/discovery/processors/processors-junos.inc.php index 14df426649..147fcde564 100755 --- a/includes/discovery/processors-junos.inc.php +++ b/includes/discovery/processors/processors-junos.inc.php @@ -1,5 +1,7 @@ $entry) { - if($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) { + if (is_array($processors_array[$device['device_id']])) + { + foreach ($processors_array[$device['device_id']] as $index => $entry) + { + if ($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) + { if ($debug) { echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingCPU'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n"); } $usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index; $descr = $entry['jnxOperatingDescr']; $usage = $entry['jnxOperatingCPU']; - if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { + if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) + { discover_processor($valid_processor, $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL); } } ## End if checks @@ -24,6 +30,6 @@ if($device['os'] == "junos") } ## End if array } ## End JUNOS Processors - unset ($processors_array); +unset ($processors_array); ?> diff --git a/includes/discovery/processors/processors-junose.inc.php b/includes/discovery/processors/processors-junose.inc.php new file mode 100755 index 0000000000..9ef29f8952 --- /dev/null +++ b/includes/discovery/processors/processors-junose.inc.php @@ -0,0 +1,32 @@ + $entry) + { + if ($entry['juniSystemModuleCpuUtilPct'] && $entry['juniSystemModuleCpuUtilPct'] != "-1") + { + $entPhysicalIndex = $entry['juniSystemModulePhysicalIndex']; + $usage_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.3." . $index; + $descr_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.6." . $index; + $descr = $entry['juniSystemModuleDescr']; + $usage = $entry['juniSystemModuleCpuFiveMinAvgPct']; + + if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) + { + discover_processor($valid_processor, $device, $usage_oid, $index, "junose", $descr, "1", $usage, $entPhysicalIndex, NULL); + } + } + } +} ## End JUNOSe Processors + +unset ($processors_array); + +?>