| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-07 05:00:47 +00:00
										 |  |  | if (preg_match('/^Cisco IOS Software.*?, .+? Software(\, )?([\s\w\d]+)? \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $device['sysDescr'], $regexp_result)) { | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     $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]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-07 05:00:47 +00:00
										 |  |  | echo "\n".$device['sysDescr']."\n"; | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-16 07:42:50 -06:00
										 |  |  | $oids = ['entPhysicalModelName.1', 'entPhysicalContainedIn.1', 'entPhysicalName.1', 'entPhysicalSoftwareRev.1', 'entPhysicalModelName.1001', 'entPhysicalContainedIn.1001', 'cardDescr.1', 'cardSlotNumber.1']; | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB'); | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if ($data[1]['entPhysicalContainedIn'] == '0') { | 
					
						
							|  |  |  |     if (!empty($data[1]['entPhysicalSoftwareRev'])) { | 
					
						
							|  |  |  |         $version = $data[1]['entPhysicalSoftwareRev']; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if (!empty($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != 'Switch System') { | 
					
						
							|  |  |  |         $hardware = $data[1]['entPhysicalName']; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if (!empty($data[1]['entPhysicalModelName'])) { | 
					
						
							|  |  |  |         $hardware = $data[1]['entPhysicalModelName']; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | // if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
 | 
					
						
							|  |  |  | // if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
 | 
					
						
							|  |  |  | // if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
 | 
					
						
							|  |  |  | // $ciscomodel = str_replace("\"","",$ciscomodel);
 | 
					
						
							|  |  |  | // if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
 | 
					
						
							|  |  |  | if (empty($hardware)) { | 
					
						
							|  |  |  |     $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB'); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-03-20 16:50:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-18 22:20:50 +01:00
										 |  |  | $serial = get_main_serial($device); |