Here a new way to save times... Automatic hosts discovery and creation. Know what is going on in your network!
Let's discover some hosts!
How it works: Basically, from the management server (via the cprd_util command), I get the arp table from a gateway. With this info, I create a .csv file.
Subsequently, I import the csv file into the R80 management with the command "mgmt_cli --batch file.csv". If the object already exists, it will not be created. This is supported by "mgmt_cli --batch".
In the definition of the object, I include the following information with relevant comments: IP, Name, MAC address, behind which network interface of the fw, name of the firewall, timestamp.
All the information created here is retrieve via the arp file and automatically create with mgmt_cli:
![](/legacyfs/online/checkpoint/57784_pastedImage_1.png)
![](/legacyfs/online/checkpoint/57574_hosts2.png)
I also add 2 tags (new feature of R80). This allows quick searches in object list:
For example, if I search for objects behind the eth2 interface:
![](/legacyfs/online/checkpoint/57575_hosts3.png)
Searching for all object related to a particular gateway:
![](/legacyfs/online/checkpoint/57576_hosts4.png)
EXÉCUTION:
3 options to run the script:
1- Command line in expert mode:
![](/legacyfs/online/checkpoint/57804_pastedImage_4.png)
![](/legacyfs/online/checkpoint/57806_pastedImage_6.png)
2- With a cronjob at every 5 minutes:
![](/legacyfs/online/checkpoint/57807_pastedImage_7.png)
3- Directly from the SmartConsole:
Go to Gateway and server view:
![](/legacyfs/online/checkpoint/57808_pastedImage_8.png)
Create a new script and give a name, save and publish the change :
![](/legacyfs/online/checkpoint/57809_pastedImage_9.png)
Run the script :
![](/legacyfs/online/checkpoint/57810_pastedImage_10.png)
Two arguments are required. Gateway name and IP address of the gateway. Optional third argument: groupe name. If you specify a group name, all the discovered hosts will be added to that group. If you don’t, a group called "Discovered" will be created with all discovered hosts added to it.
![](/legacyfs/online/checkpoint/57811_pastedImage_12.png)
Run the script:
![](/legacyfs/online/checkpoint/57812_pastedImage_13.png)
![](/legacyfs/online/checkpoint/57813_pastedImage_14.png)
Important Note: You must run the script on the management object because of the API calls.
This is a basic example of what we can do via the API and R80. I believe this will be useful when deploying a new gateway and administrator need to discover what is going on…
Hope this helps!
Happy scripting!