Merge branch 'master' of github.com:laf/librenms into issue-803

This commit is contained in:
laf
2015-04-22 10:52:58 +01:00
81 changed files with 22897 additions and 1907 deletions
+18 -2
View File
@@ -71,6 +71,22 @@ function GetRules($device) {
return dbFetchRows('SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE alert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ? ) || alert_map.target = ? '.$where.' )',$params);
}
/**
* Check if device is under maintenance
* @param int $device Device-ID
* @return int
*/
function IsMaintenance( $device ) {
$groups = GetGroupsFromDevice($device);
$params = array($device);
$where = "";
foreach( $groups as $group ) {
$where .= " || alert_schedule_items.target = ?";
$params[] = 'g'.$group;
}
return dbFetchCell('SELECT DISTINCT(alert_schedule.schedule_id) FROM alert_schedule LEFT JOIN alert_schedule_items ON alert_schedule.schedule_id=alert_schedule_items.schedule_id WHERE ( alert_schedule_items.target = ?'.$where.' ) && NOW() BETWEEN alert_schedule.start AND alert_schedule.end LIMIT 1',$params);
}
/**
* Run all rules for a device
* @param int $device Device-ID
@@ -78,8 +94,8 @@ function GetRules($device) {
*/
function RunRules($device) {
global $debug;
$chk = dbFetchRow("SELECT id FROM alert_schedule WHERE alert_schedule.device_id = ? AND NOW() BETWEEN alert_schedule.start AND alert_schedule.end", array($device));
if( $chk['id'] > 0 ) {
if( IsMaintenance($device) > 0 ) {
echo "Under Maintenance, Skipping alerts.\r\n";
return false;
}
foreach( GetRules($device) as $rule ) {
+6
View File
@@ -252,6 +252,9 @@ $config['graph_colours']['blues'] = array('A0A0E5','8080BD','606096','40406F',
$config['graph_colours']['purples'] = array('CC7CCC','AF63AF','934A93','773177','5B185B','3F003F');
$config['graph_colours']['default'] = $config['graph_colours']['blues'];
// Map colors
$config['map_legend'] = array('0'=> '#aeaeae', '10' => '#79847e', '20' => '#97ffca', '30' => '#a800ff', '40' => '#6c00ff', '50' => '#00d2ff', '60' => '#0090ff', '70' => '#ffe400', '80' => '#ffa200', '90' => '#ff6600', '100' => '#ff0000');
// Device page options
$config['show_overview_tab'] = TRUE;
@@ -603,4 +606,7 @@ $config['distributed_poller_memcached_port'] = '11211';
$config['callback_post'] = 'https://stats.librenms.org/log.php';
$config['callback_clear'] = 'https://stats.librenms.org/clear.php';
// Stat graphs
$config['alert_graph_date_format'] = '%Y-%m-%d %H:%i';
?>
+17
View File
@@ -140,6 +140,18 @@ $config['os'][$os]['over'][1]['text'] = "Processor Usage";
$config['os'][$os]['over'][2]['graph'] = "device_mempool";
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "procera";
$config['os'][$os]['type'] = "network";
$config['os'][$os]['group'] = "unix";
$config['os'][$os]['text'] = "Procera Networks";
$config['os'][$os]['icon'] = "linux";
$config['os'][$os]['over'][0]['graph'] = "device_bits";
$config['os'][$os]['over'][0]['text'] = "Device Traffic";
$config['os'][$os]['over'][1]['graph'] = "device_processor";
$config['os'][$os]['over'][1]['text'] = "Processor Usage";
$config['os'][$os]['over'][2]['graph'] = "device_mempool";
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
// Other Unix-based OSes here please.
$os = "freebsd";
@@ -1054,6 +1066,11 @@ $config['os'][$os]['text'] = "Cambium";
$config['os'][$os]['type'] = "wireless";
$config['os'][$os]['icon'] = "cambium";
$os = "datacom";
$config['os'][$os]['text'] = "Datacom";
$config['os'][$os]['type'] = "network";
$config['os'][$os]['icon'] = "datacom";
foreach ($config['os'] as $this_os => $blah)
{
if (isset($config['os'][$this_os]['group']))
+8 -9
View File
@@ -25,9 +25,10 @@
/**
* Generate SQL from Group-Pattern
* @param string $pattern Pattern to generate SQL for
* @param string $search What to searchid for
* @return string
*/
function GenGroupSQL($pattern) {
function GenGroupSQL($pattern,$search='') {
$tmp = explode(" ",$pattern);
$tables = array();
foreach( $tmp as $opt ) {
@@ -48,7 +49,10 @@ function GenGroupSQL($pattern) {
}
$i++;
}
$sql = "SELECT ".str_replace("(","",$tables[0]).".device_id FROM ".implode(",",$tables)." WHERE (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$pattern).")";
if( !empty($search) ) {
$search .= " &&";
}
$sql = "SELECT DISTINCT(".str_replace("(","",$tables[0]).".device_id) FROM ".implode(",",$tables)." WHERE ".$search." (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$pattern).")";
return $sql;
}
@@ -81,13 +85,8 @@ function GetDeviceGroups() {
function GetGroupsFromDevice($device) {
$ret = array();
foreach( GetDeviceGroups() as $group ) {
foreach( GetDevicesFromGroup($group['id']) as $dev ) {
if( $dev['device_id'] == $device ) {
if( !in_array($group['id'],$ret) ) {
$ret[] = $group['id'];
}
continue 2;
}
if( dbFetchCell(GenGroupSQL($group['pattern'],'device_id=?').' LIMIT 1',array($device)) == $device ){
$ret[] = $group['id'];
}
}
return $ret;
+139 -102
View File
@@ -1,123 +1,160 @@
<?php
echo("Physical Inventory : ");
if ($config['enable_inventory']) {
if ($config['enable_inventory']) {
echo("Physical Inventory : ");
echo("\nCaching OIDs:");
echo("\nCaching OIDs:");
$entity_array = array();
echo(" entPhysicalEntry");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB");
echo(" entAliasMappingIdentifier");
$entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, "ENTITY-MIB:IF-MIB");
if ($device['os'] == 'junos') {
foreach ($entity_array as $entPhysicalIndex => $entry) {
$entPhysicalDescr = $entry['entPhysicalDescr'];
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
$entPhysicalClass = $entry['entPhysicalClass'];
$entPhysicalName = $entry['entPhysicalName'];
$entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
$entPhysicalModelName = $entry['entPhysicalModelName'];
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
if (isset($entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'])) {
$ifIndex = $entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'];
}
if (!strpos($ifIndex, "fIndex") || $ifIndex == "") {
unset($ifIndex);
$entity_array = array();
echo(" jnxBoxAnatomy");
$entity_array = snmpwalk_cache_oid($device, "jnxBoxAnatomy", $entity_array, "JUNIPER-MIB");
} else {
$ifIndex_array = explode(".", $ifIndex);
$ifIndex = $ifIndex_array[1];
$entity_array = array();
echo(" entPhysicalEntry");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB");
echo(" entAliasMappingIdentifier");
$entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, "ENTITY-MIB:IF-MIB");
}
if ($entPhysicalVendorTypes[$entPhysicalVendorType] && !$entPhysicalModelName)
{
$entPhysicalModelName = $entPhysicalVendorTypes[$entPhysicalVendorType];
}
foreach ($entity_array as $entPhysicalIndex => $entry) {
// FIXME - dbFacile
if ($device['os'] == 'junos') {
if ($entPhysicalDescr || $entPhysicalName)
{
$entPhysical_id = dbFetchCell("SELECT entPhysical_id FROM `entPhysical` WHERE device_id = ? AND entPhysicalIndex = ?",array($device['device_id'], $entPhysicalIndex));
// Juniper's MIB doesn't have the same objects as the Entity MIB, so some values
// are made up here.
$entPhysicalDescr = $entry['jnxContentsDescr'];
$entPhysicalContainedIn = $entry['jnxContainersWithin'];
$entPhysicalClass = $entry['jnxBoxClass'];
$entPhysicalName = $entry['jnxOperatingDescr'];
$entPhysicalSerialNum = $entry['jnxContentsSerialNo'];
$entPhysicalModelName = $entry['jnxContentsPartNo'];
$entPhysicalMfgName = 'Juniper';
$entPhysicalVendorType = 'Juniper';
$entPhysicalParentRelPos = -1;
$entPhysicalHardwareRev = $entry['jnxContentsRevision'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['jnxFruType'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
} else {
if ($entPhysical_id) {
$update_data = array(
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID
);
dbUpdate($update_data, 'entPhysical', 'device_id=? AND entPhysicalIndex=?',array($device['device_id'],$entPhysicalIndex));
echo(".");
} else {
$insert_data = array(
'device_id' => $device['device_id'],
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID
);
$entPhysicalDescr = $entry['entPhysicalDescr'];
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
$entPhysicalClass = $entry['entPhysicalClass'];
$entPhysicalName = $entry['entPhysicalName'];
$entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
$entPhysicalModelName = $entry['entPhysicalModelName'];
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
}
if (!empty($ifIndex)) {
$insert_data['ifIndex'] = $ifIndex;
if (isset($entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'])) {
$ifIndex = $entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'];
}
if (!strpos($ifIndex, "fIndex") || $ifIndex == "") {
unset($ifIndex);
} else {
$ifIndex_array = explode(".", $ifIndex);
$ifIndex = $ifIndex_array[1];
}
if ($entPhysicalVendorTypes[$entPhysicalVendorType] && !$entPhysicalModelName) {
$entPhysicalModelName = $entPhysicalVendorTypes[$entPhysicalVendorType];
}
// FIXME - dbFacile
if ($entPhysicalDescr || $entPhysicalName) {
$entPhysical_id = dbFetchCell("SELECT entPhysical_id FROM `entPhysical` WHERE device_id = ? AND entPhysicalIndex = ?",array($device['device_id'], $entPhysicalIndex));
if ($entPhysical_id) {
$update_data = array(
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID
);
dbUpdate($update_data, 'entPhysical', 'device_id=? AND entPhysicalIndex=?',array($device['device_id'],$entPhysicalIndex));
echo(".");
} else {
$insert_data = array(
'device_id' => $device['device_id'],
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID
);
if (!empty($ifIndex)) {
$insert_data['ifIndex'] = $ifIndex;
}
dbInsert($insert_data, 'entPhysical');
echo("+");
}
if ($device['os'] == 'junos') {
// $entPhysicalIndex appears as a numeric OID fragment
// (string), so convert it to an "integer" for the
// validation step below since it is stored in the DB as
// an integer. This should be fixed.
list($first,$second) = explode(".",$entPhysicalIndex);
$entPhysicalIndexNoDots = $first . $second;
$valid[$entPhysicalIndexNoDots] = 1;
} else {
$valid[$entPhysicalIndex] = 1;
}
}
}
dbInsert($insert_data, 'entPhysical');
echo("+");
}
} else { echo("Disabled!"); }
$valid[$entPhysicalIndex] = 1;
}
}
} else { echo("Disabled!"); }
$sql = "SELECT * FROM `entPhysical` WHERE `device_id` = '".$device['device_id']."'";
foreach (dbFetchRows($sql) as $test)
{
$sql = "SELECT * FROM `entPhysical` WHERE `device_id` = '".$device['device_id']."'";
foreach (dbFetchRows($sql) as $test) {
$id = $test['entPhysicalIndex'];
if (!$valid[$id]) {
echo("-");
dbDelete('entPhysical', 'entPhysical_id = ?', array($test['entPhysical_id']));
echo("-");
dbDelete('entPhysical', 'entPhysical_id = ?', array($test['entPhysical_id']));
}
}
echo("\n");
}
echo("\n");
?>
+1 -1
View File
@@ -3,7 +3,7 @@
if (!$os)
{
if (strstr($sysDescr, "Comware")) { $os = "comware"; }
else if(preg_match('/HP [a-zA-Z0-9-]+ Switch Software Version/',$sysDescr)) { $os = "comware"; }
else if(preg_match('/HP [a-zA-Z0-9- ]+ Switch Software Version/',$sysDescr)) { $os = "comware"; }
}
?>
+6
View File
@@ -0,0 +1,6 @@
<?php
if (!$os)
{
if (strstr($sysObjectId, ".1.3.6.1.4.1.3709")) { $os = "datacom"; }
}
?>
+1
View File
@@ -15,6 +15,7 @@ if (!$os)
elseif (strstr($sysDescr, "endian")) { $os = "endian"; }
elseif (preg_match("/Cisco Small Business/", $sysDescr)) { $os = "ciscosmblinux"; }
elseif (strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap"; }
elseif (stristr($sysObjectId, "packetlogic") || strstr($sysObjectId, ".1.3.6.1.4.1.15397.2")) { $os = "procera"; }
elseif (strstr($sysObjectId, ".1.3.6.1.4.1.10002.1") || strstr($sysObjectId, ".1.3.6.1.4.1.41112.1.4") || strpos(trim(snmp_get($device, "dot11manufacturerName.5", "-Osqnv", "IEEE802dot11-MIB")), "Ubiquiti") !== FALSE)
{
$os = "airos";
@@ -0,0 +1,11 @@
<?php
if ($device['os'] == "datacom") {
echo("Datacom Switch : ");
$descr = "Processor";
$usage = snmp_get($device, "swCpuUsage.0", "-Ovq", "DMswitch-MIB");
echo $usage."\n";
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, "swCpuUsage", "0", "datacom", $descr, "1", $usage, NULL, NULL);
}
}
?>
+18
View File
@@ -1154,3 +1154,21 @@ function set_curl_proxy($post)
curl_setopt($post, CURLOPT_PROXY, $config['callback_proxy']);
}
}
function target_to_id($target) {
if( $target[0].$target[1] == "g:" ) {
$target = "g".dbFetchCell('SELECT id FROM device_groups WHERE name = ?',array(substr($target,2)));
} else {
$target = dbFetchCell('SELECT device_id FROM devices WHERE hostname = ?',array($target));
}
return $target;
}
function id_to_target($id) {
if( $id[0] == "g" ) {
$id = 'g:'.dbFetchCell("SELECT name FROM device_groups WHERE id = ?",array(substr($id,1)));
} else {
$id = dbFetchCell("SELECT hostname FROM devices WHERE device_id = ?",array($id));
}
return $id;
}
+48 -17
View File
@@ -1,58 +1,77 @@
<?php
# PDU
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.6.0", "-OQv", "", ""),'"');
$serial = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentSerialNumber.0", "-OQv", "", ""),'"');
if ($serial == "")
{
# ATS
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.6.0", "-OQv", "", ""),'"');
$serial = trim(snmp_get($device, "PowerNet-MIB::atsIdentSerialNumber.0", "-OQv", "", ""),'"');
}
if ($serial == "")
{
# UPS
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.1.1.2.3.0", "-OQv", "", ""),'"');
$serial = trim(snmp_get($device, "PowerNet-MIB::upsAdvIdentSerialNumber.0", "-OQv", "", ""),'"');
}
if ($serial == "")
{
# Masterswitch/AP9606
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.4.1.5.0", "-OQv", "", ""),'"');
$serial = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentSerialNumber.0", "-OQv", "", ""),'"');
}
if ($serial == "")
{
# InRow chiller
$serial = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentSerialNumber.0", "-OQv", "", ""),'"');
}
if ($serial == "")
{
# InfraStruxure
$serial = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentSerialNumber.0", "-OQv", "", ""),'"');
}
/////////////////////
# PDU
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.5.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.2.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::rPDUIdentHardwareRev.0", "-OQv", "", ""),'"');
if ($hardware == " ")
{
# ATS
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.5.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.1.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, "PowerNet-MIB::atsIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::atsIdentHardwareRev.0", "-OQv", "", ""),'"');
}
if ($hardware == " ")
{
# UPS
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.1.1.1.1.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.1.1.2.1.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, "PowerNet-MIB::upsBasicIdentModel.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::upsAdvIdentFirmwareRevision.0", "-OQv", "", ""),'"');
}
if ($hardware == " ")
{
# Masterswitch/AP9606
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.4.1.4.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.4.1.1.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::sPDUIdentHardwareRev.0", "-OQv", "", ""),'"');
}
if ($hardware == " ")
{
# InRow chiller
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.13.3.2.2.1.4.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, ".1.3.6.1.4.1.318.1.1.13.3.2.2.1.7.0", "-OQv", "", ""),'"');
$hardware = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentHardwareRevision.0", "-OQv", "", ""),'"');
}
if ($hardware == " ")
{
# InfraStruxure
$hardware = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentModelNumber.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentMonitorCardHardwareRev.0", "-OQv", "", ""),'"');
}
/////////////////////
@@ -63,18 +82,30 @@ $APPrev = trim(snmp_get($device, "1.3.6.1.4.1.318.1.4.2.4.1.4.2", "-OQv", "", ""
if ($AOSrev == '')
{
# PDU
$version = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.3.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, "PowerNet-MIB::rPDUIdentFirmwareRev.0", "-OQv", "", ""),'"');
if ($version == "")
{
# ATS
$version = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.2.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, "PowerNet-MIB::atsIdentFirmwareRev.0", "-OQv", "", ""),'"');
}
if ($version == "")
{
# Masterswitch/AP9606
$version = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.4.1.2.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, "PowerNet-MIB::sPDUIdentFirmwareRev.0", "-OQv", "", ""),'"');
}
if ($version == "")
{
# InRow chiller
$version = trim(snmp_get($device, "PowerNet-MIB::airIRRCUnitIdentFirmwareRevision.0", "-OQv", "", ""),'"');
}
if ($version == "")
{
# InfraStruxure
$version = trim(snmp_get($device, "PowerNet-MIB::isxModularPduIdentMonitorCardFirmwareAppRev.0", "-OQv", "", ""),'"');
}
}
else
+9 -9
View File
@@ -1,14 +1,14 @@
<?php
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result))
if (preg_match('/^Cisco IOS Software, .+? Software(\, )?([\s\w\d]+)? \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
}
elseif( false )
{
# Placeholder
# Other regexp for other type of string
$features = $regexp_result[3];
$version = $regexp_result[4];
$hardware = $regexp_result[2];
$tmp = preg_split("/\\r\\n|\\r|\\n/",$version);
if (!empty($tmp[0])) {
$version = $tmp[0];
}
}
echo("\n".$poll_device['sysDescr']."\n");
@@ -24,7 +24,7 @@ if ($data[1]['entPhysicalContainedIn'] == "0")
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName']))
if (!empty($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != 'Switch System')
{
$hardware = $data[1]['entPhysicalName'];
}
+6
View File
@@ -0,0 +1,6 @@
<?php
$hardware = "Datacom ".str_replace("dmSwitch","DM",snmp_get($device, "swChassisModel.0", "-Ovq", "DMswitch-MIB"));
$version = snmp_get($device, "swFirmwareVer.1", "-Ovq", "DMswitch-MIB");
$features = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
$serial = snmp_get($device, "DMswitch-MIB::swSerialNumber.1", "-Ovq","DMswitch-MIB");
?>
+6
View File
@@ -28,6 +28,12 @@ if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) {
$version = trim(snmp_get($device, ".1.3.6.1.4.1.20301.2.7.13.1.1.1.10.0", "-Ovq") , '" ');
$serial = trim(snmp_get($device, ".1.3.6.1.4.1.20301.100.100.14.9.0", "-Ovq") , '" ');
}
if (empty($version)) {
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
}
if (empty($serial)) {
$serial = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq") , '" ');
}
} elseif (strpos($sysdescr_value, 'IBM Flex System Fabric') !== false) {
$hardware = str_replace("IBM Flex System Fabric", "", $sysdescr_value);
$version = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.10.1", "-Ovq") , '" ');
+18
View File
@@ -0,0 +1,18 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (stristr($poll_device['sysObjectID'], "packetlogic") || strstr($poll_device['sysObjectID'], "enterprises.15397.2") || strstr($poll_device['sysObjectID'], ".1.3.6.1.4.1.15397.2")) {
$version = "PacketLogic";
$hardware = "PacketLogic";
}
@@ -0,0 +1,3 @@
<?php
$proc = snmp_get($device, "swCpuUsage.0", "-Ovq", "DMswitch-MIB");
?>
+9 -2
View File
@@ -150,10 +150,17 @@ function rrdtool($command, $filename, $options)
{
global $config, $debug, $rrd_pipes, $console_color;
$cmd = "$command $filename $options";
if ($command != "create" && $config['rrdcached'])
{
$cmd .= " --daemon " . $config['rrdcached'];
$filename = str_replace($config['install_dir'],"",$filename);
//Some people tend to end paths with '/', let's tolerate that
if( $filename[0] == "/" ) {
$filename = substr($filename,1);
}
$filename = str_replace("rrd/","",$filename); //Make sure you use -b /opt/librenms/rrd on your rrdcached!
$cmd = "$command $filename $options --daemon " . $config['rrdcached'];
} else {
$cmd = "$command $filename $options";
}
if ($config['norrd'])