mirror of
				https://github.com/lopes/netbox-scanner.git
				synced 2025-10-31 03:23:54 +01:00 
			
		
		
		
	more info in logs
This commit is contained in:
		
							parent
							
								
									f1327f2102
								
							
						
					
					
						commit
						3be564d967
					
				| @ -18,7 +18,7 @@ Another way is download from GitHub: | ||||
| Note that `netbox-scanner` will require Nmap and an instance of NetBox ready to use. | ||||
| 
 | ||||
| ## Usage | ||||
| `netbox-scanner` can be used both in your programs or as a script to be used in shell.  To use `netbox-scanner` as a script, edit `netbox-scanner/config.py` with your setup, and run the command below: | ||||
| `netbox-scanner` can be used both in your Python programs or as a script.  To use `netbox-scanner` as a script, edit `netbox-scanner/config.py` with your setup, and run the command below: | ||||
| 
 | ||||
|     $ netbox-scanner.py | ||||
| 
 | ||||
| @ -26,11 +26,11 @@ Note that `netbox-scanner` will require Nmap and an instance of NetBox ready to | ||||
| 
 | ||||
| 1. It will scan all networks defined in `netbox-scanner/config.py` or via parameters. | ||||
| 2. For each discovered host it will: | ||||
|     1. If host is in NetBox, description is different, and tag is set as defined in `netbox-scanner/config.py/TAG`, it'll be updated. | ||||
|     1. If host is in NetBox, description is different, and `tag` is set as defined in `netbox-scanner/config.py/TAG`, it'll be updated. | ||||
|     2. If host is not in NetBox, it'll be created. | ||||
| 3. It will iterate through each network to find and delete any hosts registered in NetBox that did not respond to scan, and have the tag `netbox-scanner/config.py/TAG`. | ||||
| 
 | ||||
| This way, if some hosts in your networks that are monitored via `netbox-scanner` are eventually down, but you don't want to delete them, just make sure that it doesn't have the tag as set in `netbox-scanner/config.py/TAG`. | ||||
| This way, if some hosts in your monitored networks are eventually down, but you don't want to delete them, just make sure that they doesn't have the `netbox-scanner/config.py/TAG` tag. | ||||
| 
 | ||||
| To see a list of all available parameters in `netbox-scanner.py`, simple use the `-h` option --please note that all parameters are optional, because all of them can be set using `netbox-scanner/config.py` file: | ||||
| 
 | ||||
|  | ||||
| @ -66,8 +66,8 @@ class NetBoxScanner(object): | ||||
|         ''' | ||||
|         create = update = delete = undiscovered = duplicate = 0 | ||||
|         for net in networks: | ||||
|             logging.info('scan: {}'.format(net)) | ||||
|             hosts = self.scan(net) | ||||
|             logging.info('scan: {} ({} hosts discovered)'.format(net, len(hosts))) | ||||
|             for host in hosts: | ||||
|                 try: | ||||
|                     nbhost = self.nbhandler('get', address=host['address']) | ||||
| @ -103,8 +103,8 @@ class NetBoxScanner(object): | ||||
|                             self.nbhandler('delete', nbhost=nbhost) | ||||
|                             delete += 1 | ||||
|                         else: | ||||
|                             logging.info('undiscovered: {}'.format( | ||||
|                                 nbhost.address)) | ||||
|                             logging.info('undiscovered: {} "{}"'.format( | ||||
|                                 nbhost.address, nbhost.description)) | ||||
|                             undiscovered += 1 | ||||
|                     except AttributeError: | ||||
|                         pass | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user