mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-30 16:14:21 +02:00
a billion changes. **** MAKE SURE TO UPDATE DATABASE AND RUN poll-os.php AND discovery.php -h all **** This is VERY important, as a lot of things have changed! Expect missing files, and another update soon!
git-svn-id: http://www.observium.org/svn/observer/trunk@531 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
$update = mysql_query("UPDATE `bgpPeers` SET astext = '$astext' WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'");
|
||||
}
|
||||
|
||||
## Get afi/safi and populate cbgp on cisco IOS
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
## Get afi/safi and populate cbgp on cisco ios (xe/xr)
|
||||
if($device['os_type'] == "ios") {
|
||||
unset($af_list);
|
||||
$af_cmd = $config['snmpwalk'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$af_cmd .= "cbgpPeerAddrFamilyName." . $peer_ip;
|
||||
@@ -61,7 +61,7 @@
|
||||
mysql_query("DELETE FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' AND afi = '$afi' AND safi = '$safi'");
|
||||
}
|
||||
} # AF list
|
||||
} # if IOS
|
||||
} # if os_type = ios
|
||||
} # If Peer
|
||||
} # Foreach
|
||||
} else {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
echo("CISCO-ENHANCED-MEMORY-POOL : ");
|
||||
|
||||
## Cisco Enhanced Mempool
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
if($device['os_type'] == "ios") {
|
||||
|
||||
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -v2c -CI -Osq -c ".$community." ".$hostname.":".$port." cempMemPoolName | sed s/cempMemPoolName.//g");
|
||||
$oids = trim($oids);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
echo("CISCO-PROCESS-MIB : ");
|
||||
|
||||
## Cisco Processors
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
if($device['os_type'] == "ios") {
|
||||
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-PROCESS-MIB -v2c -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g");
|
||||
$oids = trim($oids);
|
||||
foreach(explode("\n", $oids) as $data) {
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
if($config['enable_inventory']) {
|
||||
|
||||
$empty = array();
|
||||
$entity_array = snmpwalk_cache_oid("entityPhysical", $device, $empty, "ENTITY-MIB");
|
||||
$entity_array = snmpwalk_cache_oid("entPhysicalEntry", $device, $empty, "ENTITY-MIB");
|
||||
$entity_array = snmpwalk_cache_oid("entSensorValues", $device, $entity_array, "CISCO-ENTITY-SENSOR-MIB");
|
||||
|
||||
if(!$entity_array[$device[device_id]]) { $entity_array[$device[device_id]] = array(); }
|
||||
|
||||
foreach($entity_array[$device[device_id]] as $entPhysicalIndex => $entry) {
|
||||
|
||||
$entPhysicalDescr = $entry['entPhysicalDescr'];
|
||||
@@ -21,6 +23,13 @@
|
||||
$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'];
|
||||
|
||||
|
||||
$ent_data = $config['snmpget'] . " -m ENTITY-MIB:IF-MIB -Ovqs -";
|
||||
$ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port'];
|
||||
@@ -42,25 +51,21 @@
|
||||
$sql .= ", entPhysicalIndex = '$entPhysicalIndex', entPhysicalDescr = '$entPhysicalDescr', entPhysicalClass = '$entPhysicalClass', entPhysicalName = '$entPhysicalName'";
|
||||
$sql .= ", entPhysicalModelName = '$entPhysicalModelName', entPhysicalSerialNum = '$entPhysicalSerialNum', entPhysicalContainedIn = '$entPhysicalContainedIn'";
|
||||
$sql .= ", entPhysicalMfgName = '$entPhysicalMfgName', entPhysicalParentRelPos = '$entPhysicalParentRelPos', entPhysicalVendorType = '$entPhysicalVendorType'";
|
||||
$sql .= ", entPhysicalHardwareRev = '$entPhysicalHardwareRev', entPhysicalFirmwareRev = '$entPhysicalFirmwareRev', entPhysicalSoftwareRev = '$entPhysicalSoftwareRev'";
|
||||
$sql .= ", entPhysicalIsFRU = '$entPhysicalIsFRU', entPhysicalAlias = '$entPhysicalAlias', entPhysicalAssetID = '$entPhysicalAssetID'";
|
||||
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
|
||||
|
||||
mysql_query($sql);
|
||||
echo(".");
|
||||
} else {
|
||||
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `ifIndex` ) ";
|
||||
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$ifIndex')";
|
||||
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `entPhysicalHardwareRev`,`entPhysicalFirmwareRev`,`entPhysicalSoftwareRev`,`entPhysicalIsFRU`,`entPhysicalAlias`,`entPhysicalAssetID`, `ifIndex` ) ";
|
||||
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$entPhysicalHardwareRev', '$entPhysicalFirmwareRev', '$entPhysicalSoftwareRev', '$entPhysicalIsFRU', '$entPhysicalAlias', '$entPhysicalAssetID', '$ifIndex')";
|
||||
mysql_query($sql);
|
||||
echo("+");
|
||||
}
|
||||
|
||||
if($entPhysicalClass == "sensor") {
|
||||
|
||||
# $sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
# $sensor_cmd .= " entSensorType.$entPhysicalIndex entSensorScale.$entPhysicalIndex entSensorPrecision.$entPhysicalIndex";
|
||||
# $sensor_cmd .= " entSensorValueUpdateRate.$entPhysicalIndex entSensorMeasuredEntity.$entPhysicalIndex";
|
||||
# $sensor_data = shell_exec($sensor_cmd);
|
||||
# list($entSensorType,$entSensorScale,$entSensorPrecision,$entSensorValueUpdateRate,$entSensorMeasuredEntity) = explode("\n", $sensor_data);
|
||||
|
||||
$entSensorType = $entry['entSensorType'];
|
||||
$entSensorScale = $entry['entSensorScale'];
|
||||
$entSensorPrecision = $entry['entSensorPrecision'];
|
||||
|
||||
@@ -14,17 +14,14 @@
|
||||
list($net,$cidr) = explode("/", $network);
|
||||
$cidr = trim($cidr);
|
||||
if($mask == "255.255.255.255") { $cidr = "32"; $network = "$oid/$cidr"; }
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') {
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $oid != "0.0.0.0") {
|
||||
$i_query = "SELECT interface_id FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'";
|
||||
$interface_id = mysql_result(mysql_query($i_query), 0);
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_networks` WHERE `ipv4_network` = '$network'"), 0) < '1') {
|
||||
mysql_query("INSERT INTO `ipv4_networks` (`ipv4_network`) VALUES ('$network')");
|
||||
#echo("Create Subnet $network\n");
|
||||
echo("S");
|
||||
}
|
||||
|
||||
$ipv4_network_id = @mysql_result(mysql_query("SELECT `ipv4_network_id` from `ipv4_networks` WHERE `ipv4_network` = '$network'"), 0);
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_addresses` WHERE `ipv4_address` = '$oid' AND `ipv4_prefixlen` = '$cidr' AND `interface_id` = '$interface_id'"), 0) == '0') {
|
||||
@@ -32,10 +29,8 @@
|
||||
#echo("Added $oid/$cidr to $interface_id ( $hostname $ifIndex )\n $i_query\n");
|
||||
echo("+");
|
||||
} else { echo("."); }
|
||||
|
||||
$full_address = "$oid/$cidr|$ifIndex";
|
||||
$valid_v4[$full_address] = 1;
|
||||
|
||||
} else { echo("!"); }
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
echo("IPv6 Addresses : ");
|
||||
|
||||
$ipv6interfaces = shell_exec($config['snmpget']." -m IPV6-MIB -Ovnq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipv6Interfaces.0");
|
||||
#$ipv6interfaces = shell_exec($config['snmpget']." -m IPV6-MIB -Ovnq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipv6Interfaces.0");
|
||||
|
||||
if($ipv6interfaces){
|
||||
#if($ipv6interfaces){
|
||||
|
||||
$cmd = $config['snmpwalk']." -m IP-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port'];
|
||||
$cmd .= " ipAddressIfIndex.ipv6 -Osq | grep -v No";
|
||||
@@ -58,7 +58,7 @@ if($ipv6interfaces){
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { echo("None configured"); }
|
||||
#} else { echo("None configured"); }
|
||||
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$data = mysql_query($sql);
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(strstr($fstype, "FixedDisk") && $size > '0' && $allow) {
|
||||
if(strstr($fstype, "FixedDisk") || strstr($fstype, "Ram") || strstr($fstype, "VirtualMemory") && $size > '0' && $allow) {
|
||||
if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') {
|
||||
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) ";
|
||||
$query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$descr', '$size', '$units')";
|
||||
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageType`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) ";
|
||||
$query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$fstype', '$descr', '$size', '$units')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} else {
|
||||
$data = mysql_fetch_array(mysql_query("SELECT * FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"));
|
||||
if($data['hrStorageDescr'] != $descr || $data['hrStorageSize'] != $size || $data['hrStorageAllocationUnits'] != $units ) {
|
||||
$query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' ";
|
||||
$query = "UPDATE storage SET `hrStorageDescr` = '$descr', `hrStorageType` = '$fstype', `hrStorageSize` = '$size', `hrStorageAllocationUnits` = '$units' ";
|
||||
$query .= "WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'";
|
||||
echo("U");
|
||||
mysql_query($query);
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
|
||||
## Cisco Temperatures
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
if($device['os_type'] == "ios") {
|
||||
echo("Cisco ");
|
||||
$oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENVMON-MIB -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g");
|
||||
$oids = trim($oids);
|
||||
|
||||
@@ -50,12 +50,12 @@ global $config;
|
||||
return $array;
|
||||
}
|
||||
|
||||
function snmpwalk_cache_oid($oid, $device, $array, $mib = 0) {
|
||||
function snmpwalk_cache_oid($poll_oid, $device, $array, $mib = 0) {
|
||||
global $config;
|
||||
$cmd = $config['snmpbulkwalk'] . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " .
|
||||
$device['hostname'].":".$device['port'] . " ";
|
||||
if($mib) { $cmd .= "-m $mib "; }
|
||||
$cmd .= $oid;
|
||||
$cmd .= $poll_oid;
|
||||
$data = trim(shell_exec($cmd));
|
||||
$device_id = $device['device_id'];
|
||||
foreach(explode("\n", $data) as $entry) {
|
||||
|
||||
@@ -109,9 +109,9 @@ function device_array($device_id) {
|
||||
return $device;
|
||||
}
|
||||
|
||||
function getHostOS($hostname, $community, $snmpver, $port) {
|
||||
function getHostOS($device) {
|
||||
global $config;
|
||||
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $snmpver . " -c " . $community . " " . $hostname.":".$port . " sysDescr.0";
|
||||
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0";
|
||||
$sysDescr = str_replace("\"", "", trim(shell_exec($sysDescr_cmd)));
|
||||
$dir_handle = @opendir($config['install_dir'] . "/includes/osdiscovery") or die("Unable to open $path");
|
||||
while ($file = readdir($dir_handle)) {
|
||||
@@ -628,7 +628,8 @@ function fixIOSHardware($hardware){
|
||||
|
||||
function createHost ($host, $community, $snmpver, $port = 161){
|
||||
$host = trim(strtolower($host));
|
||||
$host_os = getHostOS($host, $community, $snmpver, $port);
|
||||
$device = array('hostname' => $host, 'community' => $community, 'snmpver' => $snmpver, 'port' => $port);
|
||||
$host_os = getHostOS($device);
|
||||
if($host_os) {
|
||||
$sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1')");
|
||||
if(mysql_affected_rows()) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^Cisco\ Adaptive\ Security\ Appliance/", $sysDescr)) { $os = "ASA"; }
|
||||
if(preg_match("/^Cisco\ Adaptive\ Security\ Appliance/", $sysDescr)) { $os = "asa"; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if(!$os) {
|
||||
|
||||
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "CatOS"; }
|
||||
if(strstr($sysDescr, "Cisco Catalyst Operating System Software")) { $os = "catos"; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." .1.3.6.1.2.1.1.2.0");
|
||||
if(strstr($sysObjectId, "fortinet")) {
|
||||
$fnSysVersion = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." fnSysVersion.0");
|
||||
if(strstr($fnSysVersion, "Fortigate")) {
|
||||
$os = "Fortigate";
|
||||
}
|
||||
$fnSysVersion = shell_exec($config['snmpget'] . " -Ovq -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." 1.3.6.1.4.1.12356.1.3.0");
|
||||
if(strstr($fnSysVersion, "Fortigate")) {
|
||||
$os = "fortigate";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(strstr($sysDescr, "FreeBSD")) { $os = "FreeBSD"; } ## It's FreeBSD!
|
||||
if(strstr($sysDescr, "Voswall")) { unset($os); } ## Oh-No-It-Isn't!!
|
||||
if(strstr($sysDescr, "m0n0wall")) { unset($os); } ## Ditto
|
||||
if(strstr($sysDescr, "FreeBSD")) { $os = "freebsd"; } ## It's FreeBSD!
|
||||
if(strstr($sysDescr, "Voswall")) { $os = "voswall"; } ## Oh-No-It-Isn't!!
|
||||
if(strstr($sysDescr, "m0n0wall")) { $os = "monowall"; } ## Ditto
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
if(!$os) {
|
||||
|
||||
if(strstr($sysDescr, "Cisco Internetwork Operating System Software")) { $os = "IOS"; }
|
||||
if(strstr($sysDescr, "IOS (tm)")) { $os = "IOS"; }
|
||||
if(strstr($sysDescr, "Cisco IOS Software")) { $os = "IOS"; }
|
||||
if(strstr($sysDescr, "IOS-XE")) { $os = "IOS XE"; }
|
||||
if(strstr($sysDescr, "Cisco Internetwork Operating System Software")) { $os = "ios"; }
|
||||
if(strstr($sysDescr, "IOS (tm)")) { $os = "ios"; }
|
||||
if(strstr($sysDescr, "Cisco IOS Software")) { $os = "ios"; }
|
||||
if(strstr($sysDescr, "IOS-XE")) { $os = "iosxe"; }
|
||||
if(strstr($sysDescr, "IOS XR")) { $os = "iosxr"; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
if(!$os) {
|
||||
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovqn -v2c -c ". $community ." ". $hostname.":".$port ." sysObjectID.0");
|
||||
if(strstr($sysObjectId, ".1.3.6.1.4.1.2636")) { $os = "JunOS"; }
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovqn -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." sysObjectID.0");
|
||||
if(strstr($sysObjectId, ".1.3.6.1.4.1.2636")) { $os = "junos"; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^Linux/", $sysDescr)) { $os = "Linux"; }
|
||||
if(preg_match("/^Linux/", $sysDescr)) { $os = "linux"; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^m0n0wall/", $sysDescr)) { $os = "m0n0wall"; }
|
||||
}
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^Voswall/", $sysDescr)) { $os = "Voswall"; }
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^NetBSD/", $sysDescr)) { $os = "NetBSD"; }
|
||||
if(preg_match("/^NetBSD/", $sysDescr)) { $os = "netbsd"; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/^OpenBSD/", $sysDescr)) { $os = "OpenBSD"; }
|
||||
if(preg_match("/^OpenBSD/", $sysDescr)) { $os = "openbsd"; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
|
||||
if(strstr($sysDescr, "Neyland 24T")) { $os = "powerconnect"; }
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
if(!$os) {
|
||||
|
||||
var_dump($port);
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname.":".$port ." .1.3.6.1.2.1.1.2.0");
|
||||
if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "ScreenOS"; }
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -".$device['snmpver']." -c ". $device['community'] ." ". $device['hostname'].":".$device['port'] ." .1.3.6.1.2.1.1.2.0");
|
||||
if(strstr($sysObjectId, "netscreen")) { $os = "screenos"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "screenos"; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/Windows/", $sysDescr)) { $os = "Windows"; }
|
||||
if(preg_match("/Windows/", $sysDescr)) { $os = "windows"; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -44,7 +44,7 @@ while($peer = mysql_fetch_array($peers)) {
|
||||
|
||||
mysql_query($update);
|
||||
|
||||
if($device['os'] == "IOS" || $device['os'] == "IOS XE") {
|
||||
if($device['os_group'] == "ios") {
|
||||
|
||||
## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB)
|
||||
$afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "IOS") {
|
||||
if($device['os_group'] == "ios") {
|
||||
|
||||
$array = snmp_cache_portIfIndex ($device, $array);
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
<?php
|
||||
|
||||
echo("Doing Juniper JunOS");
|
||||
echo("Doing Juniper JunOS ");
|
||||
|
||||
$jun_ver = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.25.6.3.1.2.2")));
|
||||
$hardware = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.2.0")));
|
||||
$serial = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.3.0")));
|
||||
if(strpos($sysDescr, "olive")) {
|
||||
$hardware = "Olive";
|
||||
$serial = "";
|
||||
} else {
|
||||
$hardware = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -OQv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.2.0")));
|
||||
$serial = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m JUNIPER-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2636.3.1.3.0")));
|
||||
list(,$hardware,) = explode(" ", $hardware);
|
||||
$hardware = "Juniper " . $hardware;
|
||||
}
|
||||
|
||||
list($version) = explode("]", $jun_ver);
|
||||
list(,$version) = explode("[", $version);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
$snmp_cmd = $config['snmpget'] . " -m Dell-Vendor-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
|
||||
$device['hostname'].":".$device['port'];
|
||||
$snmp_cmd .= " productIdentificationDisplayName.0 productIdentificationVersion.0 productIdentificationDescription.0";
|
||||
|
||||
list($hardware, $version, $features) = explode("\n", shell_exec($snmp_cmd));
|
||||
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "CatOS" || $device['os'] == "IOS") {
|
||||
if($device['os_group'] == "ios") {
|
||||
$portifIndex = array();
|
||||
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
|
||||
#echo("$cmd");
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
echo("Polling IP-MIB ipSystemStats ");
|
||||
|
||||
$ipSystemStats = snmpwalk_cache_oid("ipSystemStats", $device, $ipSystemStats, "IP-MIB");
|
||||
$ipSystemStats = $ipSystemStats[$device[device_id]];
|
||||
|
||||
foreach($ipSystemStats as $af => $stats) {
|
||||
|
||||
echo("$af ");
|
||||
|
||||
$oids = array('ipSystemStatsInReceives','ipSystemStatsInHdrErrors','ipSystemStatsInAddrErrors','ipSystemStatsInUnknownProtos','ipSystemStatsInForwDatagrams','ipSystemStatsReasmReqds',
|
||||
'ipSystemStatsReasmOKs','ipSystemStatsReasmFails','ipSystemStatsInDiscards','ipSystemStatsInDelivers','ipSystemStatsOutRequests','ipSystemStatsOutNoRoutes','ipSystemStatsOutDiscards',
|
||||
'ipSystemStatsOutFragFails','ipSystemStatsOutFragCreates','ipSystemStatsOutForwDatagrams');
|
||||
|
||||
if(isset($stats['ipSystemStatsHCInReceives'])) { $stats['ipSystemStatsInReceives'] = $stats['ipSystemStatsHCInReceives']; }
|
||||
if(isset($stats['ipSystemStatsHCInForwDatagrams'])) { $stats['ipSystemStatsInForwDatagrams'] = $stats['ipSystemStatsHCInForwDatagrams']; }
|
||||
if(isset($stats['ipSystemStatsHCInDelivers'])) { $stats['ipSystemStatsInDelivers'] = $stats['ipSystemStatsHCInDelivers']; }
|
||||
if(isset($stats['ipSystemStatsHCOutRequests'])) { $stats['ipSystemStatsOutRequests'] = $stats['ipSystemStatsHCOutRequests']; }
|
||||
if(isset($stats['ipSystemStatsHCOutForwDatagrams'])) { $stats['ipSystemStatsOutForwDatagrams'] = $stats['ipSystemStatsHCOutForwDatagrams']; }
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/ipSystemStats-".$af.".rrd";
|
||||
|
||||
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
|
||||
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
||||
|
||||
$rrdupdate = "N";
|
||||
|
||||
foreach($oids as $oid){
|
||||
$oid_ds = str_replace("ipSystemStats", "", $oid);
|
||||
$oid_ds = truncate($oid_ds, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
||||
$snmpstring .= " $oid.0";
|
||||
if(strstr($stats[$oid], "No") || strstr($stats[$oid], "d") || strstr($stats[$oid], "s")) { $stats[$oid] = "0"; }
|
||||
$rrdupdate .= ":".$stats[$oid];
|
||||
}
|
||||
if(!file_exists($rrdfile)) { shell_exec($rrd_create); }
|
||||
|
||||
rrdtool_update($rrdfile, $rrdupdate);
|
||||
|
||||
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
|
||||
?>
|
||||
@@ -38,7 +38,7 @@
|
||||
#foreach ($cisco_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "OLD-CISCO-INTERFACES-MIB"); }
|
||||
#foreach ($pagp_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "CISCO-PAGP-MIB"); }
|
||||
|
||||
if($device['os'] == "IOS" || $device['os'] == "CatOS" || $device['os'] == "IOS XE") {
|
||||
if($device['os_group'] == "ios") {
|
||||
#$array = snmp_cache_portIfIndex ($device, $array);
|
||||
#$array = snmp_cache_portName ($device, $array);
|
||||
#$array = snmp_cache_oid("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
$config['ifname']['asa'] = true;
|
||||
$config['ifname']['catos'] = true;
|
||||
$config['ifname']['windows'] = true;
|
||||
$config['ifname']['powerconnect'] = true;
|
||||
|
||||
## AFI / SAFI pairs for BGP (and other stuff, perhaps)
|
||||
$config['afi']['ipv4']['unicast'] = "IPv4";
|
||||
@@ -21,9 +22,30 @@ $os_groups['netbsd'] = "unix";
|
||||
$os_groups['dragonfly'] = "unix";
|
||||
$os_groups['solaris'] = "unix";
|
||||
|
||||
$os_groups['ios xe'] = "ios";
|
||||
$os_groups['iosxe'] = "ios";
|
||||
$os_groups['iosxr'] = "ios";
|
||||
$os_groups['ios'] = "ios";
|
||||
$os_groups['asa'] = "ios";
|
||||
|
||||
##
|
||||
$os_text['linux'] = "Linux";
|
||||
$os_text['ios'] = "Cisco IOS";
|
||||
$os_text['iosxr'] = "Cisco IOS XE";
|
||||
$os_text['iosxe'] = "Cisco IOS XR";
|
||||
$os_text['catos'] = "Cisco CatOS";
|
||||
$os_text['nxos'] = "Cisco NX-OS";
|
||||
$os_text['asa'] = "Cisco ASA";
|
||||
$os_text['pix'] = "Cisco PIX";
|
||||
$os_text['freebsd'] = "FreeBSD";
|
||||
$os_text['openbsd'] = "OpenBSD";
|
||||
$os_text['netbsd'] = "NetBSD";
|
||||
$os_text['dragonflybsd'] = "DragonFlyBSD";
|
||||
$os_text['powerconnect'] = "Dell PowerConnect";
|
||||
$os_text['windows'] = "Microsoft Windows";
|
||||
$os_text['junos'] = "Juniper JunOS";
|
||||
$os_text['procurve'] = "HP ProCurve";
|
||||
|
||||
|
||||
if(!$config['graph_colours']['greens']) {
|
||||
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ function process_syslog ($entry, $update) {
|
||||
if($device_id && !$delete) {
|
||||
$entry['device_id'] = $device_id;
|
||||
$os = mysql_result(mysql_query("SELECT `os` FROM `devices` WHERE `device_id` = '$device_id'"),0);
|
||||
if($os == "IOS" || $os == "IOS XE") {
|
||||
if($os == "ios" || $os == "iosxe") {
|
||||
if(strstr($entry[msg], "%")) {
|
||||
$entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']);
|
||||
list(,$entry[msg]) = split(": %", $entry['msg']);
|
||||
|
||||
Reference in New Issue
Block a user