2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( $device [ 'type' ]  ==  'network'  ||  $device [ 'type' ]  ==  'firewall' )  
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-14 23:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  echo ( " Wireless:  " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-02 10:32:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ##### GENERIC FRAMEWORK, FILLING VARIABLES
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $device [ 'os' ]  ==  'airport' ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 14:04:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo ( " Checking Airport Wireless clients...  " ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-02 10:32:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $wificlients1  =  snmp_get ( $device ,  " wirelessNumber.0 " ,  " -OUqnv " ,  " AIRPORT-BASESTATION-3-MIB " )  + 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( $wificlients1  .  "  clients \n " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # FIXME Also interesting to poll? dhcpNumber.0 for number of active dhcp leases
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 01:11:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  if  ( $device [ 'os' ]  ==  'ios'  and  substr ( $device [ 'hardware' ], 0 , 4 )  ==  'AIR-' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 14:04:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo ( " Checking Aironet Wireless clients...  " ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $wificlients1  =  snmp_get ( $device ,  " cDot11ActiveWirelessClients.1 " ,  " -OUqnv " ,  " CISCO-DOT11-ASSOCIATION-MIB " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $wificlients2  =  snmp_get ( $device ,  " cDot11ActiveWirelessClients.2 " ,  " -OUqnv " ,  " CISCO-DOT11-ASSOCIATION-MIB " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 01:11:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 14:04:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo (( $wificlients1  + 0 )  .  "  clients on dot11Radio0,  "  .  ( $wificlients2  + 0 )  .  "  clients on dot11Radio1 \n " ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 01:11:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  #MikroTik RouterOS
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $device [ 'os' ]  ==  'routeros' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    # Check inventory for wireless card in device. Valid types be here:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $wirelesscards  =  array ( 'Wireless' ,  'Atheros' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    foreach  ( $wirelesscards  as  $wirelesscheck ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-16 20:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      if  ( dbFetchCell ( " SELECT COUNT(*) FROM `entPhysical` WHERE `device_id` = ?AND `entPhysicalDescr` LIKE ? " ,  array ( $device [ 'device_id' ],  " % " . $wirelesscheck . " % " ))  >=  " 1 " ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo ( " Checking RouterOS Wireless clients...  " ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-05 13:59:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $wificlients1  =  snmp_get ( $device ,  " mtxrWlApClientCount " ,  " -OUqnv " ,  " MIKROTIK-MIB " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo (( $wificlients1  + 0 )  .  "  clients \n " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      unset ( $wirelesscards ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 13:36:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( $device [ 'os' ]  ==  'symbol'  AND  ( stristr ( $device [ 'hardware' ], " AP " ))) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " Checking Symbol Wireless clients...  " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-20 16:50:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $wificlients1  =  snmp_get ( $device ,  " .1.3.6.1.4.1.388.11.2.4.2.100.10.1.18.1 " ,  " -Ovq " ,  " \" \" " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 13:36:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo (( $wificlients1  + 0 )  .  "  clients on wireless connector,  " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ##### RRD Filling Code
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  if  ( isset ( $wificlients1 )  &&  $wificlients1  !=  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $wificlientsrrd   =  $config [ 'rrd_dir' ]  .  " / "  .  $device [ 'hostname' ]  .  " / "  .  safename ( " wificlients-radio1.rrd " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 01:11:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! is_file ( $wificlientsrrd )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      rrdtool_create ( $wificlientsrrd , " --step 300  \ 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-20 17:37:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     DS : wificlients : GAUGE : 600 :- 273 : 1000  " . $config['rrd_rra'] );
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    rrdtool_update ( $wificlientsrrd , " N: " . $wificlients1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 12:59:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-02 10:33:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $graphs [ 'wifi_clients' ]  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( isset ( $wificlients2 )  &&  $wificlients2  !=  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $wificlientsrrd   =  $config [ 'rrd_dir' ]  .  " / "  .  $device [ 'hostname' ]  .  " / "  .  safename ( " wificlients-radio2.rrd " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 01:11:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! is_file ( $wificlientsrrd )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      rrdtool_create ( $wificlientsrrd , " --step 300  \ 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-20 17:37:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     DS : wificlients : GAUGE : 600 :- 273 : 1000  " . $config['rrd_rra'] );
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    rrdtool_update ( $wificlientsrrd , " N: " . $wificlients2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 12:59:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-02 10:33:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $graphs [ 'wifi_clients' ]  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 12:59:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  unset ( $wificlients2 ,  $wificlients1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 14:04:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								echo ( " \n " );  
						 
					
						
							
								
									
										
										
										
											2010-07-18 18:28:32 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-05 14:15:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								?>